Ubuntu设置静态IP,解决重启后需要重新设置的问题。
生活随笔
收集整理的這篇文章主要介紹了
Ubuntu设置静态IP,解决重启后需要重新设置的问题。
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Ubuntu 8.10 默認是gnome,默認是DHCP自動獲取IP。設定好靜態IP,重啟了也會變。
1。設定IP
sudo gedit? /etc/network/interfaces
auto lo
iface lo inet loopback??????????? #lo 是本地回環地址:127.1
auto eth0
iface eth0 inet static
address 192.168.1.152
gateway 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255????? #設定eth0的IP
這樣,IP并沒有立即生效。
sudo /etc/init.d/networking restart
2。這時候就能ping到局域網中的電腦了。但是上不了Internet,是因為沒有設置DNS的原因。DNS信息保存在/etc/resolv.conf中,一旦更改,立即生效。
sudo gedit /etc/resolv.conf
nameserver 208.67.222.222
nameserver 208.67.220.220
現在可以上網了。
附網卡設置相關命令:
查看網卡信息: ifconfig
設定一個網卡IP:ifconfig eth1 192.168.1.10 netmask 255.255.255.0?
重啟網卡使設定生效:sudo /etc/init.d/networking restart
更改MAC地址:ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
查看路由相關信息:route -n
1。設定IP
sudo gedit? /etc/network/interfaces
auto lo
iface lo inet loopback??????????? #lo 是本地回環地址:127.1
auto eth0
iface eth0 inet static
address 192.168.1.152
gateway 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255????? #設定eth0的IP
這樣,IP并沒有立即生效。
sudo /etc/init.d/networking restart
2。這時候就能ping到局域網中的電腦了。但是上不了Internet,是因為沒有設置DNS的原因。DNS信息保存在/etc/resolv.conf中,一旦更改,立即生效。
sudo gedit /etc/resolv.conf
nameserver 208.67.222.222
nameserver 208.67.220.220
現在可以上網了。
附網卡設置相關命令:
查看網卡信息: ifconfig
設定一個網卡IP:ifconfig eth1 192.168.1.10 netmask 255.255.255.0?
重啟網卡使設定生效:sudo /etc/init.d/networking restart
更改MAC地址:ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
查看路由相關信息:route -n
轉載于:https://www.cnblogs.com/shengshuai/archive/2009/02/27/1399905.html
總結
以上是生活随笔為你收集整理的Ubuntu设置静态IP,解决重启后需要重新设置的问题。的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [导入]Vista的translator
- 下一篇: 在Delphi程序中应用IE浏览器控件