Linux下如何查询网卡信息(linux查网卡)

在Linux系统中使用ifconfig查询网卡信息是十分常见的用法。在Ubuntu系统中,我们可以直接使用以下命令来查询我们的网卡信息:

ifconfig -a

ifconfig会显示出所有的网络接口,比如以太网、无线网和虚拟接口,如ETH0、Wlan0等等:

eth0      Link encap:Ethernet  HWaddr 16:2e:f4:bb:d8:25  
inet addr:168.192.0.3 Bcast:168.255.255.255 Mask:255.0.0.0
inet6 addr: fe80::142e:f4ff:febb:d825/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7642783 errors:0 dropped:0 overruns:0 frame:0
TX packets:942245 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8011375067 (8.0 GB) TX bytes:87922074 (87.9 MB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:164 errors:0 dropped:0 overruns:0 frame:0
TX packets:164 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:21306 (21.3 KB) TX bytes:21306 (21.3 KB)

另外,我们也可以使用ip命令查看网卡信息:

ip addr

结果如下:

1: lo:  mtu 16436 qdisc noqueue state UNKNOWN 
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 16:2e:f4:bb:d8:25 brd ff:ff:ff:ff:ff:ff
inet 168.192.0.3/24 brd 168.255.255.255 scope global eth0
inet6 fe80::142e:f4ff:febb:d825/64 scope link
valid_lft forever preferred_lft forever
3: wlan0: mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 60:03:08:d1:d7:1f brd ff:ff:ff:ff:ff:ff

此外,我们还可以在终端中运行如下命令查看网卡信息:

dmesg | grep eth

结果如下:

[    0.000000] e1000: eth0: (PCI Express:2.5GT/s:Width x1) 16:2e:f4:bb:d8:25
[ 0.000000] e1000: eth0: Intel(R) 82573V Gigabit Ethernet Controller
[ 0.000000] e1000: eth0: MAC: 12, PHY: 12, PBA No: 02001f-0ff
[ 0.000000] NET: Registered protocol family 10
[ 0.000000] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
[ 0.000000] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 422.422420] e1000: eth0: Reset adapter

总之,通过以上几个命令,我们可以方便地查询Linux系统中的网卡信息,以了解系统网络设置情况。


数据运维技术 » Linux下如何查询网卡信息(linux查网卡)