(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