[lingyun@localhost ~]$ ping 192.168.2.1 //先ping路由器,是否能够ping通。这里ping通没问题
PING 192.168.2.1 (192.168.2.1) 56(84) bytes of data.
64 bytes from 192.168.2.1: icmp_seq=1 ttl=64 time=3.29 ms
64 bytes from 192.168.2.1: icmp_seq=2 ttl=64 time=5.87 ms
^C
--- 192.168.2.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1299ms
rtt min/avg/max/mdev = 3.294/4.585/5.877/1.293 ms
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
[lingyun@localhost ~]$ route add default gw 192.168.2.1 //添加网关。
SIOCADDRT: 不允许的操作
[lingyun@localhost ~]$ sudo route add default gw 192.168.2.1
[lingyun@localhost ~]$ ping 4.2.2.2 //ping一个通用的dns地址,能ping通说明能上网。
PING 4.2.2.2 (4.2.2.2) 56(84) bytes of data.
64 bytes from 4.2.2.2: icmp_seq=1 ttl=52 time=285 ms
64 bytes from 4.2.2.2: icmp_seq=2 ttl=52 time=280 ms
^C
--- 4.2.2.2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1988ms
rtt min/avg/max/mdev = 280.447/283.117/285.788/2.722 ms
[lingyun@localhost ~]$ ping baidu.com
PING baidu.com (111.13.101.208) 56(84) bytes of data.
64 bytes from 111.13.101.208: icmp_seq=1 ttl=51 time=31.3 ms
64 bytes from 111.13.101.208: icmp_seq=2 ttl=51 time=34.7 ms
^C
--- baidu.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1631ms
rtt min/avg/max/mdev = 31.354/33.076/34.798/1.722 ms
[lingyun@localhost ~]$ wget ftp://iot-yun.eicp.net/linux_tools/conf/vim_conf/vim_conf_V2.1.1.bin
PING 192.168.2.1 (192.168.2.1) 56(84) bytes of data.
64 bytes from 192.168.2.1: icmp_seq=1 ttl=64 time=3.29 ms
64 bytes from 192.168.2.1: icmp_seq=2 ttl=64 time=5.87 ms
^C
--- 192.168.2.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1299ms
rtt min/avg/max/mdev = 3.294/4.585/5.877/1.293 ms
[lingyun@localhost ~]$ route -n // 检查网络配置,这里发现没有网关。
Kernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
[lingyun@localhost ~]$ route add default gw 192.168.2.1 //添加网关。
SIOCADDRT: 不允许的操作
[lingyun@localhost ~]$ sudo route add default gw 192.168.2.1
[lingyun@localhost ~]$ ping 4.2.2.2 //ping一个通用的dns地址,能ping通说明能上网。
PING 4.2.2.2 (4.2.2.2) 56(84) bytes of data.
64 bytes from 4.2.2.2: icmp_seq=1 ttl=52 time=285 ms
64 bytes from 4.2.2.2: icmp_seq=2 ttl=52 time=280 ms
^C
--- 4.2.2.2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1988ms
rtt min/avg/max/mdev = 280.447/283.117/285.788/2.722 ms
[lingyun@localhost ~]$ ping baidu.com
PING baidu.com (111.13.101.208) 56(84) bytes of data.
64 bytes from 111.13.101.208: icmp_seq=1 ttl=51 time=31.3 ms
64 bytes from 111.13.101.208: icmp_seq=2 ttl=51 time=34.7 ms
^C
--- baidu.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1631ms
rtt min/avg/max/mdev = 31.354/33.076/34.798/1.722 ms
[lingyun@localhost ~]$ wget ftp://iot-yun.eicp.net/linux_tools/conf/vim_conf/vim_conf_V2.1.1.bin