
代码示例获取网卡信息。
cat /proc/net/arp得到以下信息:ubuntu:~$ cat /proc/net/arp
IP address       HW type     Flags       HW address            Mask     Device
192.168.72.2     0x1         0x2         00:50:56:f4:70:28     *        ens33
192.168.72.254   0x1         0x2         00:50:56:ed:51:f7     *        ens33
其中,HW type为硬件类型
| 值 | 类型 | 
|---|---|
| 0x01 | ether (Ethernet) | 
| 0xf | dlci (Frame Relay DLCI) | 
| 0x17 | strip (Metricom Starmode IP) | 
}