Let’s see the networking concepts, in RHEL 7 or CENTOS7.
You should concentrate on these if servers upgrade:
- We usually edit the network configuration file in the older versions to manage IPs.
- under /etc/sysconfig/network-scripts/
- In the new version no more editing is required. We can add, modify, delete the IPs using the tool called NMCLI (Network Manager Command Line Interface)
- You can find the existing ethernet connections by using the following command
#nmcli connection show
Example :- The result will be
NAME | UUID TYPE | DEVICE |
ens3 | 71697b55-cf9d-42c6-ba4d-bb0c01ae34d9 | 802-3-ethernet — |
You can configure a ethernet connection for Ip4.
#nmcli connection add con-name “static” ifname ens3 type ethernet autoconnect no ip4 172.25.25.25/24 gw4 172.25.254.254
Note:-If you do not want to autoconnect, then you have to manually add “autoconnect no” or else it is not required.
The result will be:-
NAME | UUID TYPE | DEVICE |
static | 6002793c-ad58-424e-a40d-36f647a5bcc6 802-ens3 | 3-ethernet |
ens3 | 71697b55-cf9d-42c6-ba4d-bb0c01ae34d9 802- | 3-ethernet — |
To add additional IP to the connection static, we no need to edit it.
#nmcli connection mod “static” +ipv4.addresses 172.25.32.28
- Above will add the IP to the existing static connection.
- To bring up the connection
#nmcli connection up static
- To add a DNS you can also use the following command to the existing connection.
#nmcli connection modify “static” ipv4.dns 8.8.8.8
- Note : Note that this will replace any previously set DNS servers.
- To add an additional DNS, simply add +
#nmcli connection modify “static” +ipv4.dns 4.4.4.4
- Above will not replace the DNS instead it appends.
Here is a related post you maybe interested in: Network Installation on Linux using NFS
To get more updates follow us on Facebook, Twitter, LinkedIn