剛安裝完單機版 Ununtu 之後就是連不上網路,不過內網連的好好的。

設定路由

你會發現只有內網的機器可以連上主機,往外無論 Apache 還是 ssh 都連不上。如果我們在主機上 ping 網外 IP ,會出現 connect:network is unreachable 的訊息。

此時是因為 Default Route 還沒設定,請輸入以下指令:

$ route add default gw 192.168.1.xxx # 等同 Gatway

但是這樣只是臨時處理方式,如果希望固定的話,要前往此設定檔加入

$ sudo vim /etc/network/interfaces

 

iface eth0 inet static
address 192.168.1.14
netmask 255.255.255.0
gateway 192.168.1.1

# static route
up route add default gw 192.168.1.1 dev eth0

arrow
arrow
    全站熱搜

    忽倫 發表在 痞客邦 留言(0) 人氣()