Ubuntu设置静态IP,解决重启后需要重新设置的问题。
生活随笔
收集整理的這篇文章主要介紹了
Ubuntu设置静态IP,解决重启后需要重新设置的问题。
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
Ubuntu 8.10 默認(rèn)是gnome,默認(rèn)是DHCP自動獲取IP。設(shè)定好靜態(tài)IP,重啟了也會變。
1。設(shè)定IP
sudo gedit? /etc/network/interfaces
auto lo
iface lo inet loopback??????????? #lo 是本地回環(huán)地址: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????? #設(shè)定eth0的IP
這樣,IP并沒有立即生效。
sudo /etc/init.d/networking restart
2。這時(shí)候就能ping到局域網(wǎng)中的電腦了。但是上不了Internet,是因?yàn)闆]有設(shè)置DNS的原因。DNS信息保存在/etc/resolv.conf中,一旦更改,立即生效。
sudo gedit /etc/resolv.conf
nameserver 208.67.222.222
nameserver 208.67.220.220
現(xiàn)在可以上網(wǎng)了。
附網(wǎng)卡設(shè)置相關(guān)命令:
查看網(wǎng)卡信息: ifconfig
設(shè)定一個(gè)網(wǎng)卡IP:ifconfig eth1 192.168.1.10 netmask 255.255.255.0?
重啟網(wǎng)卡使設(shè)定生效:sudo /etc/init.d/networking restart
更改MAC地址:ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
查看路由相關(guān)信息:route -n
1。設(shè)定IP
sudo gedit? /etc/network/interfaces
auto lo
iface lo inet loopback??????????? #lo 是本地回環(huán)地址: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????? #設(shè)定eth0的IP
這樣,IP并沒有立即生效。
sudo /etc/init.d/networking restart
2。這時(shí)候就能ping到局域網(wǎng)中的電腦了。但是上不了Internet,是因?yàn)闆]有設(shè)置DNS的原因。DNS信息保存在/etc/resolv.conf中,一旦更改,立即生效。
sudo gedit /etc/resolv.conf
nameserver 208.67.222.222
nameserver 208.67.220.220
現(xiàn)在可以上網(wǎng)了。
附網(wǎng)卡設(shè)置相關(guān)命令:
查看網(wǎng)卡信息: ifconfig
設(shè)定一個(gè)網(wǎng)卡IP:ifconfig eth1 192.168.1.10 netmask 255.255.255.0?
重啟網(wǎng)卡使設(shè)定生效:sudo /etc/init.d/networking restart
更改MAC地址:ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
查看路由相關(guān)信息:route -n
轉(zhuǎn)載于:https://www.cnblogs.com/shengshuai/archive/2009/02/27/1399905.html
總結(jié)
以上是生活随笔為你收集整理的Ubuntu设置静态IP,解决重启后需要重新设置的问题。的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [导入]Vista的translator
- 下一篇: Ubuntu下千千静听Audacious