网络之常用指令
2013-09-01 18:46
253 查看
1.ping :用来检查网络上的某台主机是否为存活状态;利用icmp协议的ECHO_REQUEST 数据包强制从特定的主机上返回响应。
-c 数值 :后面接的是执行ping的次数
2.route :路由的添加删除
route add [-net|-host] [网域或主机] netmask [mask] [gw|dev]
route del [-net|-host] [网域或主机] netmask [mask] [gw|dev]
-net :后接的是一个网域
-host :后接的是一个主机ip
netmask :与网域有关,用过netmask设定网域的大小
gw :网关,
dev:当指定由那块网卡联机出去,就使用这个设定,如eth0等
1.查看路由
Destination :就是network
Genmask :就是netmask ,这两个就指定了一个完整的网域
Gateway :该网域是通过那个网关连接出去的,如果显示0.0.0.0 表示该路由是直接由本机传送。若显示ip,表示该路由需要通过网关传送。
Flags 的标志有:
U:该路由是启动的
H:目标是一部主机而非网域
G:需要通过外部主机的网关来传递封包
Iface:这个路由传递封包的接口
route add -net 192.168.100.0 netmask 255.255.255.0 dev eth0
route add -net 172.16.6.0 netmask 255.255.255.0 gw 172.16.2.25
route add default gw 192.168.1.250
route del -net 169.254.0.0 netmask 255.255.0.0 dev eth0
route del -net 172.16.6.0 netmask 255.255.255.0 gw 172.16.2.25
-c 数值 :后面接的是执行ping的次数
[root@zhu1 ~]# ping -c 5 www.baidu.com PING www.a.shifen.com (115.239.210.26) 56(84) bytes of data. 64 bytes from 115.239.210.26: icmp_seq=1 ttl=54 time=11.9 ms 64 bytes from 115.239.210.26: icmp_seq=2 ttl=54 time=9.16 ms 64 bytes from 115.239.210.26: icmp_seq=3 ttl=54 time=66.1 ms 64 bytes from 115.239.210.26: icmp_seq=4 ttl=54 time=10.7 ms 64 bytes from 115.239.210.26: icmp_seq=5 ttl=54 time=45.2 ms --- www.a.shifen.com ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4002ms rtt min/avg/max/mdev = 9.164/28.646/66.131/23.049 ms-W 数值 :后面跟等待响应对方主机的秒数
[root@zhu1 ~]# ping -c 3 -W 1 www.163.com PING 163.xdwscache.glb0.lxdns.com (101.227.66.158) 56(84) bytes of data. 64 bytes from 101.227.66.158: icmp_seq=1 ttl=56 time=5.36 ms 64 bytes from 101.227.66.158: icmp_seq=2 ttl=56 time=5.55 ms 64 bytes from 101.227.66.158: icmp_seq=3 ttl=56 time=5.32 ms --- 163.xdwscache.glb0.lxdns.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2004ms rtt min/avg/max/mdev = 5.329/5.416/5.551/0.113 ms一般使用-c 5 表示ping5次,因为若不带此参数会一直ping下去
2.route :路由的添加删除
route add [-net|-host] [网域或主机] netmask [mask] [gw|dev]
route del [-net|-host] [网域或主机] netmask [mask] [gw|dev]
-net :后接的是一个网域
-host :后接的是一个主机ip
netmask :与网域有关,用过netmask设定网域的大小
gw :网关,
dev:当指定由那块网卡联机出去,就使用这个设定,如eth0等
1.查看路由
[root@zhu1 ~]# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.0 * 255.255.255.0 U 0 0 0 eth0 169.254.0.0 * 255.255.0.0 U 0 0 0 eth0 default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0 [root@zhu1 ~]# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.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 192.168.1.1 0.0.0.0 UG 0 0 0 eth0-n :不适用通讯协议或主机名,直接使用ip或端口
Destination :就是network
Genmask :就是netmask ,这两个就指定了一个完整的网域
Gateway :该网域是通过那个网关连接出去的,如果显示0.0.0.0 表示该路由是直接由本机传送。若显示ip,表示该路由需要通过网关传送。
Flags 的标志有:
U:该路由是启动的
H:目标是一部主机而非网域
G:需要通过外部主机的网关来传递封包
Iface:这个路由传递封包的接口
route add -net 192.168.100.0 netmask 255.255.255.0 dev eth0
route add -net 172.16.6.0 netmask 255.255.255.0 gw 172.16.2.25
route add default gw 192.168.1.250
route del -net 169.254.0.0 netmask 255.255.0.0 dev eth0
route del -net 172.16.6.0 netmask 255.255.255.0 gw 172.16.2.25
相关文章推荐
- 第5章 Linux 常用网络指令
- 鸟哥的Linux私房菜(服务器)- 第五章、 Linux 常用网络指令
- Linux常用的网络指令-linux鸟哥的私房菜服务器篇05(阅读笔记)
- Linux常用指令---netstat(网络端口)
- Linux网络常用指令
- Linux常用网络指令
- 2.Linux 常用网络指令介绍
- 常用网络指令
- Linux常用网络指令
- 计算机网络常用指令
- Linux:Linux常用网络指令
- 第五章、 Linux 常用网络指令
- 第5章 Linux 常用网络指令
- 第五章、 Linux 常用网络指令
- Linux 常见的系统管理 + 网络管理 + 常用工具指令(简单的程序安装,如MySQL)
- 鸟哥的linux私房菜服务器架设篇第五章linux常用网络指令
- 常用网络指令介绍
- 常用网络调试指令
- 计算机常用网络指令
- Linux 常用网络指令介绍二