Requirement: Assign static IP address on enp0s3 interface:
1. Check information
[root@barman ~]# systemctl status
NetworkManager.service
[root@barman ~]# NetworkManager --print-config
[root@barman ~]# nmcli device
[root@barman ~]# nmcli connection show
[root@barman ~]# ls -l
/etc/NetworkManager/system-connections/
[root@barman ~]# ip addr show enp0s3
[root@barman ~]# cat /etc/NetworkManager/system-connections/enp0s3.nmconnection
2. Network
Configuration
[root@barman ~]# nmcli connection modify 'enp0s3' ifname enp0s3 ipv4.method manual ipv4.addresses 192.168.56.56/24 gw4 192.168.56.1 ipv4.dns 8.8.8.8
[root@barman ~]# nmcli connection down 'enp0s3'
[root@barman ~]# nmcli connection up 'enp0s3'
3. Verify configuration
[root@barman ~]# ip route show
default via 192.168.56.1 dev enp0s3 proto static metric 102
192.168.22.0/24 dev enp0s8 proto kernel scope link src 192.168.22.152 metric 101
192.168.56.0/24 dev enp0s3 proto kernel scope link src 192.168.56.56 metric 102
[root@barman ~]# cat
/etc/NetworkManager/system-connections/enp0s3.nmconnection
id=enp0s3
uuid=247f61a8-b997-3f30-88ea-688882942b52
type=ethernet
autoconnect-priority=-999
interface-name=enp0s3
timestamp=1717645810
[ipv4]
address1=192.168.56.56/24,192.168.56.1
dns=8.8.8.8;
method=manual
addr-gen-mode=eui64
method=auto