openwrt虚拟机的network unreachable

之前在hyper-v中装了openwrt的ATTITUDE ADJUSTMENT (12.09, r36088)这个最新版本 我之前的文章有提到怎么安装 link

但是发现用opkg update不能用,说wget不能连到openwrt.org这个网络

发现ping也ping不同baidu.com,出现提示

 

root@OpenWrt:~# ping baidu.com
ping: bad address 'baidu.com'

 

是dns解析问题,在/etc/resolv.conf中,添加我的网关:192.168.100.1

在文件中添加:

nameserver 192.168.100.1

现在再ping baidu.com

 

root@OpenWrt:~# ping www.baidu.com
PING www.baidu.com (119.75.217.56): 56 data bytes
ping: sendto: Network is unreachable

 

发现路由应该不正确

所以查看了一下路由:

 

root@OpenWrt:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.100.0 * 255.255.255.0 U 0 0 0 br-lan

 

没有default,所以连不上外面的网络

后来我不假思索的就写了个

route add 0.0.0.0 netmask 0.0.0.0 gw 192.168.100.1

 

结果还是连不上,route的结果和我预想的不一样

default 192.168.100.1 255.255.255.255 UGH 0 0 0 br-lan

 

掩码是255.255.255.255

所以就去多方查找,看手册等,找到要用桥接的方式连就可以了

route add -net 0.0.0.0  netmask 0.0.0.0 gw 192.168.100.1 dev br-lan

 

posted @ 2014-08-08 21:33  yantze  阅读(4339)  评论(0编辑  收藏  举报