ifconfig
全称:interfaces config,主要用于设置或显示网络设备信息的。
打印:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP> inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 nd6 options=201<PERFORMNUD,DAD> gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280 stf0: flags=0<> mtu 1280 en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 options=50b<RXCSUM,TXCSUM,VLAN_HWTAGGING,AV,CHANNEL_IO> ether b0:e5:f9:f3:a8:de //mac地址 inet6 fe80::1c2c:2b1d:6af8:3558%en0 prefixlen 64 secured scopeid 0x6 //ipv6地址 inet 10.1.63.198 netmask 0xffffff00 broadcast 10.1.63.255 //ipv4地址、子网掩码、广播地址 nd6 options=201<PERFORMNUD,DAD> media: autoselect (1000baseT <full-duplex>) status: active
|
ifconfig打印的是所有网络设备的信息,并且名称是专有名词比如en0,一般来说如果电脑只连了WIFI那么en0代表的就是WIFI网卡信息,如果还插了网线那么en0代表的就是以太网网卡信息,en1代表的才是WIFI网卡信息。可以配合networksetup -listallhardwareports
查看。
networksetup -listallhardwareports
打印:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| Hardware Port: Ethernet Device: en0 Ethernet Address: b0:e5:f9:f3:a8:de
Hardware Port: USB 10/100/1000 LAN Device: en4 Ethernet Address: 00:e0:4c:89:fe:55
Hardware Port: Ethernet Adapter (en5) Device: en5 Ethernet Address: 16:6a:42:01:62:87
Hardware Port: Ethernet Adapter (en6) Device: en6 Ethernet Address: 16:6a:42:01:62:88
Hardware Port: Wi-Fi Device: en1 Ethernet Address: b0:e5:f9:f2:56:75
...
|
networksetup -listallnetworkservices
打印:
参考
ifconfig man手册
Linux ifconfig命令