0
network:
 version:2 
renderer :
ethernets:
ens160:
dhcp4: no
dhcp6:
no address: 192.168.10.13/24 gateway4:192.168.10.1
nameservers:
addresses: 142.55.100.25
142.55.44.25
1

You can also use ip route add or ip r a

First add your IP to the route table ip route add 192.168.10.100 dev ens160 proto static metric 100

Then add the route via the gateway ip route add default via 192.168.10.1 dev ens160 proto static metric 100

These changes will be temporary until a reboot. To make them persist, you will need to add the changes to your NIC. On CentOS/Rhel distributions, this can be found in /etc/sysconfig/network-scripts/ifcfg-ens160

0

What's wrong with the ifconfig command? You could use ip as well.

ip addr change 192.168.1.111/32 dev eth0

You can do it via ip addr del/ip addr add as well.

2
  • Thank you instead of eth0 I should use ens160?
    – Ellie
    Jul 9 at 18:15
  • Looks like it . Jul 9 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.