在 Linux 系統中,您可以使用以下命令來查看網絡接口信息:
ifconfig
。您將看到類似于以下內容的輸出:eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.10 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::20c:29ff:fe01:2345 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:01:23:45 txqueuelen 1000 (Ethernet)
RX packets 12345 bytes 1234567 (1.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 23456 bytes 2345678 (2.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ip addr
或者簡寫為 ip a
。您將看到類似于以下內容的輸出:1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:01:23:45 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.10/24 brd 192.168.1.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe01:2345/64 scope link
valid_lft forever preferred_lft forever
這些命令將顯示您的網絡接口、IP 地址、子網掩碼、廣播地址等信息。如果您需要更多詳細信息,可以使用 ip addr show<interface>
命令,其中