ifconfig 命令用于配置和显示网络接口的参数。要显示广播地址,可以使用以下命令:
ifconfig <interface>
其中 <interface> 是你要查看的网络接口名称,例如 eth0 或 wlan0。
在输出的信息中,你可以找到广播地址。它通常显示在 Bcast 字段下。例如:
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 1003411 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
在这个例子中,广播地址是 192.168.1.255。
请注意,ifconfig 命令在某些系统上可能已被弃用,取而代之的是 ip 命令。要使用 ip 命令显示广播地址,请运行:
ip addr show <interface>
输出中的广播地址通常显示在 broadcast 字段下。