Ubuntu 12.04 静态ip的设置方法
2013-04-03 20:25
519 查看
Ubuntu 12.04 静态ip的设置方法
1. 配置静态ip地址$sudo vi /etc/network/interfaces
原有内容只有如下两行:
auto lo
iface lo inet loopback
向末尾追加以下内容:
auto eth0
iface eth0 inet static
address 192.168.0.33
gateway 192.168.0.1
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
然后保存退出;
2. 手动配置 dns(这个文件为动态的DNS重启后会恢复默认)
$sudo vi /etc/resolv.conf
想末尾追加如下内容:
nameserver 192.168.0.1
然后保存退出。
3. 重启 network 使修改生效
$sudo /etc/init.d/networking restart
这里有点有问题,就是重启ubuntu后,发现又不能上网了,问题出在 /etc/resolv.conf。重启后,此文件配置的dns又被自动修改为默认值。所以需要永久性修改DNS。方法如下:
vim /etc/resolvconf/resolv.conf.d/base
cd /etc/resolvconf/resolv.conf.d/
# cat base
nameserver 192.168.0.1
nameserver 8.8.8.8
nameserver 8.8.4.4
相关文章推荐
- Ubuntu 12.04 静态ip的设置方法
- Ubuntu 12.04 静态ip的设置方法
- Ubuntu 12.04 静态ip的设置方法
- ubuntu 12.04 静态ip的设置方法
- ubuntu 12.04 静态ip的设置方法
- Ubuntu 12.04 静态ip的设置方法
- Ubuntu 12.04 静态ip的设置方法
- Ubuntu 12.04 静态ip的设置方法
- Ubuntu 12.04 静态ip的设置方法
- Ubuntu 静态ip的设置方法
- Ubuntu静态ip的设置方法
- ubuntu 14.04设置了静态IP不能上网的解决方法
- ubuntu设置静态ip的方法
- ubuntu设置静态IP的方法
- Ubuntu设置静态IP后无网络连接的解决方法
- Ubuntu 12.04和centos 7 ip的设置方法
- Ubuntu Server 12.04(14.04)配置静态IP的方法
- Ubuntu设置静态IP的方法
- ubuntu mac地址修改和静态ip设置方法
- 解决vmware下装的ubuntu右上角显示网络禁用以及设置静态IP的方法