Ubuntu 固定IP设置
2013-06-25 19:44
211 查看
设定IP
$sudo gedit /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.0.111
netmask 255.255.255.0
gateway 192.168.0.1
保存,并关闭gedit。
这样,IP并没有立即生效。需要执行
$sudo /etc/init.d/networking restart
这时候就能ping到局域网中的电脑了。但是上不了Internet,是因为没有设置DNS的原因。DNS信息保存在/etc/resolv.conf中,一旦更改,立即生效。
$sudo gedit /etc/resolv.conf
nameserver 192.168.2.43
nameserver 192.168.2.6
保存并关闭,现在就可以上网了。
附网卡设置相关命令:
查看网卡信息: 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
---------------------------------/etc/network/interfaces------------------------------
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 10.89.41.203
netmask 255.255.255.0
gateway 10.89.41.254
------------------------------------------/etc/resolv.conf-----------------------------------------
nameserver 10.89.48.50
nameserver 10.89.48.12
$sudo gedit /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.0.111
netmask 255.255.255.0
gateway 192.168.0.1
保存,并关闭gedit。
这样,IP并没有立即生效。需要执行
$sudo /etc/init.d/networking restart
这时候就能ping到局域网中的电脑了。但是上不了Internet,是因为没有设置DNS的原因。DNS信息保存在/etc/resolv.conf中,一旦更改,立即生效。
$sudo gedit /etc/resolv.conf
nameserver 192.168.2.43
nameserver 192.168.2.6
保存并关闭,现在就可以上网了。
附网卡设置相关命令:
查看网卡信息: 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
---------------------------------/etc/network/interfaces------------------------------
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 10.89.41.203
netmask 255.255.255.0
gateway 10.89.41.254
------------------------------------------/etc/resolv.conf-----------------------------------------
nameserver 10.89.48.50
nameserver 10.89.48.12
相关文章推荐
- ubuntu设置固定IP
- 第二章,ubuntu系统的查看防火墙,切换root用户,设置固定ip、系统时间等
- [转载]Ubuntu 14.04设置固定ip
- ubuntu设置固定IP
- ubuntu固定ip设置
- Ubuntu虚拟机设置固定IP上网(配置IP、网关、DNS、防止resolv.conf被重写)
- Ubuntu下启用root账户和设置固定IP && ntp解决虚拟机Ubuntu时间与windows时间不同步
- Ubuntu 设置固定ip,NetWork-Manager不能保存固定ip解决办法
- Linux系列:Ubuntu虚拟机设置固定IP上网(配置IP、网关、DNS、防止resolv.conf被重写)(转载)
- Ubuntu 设置网卡固定IP
- Ubuntu设置固定ip后网络图标消失且无法查看ip解决办法
- Ubuntu虚拟机设置固定IP上网(配置IP、网关、DNS、防止resolv.conf被重写)
- 虚拟机中Ubuntu设置固定IP方法
- vmware11中Ubuntu14下eth0固定IP的设置方式
- ubuntu14.04 --如何设置固定IP
- Ubuntu设置固定ip
- ubuntu13.10 设置固定ip
- Ubuntu下固定IP网络设置——NAT
- VMWare中Ubuntu设置固定IP上网
- Ubuntu 设置为固定ip