nmcli device show
#then:
nmcli connection add con-name VNAT type thernet ifname ens160
# or
nmcli connection add con-name VNAT type ethernet \
ipv4.method manual ipv4.addresses 19.168.2.4/24 \
ipv4.gateway 192.168.2.2 ipv4.dns 8.8.8.8
# enable autoconnect
nmcli con mod VNAT connection.autoconnect yes
If required, you can down and up the connection:
nmcli the old way:
In old releases, ifconfig creates scripts and adds to network-scripts folder, this is deprecated but it is worth to know for debugging purposes:
You can add then start the connection by:
ip
Set down interface ens160 (if necessary):
Delete ipv4 address and routing from device ens160:
Set device up, because either is will not work:
Set new ipv4 address and route:
Task 2:
Create new network connection with existing interface (enp1s0) using provided values:
IPv4: 172.25.X.10/255.255.255.0 (where X is your domain number: Domain 15)
Gateway: 172.25.X.2
DNS server: 172.25.X.2
Add the following secondary IP addresses statically to your current running connection. Do this is a way that does not compromise your existing settings:
IPv4: 10.0.0.5/24 and set the hostname node1.domain15.example.com
sudo nmcli con reload # or command below
sudo systemctl restart NetworkManager
nmcli con down vnat2
nmcli con up vnat2
ip link set down dev ens160
ip addr del 192.168.2.4/24 dev ens160
ip route del default via 192.168.2.2
ip link set up dev ens160
ip addr add 192.168.2.5/24 dev ens160
ip route add default via 192.168.2.2 dev ens160
nmcli con add con-name primary-connection ifname enp1s0 type ethernet ip4 172.25.15.10/24 gw4 172.25.15.2
nmcli con mod primary-connection ipv4.dns 172.25.15.2
nmcli con up primary-connection
nmcli con mod primary-connection +ipv4.addresses 10.0.0.5/24
nmcli con up primary-connection
ip addr show enp1s0
sudo hostnamectl set-hostname node1.domain15.example.com
# making hostname settings permanent:
echo "node1.domain15.example.com" | sudo tee /etc/hostname
# verify changes:
hostnamectl