温馨提示×

Debian ifconfig如何查看网络接口

小樊
61
2025-02-25 06:24:37
栏目: 智能运维

在 Debian 系统中,你可以使用 ifconfig 命令来查看网络接口的信息。以下是具体步骤:

  1. 打开终端(Terminal)。

  2. 输入以下命令并按下回车键:

    ifconfig 
  3. 你将看到系统中所有活动的网络接口及其相关信息,包括 IP 地址、子网掩码、广播地址等。输出示例可能如下所示:

    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::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 264 bytes 20480 (20.0 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 264 bytes 20480 (20.0 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

    在这个示例中,eth0 是一个以太网接口,而 lo 是本地回环接口。

如果你只想查看特定的网络接口,可以使用 ifconfig 后面跟上接口名称,例如:

ifconfig eth0 

请注意,ifconfig 命令在一些较新的 Debian 版本中可能已经被弃用,推荐使用 ip 命令来代替。你可以使用以下命令来查看网络接口信息:

ip addr show 

或者查看特定接口的信息:

ip addr show eth0 

0