温馨提示×

如何用ifconfig查看Debian网络接口

小樊
91
2025-02-15 05:53:02
栏目: 智能运维
Debian服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

在Debian系统中,ifconfig命令用于显示和配置网络接口。要使用ifconfig查看网络接口,请按照以下步骤操作:

  1. 打开终端(Terminal)。

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

ifconfig

这将显示系统中所有活动的网络接口及其相关信息,如IP地址、子网掩码、广播地址等。输出示例:

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 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 640  bytes 524288 (512.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 640  bytes 524288 (512.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

在这个示例中,eth0是一个活动的网络接口,具有IPv4地址192.168.1.100和IPv6地址fe80::a00:27ff:fe4e:66a1lo是本地回环接口,用于在本地计算机上进行网络通信。

请注意,ifconfig命令在某些Debian版本中可能已被弃用,建议使用ip命令替代。要使用ip命令查看网络接口,请输入以下命令:

ip addr

或者

ip a

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

推荐阅读:Debian ifconfig如何查看网络接口

0