openwrt虚拟机的network unreachable

在Hyper-V中的openwrt虚拟机遇到网络无法访问的问题,表现为wget无法连接到openwrt.org,ping baidu.com失败。通过检查发现是DNS解析和路由设置不正确。在/etc/resolv.conf中添加网关地址为nameserver,并尝试添加路由规则,但初期的路由设置(route add 0.0.0.0 netmask 0.0.0.0 gw 192.168.100.1)并未解决问题。最终通过使用正确的命令(route add -net 0.0.0.0 netmask 0.0.0.0 gw 192.168.100.1 dev br-lan)解决了网络连通性问题。
摘要由CSDN通过智能技术生成

之前在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

 <

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值