CentOS 7.0 network configuration

After the enterprise-level Linux distribution CentOS is installed, the network connection service is not enabled by default, and the network service can be used after manually starting it. After the latest version of CentOS 7.0 is installed, the network configuration file is in the /etc/sysconfig/network-scripts/ directory. After entering the directory, find the network configuration file under it: ifcfg-enp0s3 (the specific file name will vary depending on the hardware, in accordance with ifcfg- en* format is fine), the default content of the configuration file is as follows:

12345678910111213141516 HWADDR=00:1C:22:AD:74:43TYPE=EthernetBOOTPROTO=dhcpDEFROUTE=yesPEERDNS=yesPEERROUTES=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_PEERDNS=yesIPV6_PEERROUTES=yesIPV6_FAILURE_FATAL=noNAME=enp0s3UUID=ae0718e7-25s9-43ra-8hp9-9d4g20a88ib1ONBOOT=no

Modify the last item ONBOOT=no to ONBOOT=yes to start the network service, save and exit.

Use the following command to restart the network service:

1 service network restart

At this time, the network service has been turned on and can be used normally. The ifconfig command is usually used to view the network connection information. You may find that the newly installed CentOS 7.0 does not support the ifconfig command and will prompt "ifconfig command not found". At this time, you need to install an additional network toolkit to solve the problem. The command is as follows:

12 # yum upgrade#yum install net-tools

After the installation is complete, you can use the ifconfig command to view information such as the ip address.

You can also use the ip addr command to view network card information

If you are setting static ip, you need to modify the following files

IP related parameters: /etc/sysconfig/network-scripts/ifcfg-eth0
DNS : /etc/resolv.conf

ifcfg-eth0:

TYPE=Ethernet

NETWORK (the first ip of the network segment), BROADCAST (the broadcast address can be omitted)

DNS:

nameserver 180.76.76.76
nameserver 202.96.134.13

I encountered this problem when I helped my colleague install a virtual machine with vbox today

device eth0 does not seem to present.

Trouble phenomenon:

service network restart
Shutting down loopback insterface:                                                                                                     [  OK  ]
Bringing up loopback insterface:                                                                                                          [  OK  ]
Bringing up interface eth0:  Device eth0 does not seem to be present,delaying initialization.                    [FAILED]

Solution:

First, open the content of /etc/udev/rules.d/70-persistent-net.rules as shown in the following example:

vi /etc/udev/rules.d/70-persistent-net.rules

This file was automatically generated by the /lib/udev/write_net_rules

program, run by the persistent-net-generator.rules rules file.

You can modify it, as long as you keep each rule on a single

line, and change only the value of the NAME= key.

PCI device 0x1022:0x2000 (pcnet32)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?", ATTR{address}=="00:0c:29:8f:89:9
7", ATTR{type}=="1", KERNEL=="eth
", NAME="eth0"

PCI device 0x1022:0x2000 (pcnet32)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?", ATTR{address}=="00:0c:29:50:bd:1
7", ATTR{type}=="1", KERNEL=="eth
", NAME="eth1"

Record the mac address of the eth1 network card 00:0c:29:50:bd:17

Next, open /etc/sysconfig/network-scripts/ifcfg-eth0

vi /etc/sysconfig/network-scripts/ifcfg-eth0

Change DEVICE="eth0" to DEVICE="eth1",
Change HWADDR="00:0c:29:8f:89:97" to the above mac address HWADDR="00:0c:29:50:bd:17"

Finally, restart the network

service network restart

or

/etc/init.d/network restart

normal now.

Recommended Posts

CentOS7.0 network configuration
CentOS 7.0 network configuration
Implementation of CentOS8.0 Network Configuration
CentOS8 network card configuration file
CentOS6.5 network settings
CentOS7 basic configuration
Detailed examples of Centos6 network configuration
Centos MySQL8 configuration
Linux Network Foundation (CentOS7)
Xfs configuration on centos7
Centos kernel compilation configuration
Ubuntu 18.04 network card configuration
Network configuration under Ubuntu
Mysql8.0.15 installation configuration (centos7)
CentOS 7 network settings --- connectivity
Centos7.6 dual network card configuration and switching test
Centos mysql installation and configuration
CentOS 8 (2)
Centos7.4 deployment configuration Elasticsearch5.6 cluster
Centos7 installation and configuration prometheus
CentOS 7 installation and configuration PPTP
Centos6.5 desktop version network settings
CentOS installation and configuration cmake
CentOS 7 user account configuration original
Centos7.5 installation and configuration MongoDB4.0.4
CentOS 7 installation and configuration PPTP
CentOS mysql configuration master-slave replication
CentOS 8 (1)
CentOS 7 Redis 5.0.8 sentinel mode configuration
Tencent cloud centos 8.0 single network card configuration multiple IP
Centos network settings in virtualbox
CentOS 8 install Git and basic configuration
Centos7 hadoop cluster installation and configuration
CentOS configuration git server in VirtualBox
CentOS7 modify the network card name
CentOS7.2 and Nginx configuration virtual host
Java-JDK installation and configuration under CentOS
CentOS 7 Tomcat service installation and configuration
Centos 7 RAID 5 detailed explanation and configuration
Centos7 change the network card name
CentOS configuration swap exchange area method
CentOS NTP server installation and configuration
Centos7 mysql database installation and configuration
CentOS6/CentOS7 dual network card configuration bonding
Tomcat configuration JMX in centos 6.5 environment
CentOS 7 system installation and configuration graphic tutorial
centos7 cannot connect to the external network
centos7 python3.7+vi
Tomcat installation and configuration under CentOS 7 (Tomcat startup)
MySQL 8.0 installation, deployment and configuration under CentOS 6/7
Centos7.5 configuration java environment installation tomcat explanation
CentOS7 modify network card name and network repair
Five minutes to learn centos configuration gitlab
Installation and configuration of redis under centos7
CentOS + Python3.6+
CentOS + Jenkins
Centos7 hive stand-alone mode installation and configuration
1.5 Install Centos7
Encountered network configuration traps during centos-ubuntu intercommunication
Ubuntu 18.04 LTS configuration network tutorial through Netplan
2019-07-09 CentOS7 installation