Ubuntu Server 12.04(14.04) 静态IP简洁配置
2014-10-13 10:32
465 查看
PS:经笔者测试,在ubuntu server14.04 下此方法依然可行。
1、配置静态IP地址:
# vim /etc/network/interfaces
原内容有如下4行:
以上表示默认使用DHCP分配IP,修改为如下:
# The primary network interface
auto eth0
#iface eth0 inet dhcp
保存退出。
注意:只需要设置address(IP地址)、netmask(子网掩码)、gateway(网关)这三项就OK,network和broadcast这两项参数是可以不写的。
2、手动设置DNS服务器:
# vim /etc/resolv.conf
添加如下内容(这点所有Linux发行版都通用):
nameserver 192.168.80.2
nameserver 8.8.8.8
保存退出。
注意:重启Ubuntu后发现又不能上网了,问题出在/etc/resolv.conf。重启后,此文件配置的dns又被自动修改为默认值。所以需要永久性修改DNS。方法如下:
# vim /etc/resolvconf/resolv.conf.d/base
nameserver 192.168.80.2
nameserver 8.8.8.8
3、重启networking服务使其生效:
# /etc/init.d/networking restart
这样网络配置就永久生效。
1、配置静态IP地址:
# vim /etc/network/interfaces
原内容有如下4行:
auto lo iface lo inet loopback
auto eth0 iface eth0 inet dhcp
以上表示默认使用DHCP分配IP,修改为如下:
auto lo iface lo inet loopback
# The primary network interface
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static address 192.168.80.129 netmask 255.255.255.0 gateway 192.168.80.2
保存退出。
注意:只需要设置address(IP地址)、netmask(子网掩码)、gateway(网关)这三项就OK,network和broadcast这两项参数是可以不写的。
2、手动设置DNS服务器:
# vim /etc/resolv.conf
添加如下内容(这点所有Linux发行版都通用):
nameserver 192.168.80.2
nameserver 8.8.8.8
保存退出。
注意:重启Ubuntu后发现又不能上网了,问题出在/etc/resolv.conf。重启后,此文件配置的dns又被自动修改为默认值。所以需要永久性修改DNS。方法如下:
# vim /etc/resolvconf/resolv.conf.d/base
nameserver 192.168.80.2
nameserver 8.8.8.8
3、重启networking服务使其生效:
# /etc/init.d/networking restart
这样网络配置就永久生效。
相关文章推荐
- Ubuntu Server 12.04 静态IP简洁配置
- Ubuntu Server 12.04静态IP简洁配置
- Ubuntu Server 12.04 静态IP简洁配置
- Ubuntu Server 12.04 静态IP简洁配置
- 【转】Ubuntu Server 12.04 静态IP简洁配置
- Ubuntu Server 12.04 静态IP简洁配置
- Ubuntu Server 12.04(14.04)配置静态IP的方法
- Ubuntu Server 12.04 静态IP简洁配置
- (总结)Ubuntu Server 12.04 静态IP简洁配置
- (总结)Ubuntu Server 12.04 静态IP简洁配置
- Ubuntu Server 12.04 静态IP简洁配置
- Ubuntu Server 12.04 静态IP简洁配置
- Ubuntu Server 12.04 静态IP简洁配置
- Ubuntu 14.04 server配置使用无线连接静态设置IP
- 01-ubuntu14.04静态ip配置
- Ubuntu静态IP简洁配置
- ubuntu 14.04 server 静态IP设置
- ubuntu14.04配置静态ip
- ubuntu server配置静态ip
- VirtualBox ubuntu server 16.04配置静态IP