CentOS 7: Configure Networking

Setting up a new network connection

Show connections

nmcli con show

Remove an existing connection

nmcli con delete <connection name>

Show device status

nmcli device status

Add a network connection

nmcli connection add type ethernet autoconnect yes ifname ens160 con-name eth0 ipv4.method manual ipv4.addr "10.101.1.74/24" ipv4.gateway 10.101.1.254 ipv4.dns "10.101.1.2 10.101.1.3"

Attach interface into a network connection

nmcli connection modify eno16777984 connection.interface-name ens160

Restart NetworkManager

systemctl restart NetworkManager

Make changes to an existing connection

Configure static IP address on ens160 network adapter

nmcli con mod ens160 ipv4.addresses 10.101.1.75/24
nmcli con mod ens160 ipv4.gateway 10.101.1.254
nmcli con mod ens160 ipv4.dns "10.101.1.2 10.101.1.3"
nmcli con mod ens160 ipv4.method manual
nmcli con mod ens160 connection.autoconnect yes

Restart NetworkManager

systemctl restart NetworkManager

‚Äč