UNIX 网络分析( 二 )


不同的操作系统使用不同的方式输出信息(和细节) 。清单 3 展示了一个 Linux?系统的输出 。
清单 3. Linux 系统的输出
eth0 Link encap:Ethernet HWaddr 00:1d:60:1b:9a:2d 
 inet addr:192.168.0.2 Bcast:192.168.3.255 Mask:255.255.252.0
 inet6 addr: fe80::21d:60ff:fe1b:9a2d/64 Scope:Link
 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
 RX packets:2371085881 errors:36 dropped:0 overruns:0 frame:36
 TX packets:2861233776 errors:0 dropped:0 overruns:0 carrIEr:0
 collisions:0 txqueuelen:1000 
 RX bytes:913269364222 (850.5 GiB) TX bytes:3093820025338 (2.8 TiB)
 Interrupt:23 Base address:0x4000 
loLink encap:Local Loopback 
 inet addr:127.0.0.1 Mask:255.0.0.0
 inet6 addr: ::1/128 Scope:Host
 UP LOOPBACK RUNNING MTU:16436 Metric:1
 RX packets:279755697 errors:0 dropped:0 overruns:0 frame:0
 TX packets:279755697 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:0 
 RX bytes:388038389807 (361.3 GiB) TX bytes:388038389807 (361.3 GiB)
清单 4 展示了 Mac OS X? 系统的输出 。
清单 4. Mac OS X 系统的输出
lo0: flags=8049 mtu 16384
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
inet 127.0.0.1 netmask 0xff000000 
inet6 ::1 prefixlen 128 
gif0: flags=8010 mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863 mtu 1500
inet 192.168.0.101 netmask 0xfffffc00 broadcast 192.168.3.255
ether 00:16:cb:a0:3b:cb 
media: autoselect (1000baseT ) status: active
supported media: autoselect 10baseT/UTP10baseT/UTP 
 10baseT/UTP  10baseT/UTP 
 100baseTX100baseTX 
 100baseTX  100baseTX 
 1000baseT  1000baseT 
 1000baseT  none
fw0: flags=8822 mtu 2030
lladdr 00:17:f2:ff:fe:7b:84:d6 
media: autoselect  status: inactive
supported media: autoselect 
en1: flags=8822 mtu 1500
ether 00:17:f2:9b:3d:38 
media: autoselect ()
supported media: autoselect
en5: flags=8963 mtu 1500
inet6 fe80::21c:42ff:fe00:8%en5 prefixlen 64 scopeid 0x7 
inet 10.211.55.2 netmask 0xffffff00 broadcast 10.211.55.255
ether 00:1c:42:00:00:08 
media: autoselect status: active
supported media: autoselect
en6: flags=8963 mtu 1500
inet6 fe80::21c:42ff:fe00:9%en6 prefixlen 64 scopeid 0x8 
inet 10.37.129.2 netmask 0xffffff00 broadcast 10.37.129.255
ether 00:1c:42:00:00:09 
media: autoselect status: active
supported media: autoselect
在任何情况下,通常都可以找到所连接的网络设备的 Internet 地址和掩码 。显然,如果拥有多个网络设备,那么可以在输出中获得有关每个设备的信息,并且有可能从一个机器中访问各种不同的网络和系统 。
查找名称解析服务
下一步是确定当前机器的配置,这个配置应当与名称服务系统的配置关联起来,名称服务将在您访问另一台机器上的服务时将系统的名称和域名转换为 IP 地址 。

推荐阅读