上次装了一个Ubuntu14.04 server服务器,由于IP没有进行设置(默认为自动分配IP),重启后,IP经常自动变化,所以后面进行了静态IP的设置,才能使得服务器IP地址固定
下面讲讲静态IP设置的大体步骤(这里ip默认网关为192.168.13.1):
一、通过如下命令查看IP的设置情况
1、静态IP配置:vim /etc/network/interfaces默认显示如下(dhcp分配):
#The loopback network interface
auto lo
iface lo inet loopback
#The Primary network interface
auto p2p1
iface p2p1 inet dhcp改为固定静态ip:
#The loopback network interface
auto lo
iface lo inet loopback
#The Primary network interface
auto p2p1
#iface p2p1 inet dhcp
iface p2p1 inet static
address 192.168.13.110 //ip地址
netmask 255.255.255.0 //子网掩码
network 192.168.13.0
broadcast 192.168.13.255
gateway 192.168.13.1 //网关
dns-nameservers 192.168.13.12、手动设置DNS服务器:vim /etc/resolv.conf注释掉之前的nameserver
末尾加上
nameserver 192.168.13.13、重启network server
/etc/init.d/networking restart注:如果需要永久性更改DNS,则需要修改如下文件
vim /etc/resolvconf/resolv.conf.d/base
本文介绍如何在Ubuntu 14.04 Server上设置静态IP地址,包括修改网络接口配置文件、手动设置DNS服务器及重启网络服务等步骤。
178

被折叠的 条评论
为什么被折叠?



