Home > OS >  2020314 [share] dutt centos7 how to configure a static IP it took me 1 clock configuration static IP
2020314 [share] dutt centos7 how to configure a static IP it took me 1 clock configuration static IP

Time:09-17




Paragraph
CentOS7 minimized after installation is not the ifconfig command, can't use ifconfig network adapter configuration information, you must use the IP command to see


The default card ens33 no ipv4 and ipv6, also does not have an IP address, the current system can't get to the Internet, lo card will have in every system, this is called a loopback card


/root @ localhost ~ # IP addr

Use the ping command ping 127.0.0.1


/root @ localhost ~ # ping 127.0.0.1

CentOS7 network adapter configuration file stored in the


The/etc/sysconfig/network - scripts/

In different distributions, nic device file name is different, in centos7 card for ens33


Use vi command editor ens33 network adapter configuration file


/root @ localhost ~ # vi/etc/sysconfig/network - scripts/ifcfg - ens33

Press the keyboard "I" button to enter edit mode, and then press the direction key to adjust the cursor to the need to change the location of the modified


Major changes the following three points:


1, set the nic bootstrap protocol to "static"


BOOTPROTO=static

2, set the nic startup mode for startup


ONBOOT=yes

3, set the IP address, mask, gateway, DNS, because each person's network environment is different, according to their own actual situation to fill in, DNS2 can be filled can not fill in


IPADDR=192.168.186.20
NETMASK=255.255.255.0
GATEWAY=192.168.186.1
DNS1=8.8.8.8

Set up after the completion of the final details as follows, # # followed by comments


TYPE=# Ethernet network card TYPE: for the Ethernet
PROXY_METHOD=none # agent: closed
BROWSER_ONLY=no # just browser: no
BOOTPROTO=# static network boot protocol: static/manual configuration
DEFROUTE=yes # default route: yes, I don't understand to baidu keyword ` default routing `
IPV4_FAILURE_FATAL=no # is not open IPV4 fatal error detection: no
IPV6INIT=yes # IPV6 is automatically initialized: is
IPV6_AUTOCONF=yes # IPV6 is automatic configuration: is
IPV6_DEFROUTE=yes # IPV6 whether can be as the default route: is
IPV6_FAILURE_FATAL=no # is not open IPV6 fatal error detection: no
IPV6_ADDR_GEN_MODE=stable - privacy # IPV6 address generation model: stable - privacy
NAME=ens33 # network card physical device NAME: ens33
UUID=f47bde51 - f79 fa78-4 - b68f - d5dd90cfc698 # general identification number, only one number one cannot repeat
DEVICE=# ens33 nic DEVICE NAME, must be the same as ` NAME ` value
ONBOOT=yes # is powered up:
IPADDR=192.168.186.20 # IP address
NETMASK=# child mask 255.255.255.0
GATEWAY=# 192.168.186.1 GATEWAY
DNS1=# 8.8.8.8 DNS
DNS2=8.8.4.4

Change is completed, press the ESC key to exit the edit mode, the input ": wq!" Press enter to save and exit


/root @ localhost ~ # : wq!

Use systemct command to restart the network card service


/root @ localhost ~ # systemctl restart network

At this time also need to install network toolbox


/root @ localhost ~ # yum install.net - tools - y

To this point, already have basic network function, this machine can use SSH through remote access the


Like https://www.youtube.com/channel/UC2Mc5RTdmpkjmLq18TvDj7A/featured? centos students pay attention to my channel Disable_polymer=1


The telegraph group: https://t.me/joinchat/MHhPlQ6hnVCqVq3J1sYi0g


  • Related