You can control the output of the netstat and ifconfig commands to display IPv4 information only, or both IPv4 and IPv6 information.
Create the /etc/default/inet_type file.
Add one of the following entries to /etc/default/inet_type, as required for your network:
To display IPv4 information only:
DEFAULT_IP=IP_VERSION4 |
To display both IPv4 and IPv6 information:
DEFAULT_IP=BOTH |
Or
DEFAULT_IP=IP_VERSION6 |
For more information about the inet_type file, see the inet_type(4) man page.
The -4 and -6 flags in the ifconfig command override the values set in the inet_type file. The -f flag in the netstat command also overrides the values set in the inet_type file.
When you specify the DEFAULT_IP=BOTH or DEFAULT_IP=IP_VERSION6 variable in the inet_type file, you should have the following output:
% ifconfig -a
lo0: flags=1000849 mtu 8232 index 1
inet 10.10.0.1 netmask ff000000
qfe0: flags=1000843 mtu 1500 index 2
inet 10.46.86.54 netmask ffffff00 broadcast 10.46.86.255
ether 8:0:20:56:a8
lo0: flags=2000849 mtu 8252 index 1
inet6 ::1/128
qfe0: flags=2000841 mtu 1500 index 2
ether 8:0:20:56:a8
inet6 fe80::a00:fe73:56a8/10
qfe0:1: flags=2080841 mtu 1500 index 2
inet6 2001:db8:3c4d:5:a00:fe73:56a8/64
|
When you specify the DEFAULT_IP=IP_VERSION4 or DEFAULT_IP=IP_VERSION6 variable in the inet_type file, you should have the following output:
% ifconfig -a
lo0: flags=849 mtu 8232
inet 10.10.0.1 netmask ff000000
qfe0: flags=843 mtu 1500
inet 10.46.86.54 netmask ffffff00 broadcast 10.46.86.255
ether 8:0:20:56:a8
|