centos (linux) manually configure ip address

View system

Insert image description here

View IP

Insert image description here

Enter the network card configuration directory

[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

Insert image description here

Modify the configuration file of the corresponding network card

ifcfg-enss192: if: interface interface, cfg:config configuration, ens192 is the name of the specific interface.

ifcfg-lo: configuration lookback of loopback interface

One network card corresponds to one configuration file.


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"

Insert image description here

Restart the service for the new configuration to take effect

[root@178-119-30-16 network-scripts]# service network restart
Restarting network (via systemctl):                        [  OK  ]

Insert image description here

Guess you like

Origin blog.csdn.net/tangsiqi130/article/details/131925626