ubuntu 16.04下静态IP地址的设置

一、编辑配置文件

sudo vi  /etc/network/interface 
内容如下:  
# 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
#------修改或添加如下内容------ 
iface ens33 inet static
  
address 10.0.0.129
netmask 255.255.255.0
gateway 10.0.0.2

 二、重启网络

sudo /etc/init.d/networking restart
或
systemctl restart networking.service

至此 ip地址就变成静态IP地址了。

posted @ 2019-08-16 12:01  Chris_huang  阅读(91)  评论(0)    收藏  举报
返回项部