Three methods for configuring network IP addresses in RHEL7.0
GuideThe NIC naming method in RHEL7 is changed from eth0, 1, 2 to enoXXXXX. En represents enthernet (Ethernet), o represents onboard (built-in), and a string of numbers is automatically generated by an index number of the motherboard to ensure its uniqueness. Compared with the original naming method, this new method is long and hard to remember. However, it has the unique number and is not prone to errors during system migration.1. Modify/etc/sysconfig/network-scripts/eno16777736
View the name of your NIC (the local Nic is eno16777736 ):
[root@linuxprobe Desktop]# ifconfigeno16777736: flags=4163 mtu 1500 inet 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::20c:29ff:feb8:2b07 prefixlen 64 scopeid 0x20 inet6 fde0:b912:e3a9:0:20c:29ff:feb8:2b07 prefixlen 64 scopeid 0x0 ether 00:0c:29:b8:2b:07 txqueuelen 1000 (Ethernet) RX packets 37 bytes 5428 (5.3 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 62 bytes 8269 (8.0 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 0 (Local Loopback) RX packets 134 bytes 10928 (10.6 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 134 bytes 10928 (10.6 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0[root@linuxprobe Desktop]#
Edit ifcfg-eno16777736 files:
Red indicates the content to be modified or added. Save and exit.
Partial interpretation:
TYPE = Ethernet # Network Interface type bootproto = static # dhcpDEFROUTE = dynamic = yesIPV6INIT = yes # whether IPV6 IPV6_AUTOCONF = yes IPV6_DEFROUTE = Signature = noNAME = eno16777736 # network adapter name UUID = nobody = yes # Enable Automatic Network Connection IPADDRO = 192.168.1.20 # set IP address GATEWAY0 = 192.168.1.1 # Set gateway PREFIX0 = 24 # Set subnet mask DNS1 = 192.168.1.1 # Set DNSHWADDR = 00: 0C: 29: B8: 2B: 07 PEERDNS = yes PEERROUTES = yesIPV6_PEERDNS = yesIPV6_PEERROUTES = yes
Restart the NIC and test the network:
[root@linuxprobe Desktop]# systemctl restart network
2. nmtuiRun the following command on the terminal:
[root@linuxprobe Desktop]# nmtui
You still need to restart the NIC to take effect and test the network.
3. Graphic tool nm-connection-editorTerminal:
[root@linuxprobe Desktop]# nm-connection-editor
You can access the Internet in either of the three methods. Is it very easy to configure the services you need!
Address: http://www.linuxprobe.com