Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

https://devconnected.com/how-to-add-route-on-linux/#Using_etcnetworkinterfaces



Centos

create a "route" file:

vi /etc/sysconfig/network-scripts/route-eno16777736

default via 192.168.26.2



[root@centos7 network-scripts]# systemctl restart network.service

[root@centos7 network-scripts]# ip route

default via 192.168.26.2 dev eno16777736

169.254.0.0/16 dev eno16777736  scope link  metric 1002

192.168.26.0/24 dev eno16777736  proto kernel  scope link  src 192.168.26.11

Ubuntu

/etc/network/interfaces


root@boxed:~# ip r
default via 192.168.0.1 dev wlan0
172.32.0.0/16 via 192.168.116.1 dev eth0
192.168.0.0/24 dev wlan0 proto kernel scope link src 192.168.0.146
. . . 
to be ch3eck firstup route add -net 172.32.0.0 netmask 255.255.0.0 gw 192.168.116.1