##########################
###6)查看ip、网关或路由、DNS配置:
##########################
[a.查看ip配置方法]
[root@ ~]# ifconfig ==》直接命令名表示显示所有网卡IP
eth0 Link encap:Ethernet HWaddr 00:0C:29:1D:28:D5
inet addr:10.0.0.190 Bcast:10.0.0.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe1d:28d5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4154 errors:0 dropped:0 overruns:0 frame:0
TX packets:3107 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:367589 (358.9 KiB) TX bytes:481210 (469.9 KiB)
Interrupt:185 Base address:0x1400
lo Link 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:36 errors:0 dropped:0 overruns:0 frame:0
TX packets:36 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3744 (3.6 KiB) TX bytes:3744 (3.6 KiB)
[root@ ~]# ifconfig eth0 ==》显示指定网卡IP
eth0 Link encap:Ethernet HWaddr 00:0C:29:1D:28:D5
inet addr:10.0.0.190 Bcast:10.0.0.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe1d:28d5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4170 errors:0 dropped:0 overruns:0 frame:0
TX packets:3130 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:368687 (360.0 KiB) TX bytes:484496 (473.1 KiB)
Interrupt:185 Base address:0x1400
[b.查看网关和路由方法]
[root@ network-scripts]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 10.0.0.254 0.0.0.0 UG 0 0 0 eth0
[root@ ~]# netstat -rn ==》此法可以不记,记route -n即可。
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
查看linux命令帮助的命令man or info or命令 --help:
例:查看route用法
man route 和 info route 或route --help
route功能强大,同学们要熟练掌握,上面仅是一个简单的用法。
[c.查看DNS配置方法]
[root@ ~]# cat /etc/resolv.conf ==》这是常见的检查方法
nameserver 202.106.0.20
[root@ ~]# ping g.cn ==》这是常见的检查方法,返回ip地址了说明通的。
PING g.cn (74.125.71.160) 56(84) bytes of data.
64 bytes from hx-in-f160.1e100.net (74.125.71.160): icmp_seq=1 ttl=49 time=51.7 ms
[root@ ~]# host ==》这是常见的检查方法,返回ip地址了说明dns通的。
has address 211.100.98.99
--- g.cn ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 51.710/51.710/51.710/0.000 ms
[root@ ~]# dig
; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5 <<>>
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45736
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
; IN A
;; ANSWER SECTION:
. 600 IN A 211.100.98.99
;; Query time: 90 msec
;; SERVER: 202.106.0.20#53(202.106.0.20)
;; WHEN: Mon Feb 20 11:50:57 2012
;; MSG SIZE rcvd: 51
[root@ ~]# nslookup
>
Server: 202.106.0.20
Address: 202.106.0.20#53
Non-authoritative answer:
Name:
Address: 211.100.98.99
7)如果win32和linux服务器无法连接网络,分别描述排查方法?
此题留给大家了。大家可以评论或单独和我交流。
提示:基本检查思路:
a.物理链路是否通畅
b.本机IP,路由,DNS的设置情况是否达标。
c.测试到网关或路由器的通畅情况。
d.测试ping公网ip的通常情况(平时要记几个外部IP)
e.测试DNS的通畅,可以ping 88181.com看是否出对应IP。
根据每级的结果来排查,如果是系统管理员,以上问题都检查了后,还可以在网关路由服务器上向上向下测试。
逐级排查。