在Debian系统中,你可以使用ifconfig命令来查看网络接口的配置信息。以下是具体步骤:
Ctrl + Alt + T 打开终端。ifconfig 并按下回车键。示例输出:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.100 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 123456 bytes 12345678 (11.7 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 654321 bytes 65432109 (62.4 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 12345 bytes 123456 (120.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 12345 bytes 123456 (120.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ip命令(推荐)虽然ifconfig仍然广泛使用,但ip命令提供了更现代和灵活的网络管理功能。你可以使用以下命令来查看网络配置信息:
查看所有接口:
ip addr show
查看特定接口:
ip addr show eth0
查看路由表:
ip route show
查看网络命名空间(如果使用):
ip netns list
ifconfig可能已被弃用,建议优先使用ip命令。ifconfig不可用,可以通过安装net-tools包来获取它:sudo apt update
sudo apt install net-tools
通过以上方法,你可以轻松地在Debian系统中查看和管理网络配置信息。