CentOS7 network configuration: Static IP and DHCP

1. open and edit the network configuration file: / etc / sysconfig / network-scripts / ifcfg-ens33

[root @ localhost Network-scripts] # vim the ifcfg-ens33
the TYPE = Ethernet NIC # configure Internet
PROXY_METHOD = none
BROWSER_ONLY = NO
BOOTPROTO = # Set static IP address acquisition mode, the default is DHCP, static setting to static as
DEFROUTE = yes
IPADDR = 192.168.10.2
NETMARSK = 255.255.255.0
the NETWORK = 192.168.10.0
GATEWAY = 192.168.10.254
DNS1 = 114.114.114.114 # configure DNS resolution

ONBOOT = no # turn on automatically restart card
IPV4_FAILURE_FATAL = NO
IPV6INIT = yes
IPV6_AUTOCONF = yes
IPV6_DEFROUTE = yes
IPV6_FAILURE_FATAL = NO
IPV6_ADDR_GEN_MODE = Privacy stable-
NAME = ens33 # Configure the card name

DEVICE = ens33 # NIC hardware name
UUID = d24e50a3-27c3-4410-a2b2-1d5a0c985435
IPV6_PRIVACY = NO

2. Restart card

systemctl  restart  network

 

Guess you like

Origin www.cnblogs.com/python-wen/p/11262270.html
Recommended