在 Debian 系統中,你可以使用 ifconfig
命令來查看網絡接口的配置信息。以下是如何使用該命令的一些基本步驟:
打開終端:你可以通過按 Ctrl + Alt + T
快捷鍵打開終端。
輸入命令:在終端中輸入以下命令并按下回車鍵:
ifconfig
查看輸出:命令執行后,你會看到類似如下的輸出,顯示了所有活動網絡接口的詳細信息:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.5 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::a00:27ff:fe4e:66a1 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:4e:66:a1 txqueuelen 1000 (Ethernet)
RX packets 1003421 bytes 123456789 (117.7 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 987654 bytes 987654321 (941.5 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 321 bytes 24321 (23.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 321 bytes 24321 (23.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
輸出中的每一列代表不同的信息:
eth0
: 網絡接口名稱。flags
: 接口的狀態標志。mtu
: 最大傳輸單元。inet
: IPv4 地址和子網掩碼。inet6
: IPv6 地址和前綴長度。ether
: MAC 地址。txqueuelen
: 發送數據包的隊列長度。RX packets/bytes
: 接收到的數據包數量和總字節數。TX packets/bytes
: 發送的數據包數量和總字節數。查看特定接口:如果你只想查看某個特定接口的信息,可以在 ifconfig
后面指定接口名稱,例如:
ifconfig eth0
請注意,ifconfig
命令在較新的 Debian 版本中可能已被棄用,推薦使用 ip
命令來代替。你可以使用以下命令查看網絡配置:
ip addr show
或者查看特定接口的信息:
ip addr show eth0