CentOS7.1 Nic settings
Today, I installed CentOS7.1, and found that it was very different from that before 6. The command changed a lot and the network configuration was not as good as that.
Next I will introduce the NIC configuration in 7, including the problems I encountered.
After the VM is installed
Run ifconfig
You will find that the NIC information has changed.
# Ifconfig
Eno16777736: flags = 4163 <UP, BROADCAST, RUNNING, MULTICAST> mtu 1500
Inet 192.168.66.104 netmask 255.255.255.0 broadcast 192.168.66.255
Inet6 fe80: 20c: 29ff: fe8f: 994b prefixlen 64 scopeid 0x20 <link>
Ether 00: 0c: 29: 8f: 99: 4b txqueuelen 1000 (Ethernet)
RX packets 94480 bytes 139993185 (133.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 38775 bytes 2602634 (2.4 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
The original eth0/eh1 has become the current enoxxxxxxx (I really want to vomit blood after reading it)
First, go to/etc/sysconfig/network-scripts, find the configuration file of ifcfg-enoxxxxxx Nic, and modify it to the following format.
HWADDR = 00: 0c: 29: 8f: 99: 4b // Nic MAC address
TYPE = Ethernet
BOOTPROTO = static // dhcp is used by default, and static indicates static IP.
DEFROUTE = yes
PEERDNS = yes
PEERROUTES = yes
20174_failure_fatal = yes
NAME = eno16777736 // Nic NAME
UUID = 94271989-6217-457d-a88f-40fb635af64c // UUID. Do not change it if you are fine. Otherwise, you will regret it ..
# DEVICE = eno16777736
ONBOOT = yes // automatically start upon startup
IPADDR = 192.168.66.2 // ip address
NETNASK = 255.255.255.0 // Subnet Mask
GATEWAY = 192.168.66.1 // GATEWAY
DNS1 = 8.8.8.8 // DNS
# DEVICE = eth0
After modifying the configuration file, run the following command to confirm the NIC information you have set.
Use the nmtui text tool to modify the network configuration (RHEL7/CentOS7 is installed by default, which can be used only when NetworkManager. service is enabled)
# Nmtui-edit enoxxxxxxx
Connect and the connection will be OK when the connection is successful.
# Nmtui-connect enoxxxxxxxx
During this period, the friends did not know if they would have encountered the problem of having no HWADDR parameter in the NIC configuration file, which is what we call the MAC address. Anyway, I encountered it and had trouble me for ten minutes. Finally, I solved it.
This is the problem.
[Root @ localhost ~] # Systemctl restart network
Job for network. service failed. See 'systemctl status network. service' and 'journalctl-xn 'for details.
This error occurs because the MAC address parameters in your configuration file are different from those in ifconfig. The solution is:
# Ifconfig
Eno16777736: flags = 4163 <UP, BROADCAST, RUNNING, MULTICAST> mtu 1500
Inet 192.168.66.104 netmask 255.255.255.0 broadcast 192.168.66.255
Inet6 fe80: 20c: 29ff: fe8f: 994b prefixlen 64 scopeid 0x20 <link>
Ether00: 0c: 29: 8f: 99: 4 btxqueuelen 1000 (Ethernet)
RX packets 94480 bytes 139993185 (133.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 38775 bytes 2602634 (2.4 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Write the ipv4 MAC address printed above to the NIC configuration file, and then restart it to avoid this problem. Of course, IPV6 also says
Modify host name:
Vi/etc/hostname
Save and log on again
# Hostname
Control