查看系统
查看ip
进入网卡配置的目录
bash
[root@178-119-30-16 ~]# cd /etc/sysconfig/network-scripts/
[root@178-119-30-16 network-scripts]# ls
ifcfg-ens192 ifdown ifdown-ippp ifdown-post ifdown-sit ifdown-tunnel ifup-bnep ifup-ipv6 ifup-plusb ifup-routes ifup-TeamPort init.ipv6-global
ifcfg-ens192.bak ifdown-bnep ifdown-ipv6 ifdown-ppp ifdown-Team ifup ifup-eth ifup-isdn ifup-post ifup-sit ifup-tunnel network-functions
ifcfg-lo ifdown-eth ifdown-isdn ifdown-routes ifdown-TeamPort ifup-aliases ifup-ippp ifup-plip ifup-ppp ifup-Team ifup-wireless network-functions-ipv6
修改对应网卡的配置文件
ifcfg-enss192:if:interface 接口 、cfg:config 配置 、ens192 是具体的接口的名字。
ifcfg-lo:环回接口的配置 lookback
一个网卡对应一个配置文件。
bash
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="none"
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="ens192"
UUID="f21fcac4-19df-46a6-890a-a75e4a42763c"
DEVICE="ens192"
ONBOOT="yes"
IPADDR="178.119.30.16"
PREFIX="24"
GATEWAY="178.119.30.1"
DNS1="114.114.114.114"
IPV6_PRIVACY="no"
重新启动服务,让新的配置生效
bash
[root@178-119-30-16 network-scripts]# service network restart
Restarting network (via systemctl): [ OK ]