首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

(转)Ubuntu设立静态IP的方法

2012-06-26 
(转)Ubuntu设置静态IP的方法http://www.cnblogs.com/shengshuai/archive/2009/02/27/1399905.html?1。设定I

(转)Ubuntu设置静态IP的方法

http://www.cnblogs.com/shengshuai/archive/2009/02/27/1399905.html

?

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

热点排行