ip route permanent
https://devconnected.com/how-to-add-route-on-linux/#Using_etcnetworkinterfaces
Centos | |
---|---|
create a "route" file: |
|
[root@centos7 network-scripts]# systemctl restart network.service | |
| |
Ubuntu | |
create this file | /etc/network/interfaces |
static ip address | static ip@ and static route auto eth0 iface eth0 inet static address 10.0.2.2 netmask 255.255.255.0 up route add -net 10.0.3.0 netmask 255.255.0.0 gw 10.0.2.1 |
dynamic ip address | dynamic IP@ and static route auto eth0 iface eth0 inet dhcp up route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.0.10.4 |
show routes | 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 first | ip route add -net 172.32.0.0 netmask 255.255.0.0 gw 192.168.116.1 |