Ubuntu16 网络静态ip配置

配置静态网络

# cat /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 enp2s0
#将原来的注释掉
#iface enp2s0 inet dhcp
#添加下面内容:
iface enp2s0 inet static
address 192.168.2.182
netmask  255.255.255.0
gateway  192.168.2.255

重启网络

service networking restart

若没有生效,则执行下面命令:

ip addr flush dev enp2s0
ifdown enp2s0
ifup enp2s0

查看

# ifconfig |more

posted @ 2020-07-01 09:58  邹姣姣  阅读(428)  评论(0编辑  收藏  举报