You can control the output of the netstat and ifconfig commands. Create a file that is named inet_type in the /etc/default directory. Then, specify the value of the DEFAULT_IP variable. For more information about the inet_type, see the inet_type(4) man page.
Create the /etc/default/inet_type file.
Make one of the following entries, as needed.
To display IPv4 information only, type:
DEFAULT_IP=IP_VERSION4 |
To display both IPv4 and IPv6 information, type:
DEFAULT_IP=BOTH |
Or
DEFAULT_IP=IP_VERSION6 |
The -4 and -6 flags in ifconfig override the value set in the inet_type file. The -f flag in netstat also overrides the value that is 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 results:
% ifconfig -a
lo0: flags=1000849 mtu 8232 index 1
inet 120.10.0.1 netmask ff000000
le0: flags=1000843 mtu 1500 index 2
inet 120.46.86.54 netmask ffffff00 broadcast 120.46.86.255
ether 8:0:20:56:a8
lo0: flags=2000849 mtu 8252 index 1
inet6 ::1/128
le0: flags=2000841 mtu 1500 index 2
ether 8:0:20:56:a8
inet6 fe80::a00:fe73:56a8/10
le0:1: flags=2080841 mtu 1500 index 2
inet6 fec0::56:a00:fe73:56a8/64
le0:2: flags=2080841 mtu 1500 index 2
inet6 2::56:a00:fe73:56a8/64
|
When you specify the DEFAULT_IP=IP_VERSION4 variable in the inet_type file, you should have the following results:
% ifconfig -a
lo0: flags=849 mtu 8232
inet 120.10.0.1 netmask ff000000
le0: flags=843 mtu 1500
inet 120.46.86.54 netmask ffffff00 broadcast 120.46.86.255
ether 8:0:20:56:a8
|