一、centos
1.查看网段
ifconfig
2.修改
vi /etc/sysconfig/network-scripts/ifcfg-enp3s0
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static # 修改
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp3s0
UUID=b132adcc-ec05-4a6e-bb35-4ed2a956300a
DEVICE=enp3s0
ONBOOT=yes
IPADDR=192.168.xx.xx # 新增
GATEWAY=192.168.xx.1 # 新增
NETMASK=255.255.255.0 # 新增
重启网络:
service network restart
或
systemctl restart network