网络侦错指令: ping, ifconfig, ifup, ifdown, netstat, route, traceroute, host, nslookup,
ping 是送一个ICMP的封包给那个主机
[root@cnca-test-linux /]# ping 10.10.9.158
PING 10.10.9.158 (10.10.9.158) 56(84) bytes of data.
64 bytes from 10.10.9.158: icmp_seq=0 ttl=57 time=5.79 ms
64 bytes from 10.10.9.158: icmp_seq=1 ttl=57 time=1.68 ms
64 bytes from 10.10.9.158: icmp_seq=2 ttl=57 time=8.58 ms
64 bytes from 10.10.9.158: icmp_seq=3 ttl=57 time=5.95 ms
64 bytes from 10.10.9.158: icmp_seq=4 ttl=57 time=4.46 ms
--- 10.10.9.158 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4003ms
rtt min/avg/max/mdev = 1.685/5.295/8.583/2.247 ms, pipe 2
[root@cnca-test-linux /]#
ifconfig 设定网络参数使用的命令
[root@cnca-test-linux /]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:CD:5F:B6
inet addr:10.10.81.16 Bcast:10.10.81.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fecd:5fb6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:261604 errors:0 dropped:0 overruns:0 frame:0
TX packets:7600 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:21295623 (20.3 MiB) TX bytes:797222 (778.5 KiB)
Interrupt:10 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:7219 errors:0 dropped:0 overruns:0 frame:0
TX packets:7219 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:10461306 (9.9 MiB) TX bytes:10461306 (9.9 MiB)
ifup/ifdown 激活、关闭益而高网卡
/]# ifup eth0
/]# ifdown eth0
netstat 查看网络信息的指令
[root@cnca-test-linux /]# netstat -in
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 261760 0 0 0 7656 0 0 0 BMRU
lo 16436 0 7219 0 0 0 7219 0 0 0 LRU
[root@cnca-test-linux /]# netstat -a
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:32769 *:* LISTEN
tcp 0 0 *:sunrpc *:* LISTEN
tcp 0 0 *:ssh *:* LISTEN
tcp 0 0 cnca-test-linux:ipp *:* LISTEN
tcp 0 0 *:telnet *:* LISTEN
tcp 0 0 cnca-test-linux:smtp *:* LISTEN
tcp 0 352 10.10.81.16:ssh 10.10.81.131:12379 ESTABLISHED
udp 0 0 *:32768 *:*
udp 0 0 *:912 *:*
udp 0 0 *:sunrpc *:*
udp 0 0 *:ipp *:*
route 显示、修改路由表
[root@cnca-test-linux /]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.10.81.0 * 255.255.255.0 U 0 0 0 eth0
169.254.0.0 * 255.255.0.0 U 0 0 0 eth0
default 10.10.81.1 0.0.0.0 UG 0 0 0 eth0
traceroute 查看连接到那些主机的信息
[root@cnca-test-linux /]# traceroute 10.10.9.158
traceroute to 10.10.9.158 (10.10.9.158), 30 hops max, 38 byte packets
1 10.10.81.253 (10.10.81.253) 0.580 ms 0.376 ms 0.613 ms
2 192.168.193.17 (192.168.193.17) 0.604 ms 0.354 ms 0.374 ms
3 192.168.193.46 (192.168.193.46) 1.173 ms 1.051 ms 2.070 ms
4 192.168.193.126 (192.168.193.126) 2.619 ms 3.024 ms 2.871 ms
5 10.10.161.13 (10.10.161.13) 4.909 ms 4.728 ms 3.947 ms
6 10.10.231.245 (10.10.231.245) 3.818 ms 3.117 ms 3.664 ms
7 10.10.2.33 (10.10.2.33) 4.853 ms 4.995 ms 6.321 ms
8 10.10.2.21 (10.10.2.21) 27.196 ms 18.996 ms 19.702 ms
9 10.10.9.158 (10.10.9.158) 4.107 ms 6.035 ms 3.907 ms
[root@cnca-test-linux /]
host 显示主机的名称
[[root@cnca-test-linux /]# host -a
Trying ""
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15583
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 0
;; QUESTION SECTION:
; IN ANY
;; ANSWER SECTION:
. 85559 IN CNAME .
;; AUTHORITY SECTION:
163.com. 16617 IN NS ns3.nease.net.
163.com. 16617 IN NS ns.nease.net.
nslookup 查询主机对应的Ip
[root@cnca-test-linux /]#
[root@cnca-test-linux /]# nslookup
Non-authoritative answer:
canonical name = .
Name:
Address: 220.181.28.52
Name:
Address: 220.181.28.53
Name:
Address: 220.181.28.54
Name:
Address: 220.181.28.50
Name:
Address: 220.181.28.51
telnet 可以远程管理一些设备
[root@cnca-test-linux /]# telnet 10.10.81.136
Trying 10.10.81.136...
Connected to 10.10.81.136 (10.10.81.136).
Escape character is '^]'.
Red Hat Enterprise Linux AS release 4 (Nahant Update 3)
Kernel 2.6.9-34.EL on an i686
login:
阅读(1481) | 评论(0) | 转发(0) |