《Linux杂记》开发板无法ping通外网

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/u013162035/article/details/80673887

ping: sendto: Network is unreachable

在开发板上ping路由上的IP的时候可以ping通,但是ping外网的IP的时候提示“ping: sendto: Network is unreachable”后来使用route命令看了一下。
# route
这里写图片描述
发现网关(Gateway),是空着的没有设置,于是执行一下命令设置了网关:
# route add default gw 192.168.1.1
# route

这里写图片描述
最后终于可以ping通外网了。

 # ping 180.97.33.108

这里写图片描述
【注1】笔者ping的是百度IP。
【注2】也可将设置网关命令放入启动脚本中,下次启动无需再次设置网关。

#vi /etc/rc.d/rcS

这里写图片描述

展开阅读全文

centos 无法ping外网,但可以ping通网关

11-13

centos 无法ping通外网,但可以ping通网关rnrnrn###这是我/etc/sysconfig/network-scripts/ifcfg-eth0 的网络配置信息rnrn[code=text]DEVICE="eth0"rnBOOTPROTO=nonernHWADDR="00:23:54:DE:01:69"rnONBOOT="yes"rnTYPE="Ethernet"rnUSERCTL=nornIPV6INIT=nornPEERDNS=yesrnNETMASK=255.255.255.0rnIPADDR=192.168.1.110rnGATEWAY=192.168.1.1rnDNS1=202.96.134.133rnDNS2=202.96.128.86[/code]rnrn###############ifconfig详细rn[code=text][root@laobi /]# ifconfigrneth0 Link encap:Ethernet HWaddr 00:23:54:DE:01:69 rn inet addr:192.168.1.110 Bcast:192.168.1.255 Mask:255.255.255.0rn inet6 addr: fe80::223:54ff:fede:169/64 Scope:Linkrn UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1rn RX packets:1924 errors:0 dropped:0 overruns:0 frame:0rn TX packets:1239 errors:0 dropped:0 overruns:0 carrier:0rn collisions:0 txqueuelen:1000 rn RX bytes:211170 (206.2 KiB) TX bytes:119004 (116.2 KiB)rn Interrupt:27 Base address:0xe000 rnrnlo Link encap:Local Loopback rn inet addr:127.0.0.1 Mask:255.0.0.0rn inet6 addr: ::1/128 Scope:Hostrn UP LOOPBACK RUNNING MTU:16436 Metric:1rn RX packets:229 errors:0 dropped:0 overruns:0 frame:0rn TX packets:229 errors:0 dropped:0 overruns:0 carrier:0rn collisions:0 txqueuelen:0 rn RX bytes:22287 (21.7 KiB) TX bytes:22287 (21.7 KiB)[/code]rnrn#########################ping 网关rn[code=text][root@laobi /]# ping 192.168.1.1rnPING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.rn64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.377 msrn64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.150 msrn64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.144 msrn64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=0.140 ms[/code]rnrnrn 论坛

nova-network配置后无法ping外网

04-18

配置如下:rnrnnetwork_manager = nova.network.manager.FlatDHCPManagerrnfirewall_driver = nova.virt.libvirt.firewall.IptalbesFirewallDriverrnnetwork_size = 254rnallow_same_net_traffic = Falsernmulti_host = Truernsend_arp_for_ha = Truernshare_dhcp_address = Truernforce_dhcp_release = Truernflat_interface = eth1rnflat_network_bridge = br100rnpublic_interface = eth1rnrn[root@compute1 ~]# route rnKernel IP routing tablernDestination Gateway Genmask Flags Metric Ref Use Ifacern192.168.70.0 * 255.255.255.0 U 0 0 0 eth0rn10.0.0.0 * 255.255.255.0 U 0 0 0 br100rn192.168.122.0 * 255.255.255.0 U 0 0 0 virbr0rnlink-local * 255.255.0.0 U 1002 0 0 eth0rndefault 10.0.0.1 0.0.0.0 UG 0 0 0 br100rn结果如下:rn[root@compute1 ~]# ping www.baidu.comrnping: unknown host www.baidu.comrnrneth0 配置的192段 eth1 配置的10段rnrn[root@compute1 ~]# iptables -t filter -Srn-P INPUT ACCEPTrn-P FORWARD ACCEPTrn-P OUTPUT ACCEPTrn-N nova-api-metadat-FORWARDrn-N nova-api-metadat-INPUTrn-N nova-api-metadat-OUTPUTrn-N nova-api-metadat-localrn-N nova-filter-toprn-N nova-network-FORWARDrn-N nova-network-INPUTrn-N nova-network-OUTPUTrn-N nova-network-localrn-A INPUT -j nova-network-INPUT rn-A INPUT -j nova-api-metadat-INPUT rn-A INPUT -i virbr0 -p udp -m udp --dport 53 -j ACCEPT rn-A INPUT -i virbr0 -p tcp -m tcp --dport 53 -j ACCEPT rn-A INPUT -i virbr0 -p udp -m udp --dport 67 -j ACCEPT rn-A INPUT -i virbr0 -p tcp -m tcp --dport 67 -j ACCEPT rn-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT rn-A INPUT -p icmp -j ACCEPT rn-A INPUT -i lo -j ACCEPT rn-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT rn-A INPUT -j REJECT --reject-with icmp-host-prohibited rn-A FORWARD -j nova-filter-top rn-A FORWARD -j nova-network-FORWARD rn-A FORWARD -j nova-api-metadat-FORWARD rn-A FORWARD -d 192.168.122.0/24 -o virbr0 -m state --state RELATED,ESTABLISHED -j ACCEPT rn-A FORWARD -s 192.168.122.0/24 -i virbr0 -j ACCEPT rn-A FORWARD -i virbr0 -o virbr0 -j ACCEPT rn-A FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable rn-A FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable rn-A FORWARD -j REJECT --reject-with icmp-host-prohibited rn-A OUTPUT -j nova-filter-top rn-A OUTPUT -j nova-network-OUTPUT rn-A OUTPUT -j nova-api-metadat-OUTPUT rn-A nova-api-metadat-INPUT -d 192.168.70.201/32 -p tcp -m tcp --dport 8775 -j ACCEPT rn-A nova-filter-top -j nova-network-local rn-A nova-filter-top -j nova-api-metadat-local rn-A nova-network-FORWARD -d 255.255.255.255/32 -p udp -m physdev --physdev-in eth1 -m udp --dport 67 -j DROP rn-A nova-network-FORWARD -d 255.255.255.255/32 -p udp -m physdev --physdev-out eth1 -m udp --dport 67 -j DROP rn-A nova-network-FORWARD -d 10.0.0.1/32 -m physdev --physdev-in eth1 -j DROP rn-A nova-network-FORWARD -s 10.0.0.1/32 -m physdev --physdev-out eth1 -j DROP rn-A nova-network-FORWARD -i br100 -j ACCEPT rn-A nova-network-FORWARD -o br100 -j ACCEPT rn-A nova-network-INPUT -i br100 -p udp -m udp --dport 67 -j ACCEPT rn-A nova-network-INPUT -i br100 -p tcp -m tcp --dport 67 -j ACCEPT rn-A nova-network-INPUT -i br100 -p udp -m udp --dport 53 -j ACCEPT rn-A nova-network-INPUT -i br100 -p tcp -m tcp --dport 53 -j ACCEPT rnrn[root@compute1 ~]# iptables -t nat -Srn-P PREROUTING ACCEPTrn-P POSTROUTING ACCEPTrn-P OUTPUT ACCEPTrn-N nova-api-metadat-OUTPUTrn-N nova-api-metadat-POSTROUTINGrn-N nova-api-metadat-PREROUTINGrn-N nova-api-metadat-float-snatrn-N nova-api-metadat-snatrn-N nova-network-OUTPUTrn-N nova-network-POSTROUTINGrn-N nova-network-PREROUTINGrn-N nova-network-float-snatrn-N nova-network-snatrn-N nova-postrouting-bottomrn-A PREROUTING -j nova-network-PREROUTING rn-A PREROUTING -j nova-api-metadat-PREROUTING rn-A POSTROUTING -j nova-network-POSTROUTING rn-A POSTROUTING -j nova-api-metadat-POSTROUTING rn-A POSTROUTING -j nova-postrouting-bottom rn-A POSTROUTING -s 192.168.122.0/24 ! -d 192.168.122.0/24 -p tcp -j MASQUERADE --to-ports 1024-65535 rn-A POSTROUTING -s 192.168.122.0/24 ! -d 192.168.122.0/24 -p udp -j MASQUERADE --to-ports 1024-65535 rn-A POSTROUTING -s 192.168.122.0/24 ! -d 192.168.122.0/24 -j MASQUERADE rn-A OUTPUT -j nova-network-OUTPUT rn-A OUTPUT -j nova-api-metadat-OUTPUT rn-A nova-api-metadat-snat -j nova-api-metadat-float-snat rn-A nova-network-POSTROUTING -s 10.0.0.0/24 -d 192.168.70.201/32 -j ACCEPT rn-A nova-network-POSTROUTING -s 10.0.0.0/24 -d 10.0.0.0/24 -m conntrack ! --ctstate DNAT -j ACCEPT rn-A nova-network-PREROUTING -d 169.254.169.254/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.70.201:8775 rn-A nova-network-snat -j nova-network-float-snat rn-A nova-network-snat -s 10.0.0.0/24 -o eth0 -j SNAT --to-source 192.168.70.201 rn-A nova-postrouting-bottom -j nova-network-snat rn-A nova-postrouting-bottom -j nova-api-metadat-snat rnrn求帮助rnrn 论坛

没有更多推荐了,返回首页