openwrt虛擬機器的network unreachable

來源:互聯網
上載者:User

標籤:des   blog   http   io   檔案   問題   html   htm   

之前在hyper-v中裝了openwrt的ATTITUDE ADJUSTMENT (12.09, r36088)這個最新版本 我之前的文章有提到怎麼安裝 link

但是發現用opkg update不能用,說wget不能連到openwrt.org這個網路

發現ping也ping不同baidu.com,出現提示

[email protected]:~# ping baidu.com
ping: bad address ‘baidu.com‘

是dns解析問題,在/etc/resolv.conf中,添加我家的網關:192.168.100.1

在檔案中添加:

nameserver 192.168.100.1

現在再ping baidu.com

[email protected]:~# ping www.baidu.com
PING www.baidu.com (119.75.217.56): 56 data bytes
ping: sendto: Network is unreachable

發現路由應該不正確

所以查看了一下路由:

[email protected]:~# 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

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.