How to set a static IP address in RHEL8
# get the current connection name
[root@localhost ~]# nmcli con show
NAME UUID TYPE DEVICE
ens160 6b0e7866-7d4f-4668-afbf-a485f9a1e6db ethernet ens160
# Note the NAME of the connection
# To see what IP, gateway and DNS you are currently using do
[root@localhost ~]# nmcli con show ens160 | grep ipv4
ipv4.method: auto
ipv4.dns: 8.8.4.4
ipv4.addresses: 192.168.0.33/32
ipv4.gateway: 192.168.0.1
# If that doesn’t show the information you need, try this command instead:
[root@localhost ~]# nmcli con show ens160 | grep IP4
IP4.ADDRESS[1]:
IP4.GATEWAY[1]:
IP4.DNS[1]:
IP4.DNS[2]:
# set a static IP of 192.168.0.33
[root@localhost ~]# nmcli con mod ens160 ipv4.address 192.168.0.33 ipv4.gateway 192.168.0.1 ipv4.dns 8.8.4.4 ipv4.method manual
# apply new settings to device
[root@localhost ~]# nmcli dev reapply ens160
NOTE : Your connection name, IP address, gateway and DNS information will probably be different to the above, so change it where necessary.
Leave a Reply