Skip to main content

Configure Network Settings on CentOS 7

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 "192.168.1.74/24"  ipv4.gateway 192.168.1.254 ipv4.dns "192.168.1.2 192.168.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 192.168.1.75/24
nmcli con mod ens160 ipv4.gateway 192.168.1.254
nmcli con mod ens160 ipv4.dns "192.168.1.2 192.168.1.3"
nmcli con mod ens160 ipv4.method manual
nmcli con mod ens160 connection.autoconnect yes

Restart NetworkManager

systemctl restart NetworkManager