RHCSA - Part2 - Configure network interface
OS = CentOS 7.0
IP address: 192.168.2.20/24
gateway: 192.168.2.200 (you can also choose a public DNS server such as google 8.8.8.8)
Note: Network configurations can also be edited in /etc/sysconfig/network-scripts
, but requires nmcli con reload
command to update the modifications to NetworkManager.
Display network configurations with nmcli:
# nmcli c s
If nmcli c s
doesn’t display any connection and you don’t know the name of the available interfaces, use ip l
.
Create the new connection:
# nmcli con add type ethernet ifname eth0 con-name eth0
# nmcli con mod eth0 ipv4.addresses "192.168.2.100/24 192.168.2.1" \
ipv4.dns 192.168.2.200 \
ipv4.method manual \
connection.autoconnect yes
# nmcli con up eth0
Note: Other usefull options are:
- ipv4.dns-search example.local
- connection.zone dmz
Test the new connection:
# ping -I eth0 192.168.2.200