(1)netstat -ni
给出接口及其名字统计信息。
zsj@zsj-virtual-machine:~/unp/unpv13e/tcpcliserv$ netstat -ni
Kernel Interface table
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 1500 0 5929 0 0 0 1376 0 0 0 BMRU
lo 65536 0 1136 0 0 0 1136 0 0 0 LRU
其中 eth0是以太网,lo是环回网。
(2)netstat -r
展示路由表
sj@zsj-virtual-machine:~/unp/unpv13e/tcpcliserv$ netstat -r
内核 IP 路由表
Destination Gateway Genmask Flags MSS Window irtt Iface
default 192.168.5.2 0.0.0.0 UG 0 0 0 eth0
link-local * 255.255.0.0 U 0 0 0 eth0
192.168.5.0 * 255.255.255.0 U 0 0 0 eth0
(3)ifconfig eth0
执行各个网络接口的名字,获得每个接口的详细信息。
zsj@zsj-virtual-machine:~/unp/unpv13e/tcpcliserv$ ifconfig eth0
eth0 Link encap:以太网 硬件地址 00:0c:29:46:83:0e
inet 地址:192.168.5.142 广播:192.168.5.255 掩码:255.255.255.0
inet6 地址: fe80::20c:29ff:fe46:830e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 跃点数:1
接收数据包:5952 错误:0 丢弃:0 过载:0 帧数:0
发送数据包:1380 错误:0 丢弃:0 过载:0 载波:0
碰撞:0 发送队列长度:1000
接收字节:556860 (556.8 KB) 发送字节:197502 (197.5 KB)
(4)找出本地网络中众多主机的IP地址的方法之一是:
zsj@zsj-virtual-machine:~/unp/unpv13e/tcpcliserv$ ping -b 192.168.5.255
WARNING: pinging broadcast address
PING 192.168.5.255 (192.168.5.255) 56(84) bytes of data.
64 bytes from 192.168.5.2: icmp_seq=1 ttl=128 time=0.569 ms
64 bytes from 192.168.5.2: icmp_seq=2 ttl=128 time=0.490 ms
64 bytes from 192.168.5.2: icmp_seq=3 ttl=128 time=0.442 ms
64 bytes from 192.168.5.2: icmp_seq=4 ttl=128 time=0.465 ms
64 bytes from 192.168.5.2: icmp_seq=5 ttl=128 time=0.490 ms
64 bytes from 192.168.5.2: icmp_seq=6 ttl=128 time=0.504 ms
64 bytes from 192.168.5.2: icmp_seq=7 ttl=128 time=0.445 ms
64 bytes from 192.168.5.2: icmp_seq=8 ttl=128 time=0.493 ms