ubuntu 16.10 设置固定ip
 2017-02-20    未分类    机智的魔王卷子    0条评论    206次浏览  


首先我们打开网卡配置文件:

sudo vim /etc/network/interfaces

默认内容一下:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto ens33
iface ens33 inet dhcp

我们改成如下:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto ens33
iface ens33 inet static # 将dhcp改为static
address 10.0.0.101 # 静态ip
netmask 255.255.255.0 # 网关地址
network 10.0.0.1 # 子网掩码

然后重启网卡服务:

systemctl restart networking

然后我们打开DNS文件:

sudo vim /etc/resolvconf/resolv.conf.d/base

添加如下内容:

nameserver 180.76.76.76

刷新DNS配置:

sudo resolvconf -u

本文链接: ubuntu 16.10 设置固定ip, 转载请注明来源!

留言数(0
(«- 点击按钮)