Answer the question
In order to leave comments, you need to log in
Routes are cleared after debian reboot
The problem is that there is a large routing table and it gets erased after interface/OS reboot
root @yellow :/# cat /etc/issue
Debian GNU/Linux 5.0 \n \l
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default black.yupshara. 0.0.0.0 UG 0 0 0 eth0
default black.yupshara. 0.0.0.0 UG 0 0 0 eth1
and a bunch of others
root @yellow :/# cat /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.99.4
netmask 255.255.255.0
gateway 192.168.99.3
post-up ip route add 192.168.99.0/24 dev eth0 src 192.168.99.4 table eth0
post-up ip route add default via 192.168.99.3 dev eth0 table eth0
post-up ip rule add from 192.168.99.4 table eth0
post-up ip rule add from all to 192.168.99.4 table eth0
post-up ip route flush cache
post-down ip route flush table eth0
pre-down ip rule del from 192.168.99.4 table eth0
pre-down ip rule del from all to 192.168.99.4 table eth0
mtu 1500
auto eth1
iface eth1 inet dhcp
pre-down /usr/local/netplug.d/use_source_rule_delete eth1
pre-up ifconfig eth1 mtu 1500 can you
tell me how to fix permanent deletion?
Answer the question
In order to leave comments, you need to log in
You can try a little crutch, in /etc/network/interfaces for the interface we need, in addition to its basic settings, register the script execution:
iface eth0 inet static
address 192.168.99.4
netmask 255.255.255.0
gateway 192.168.99.3
up /bin/bash /root/route
#!/bin/bash
ip route add 192.168.99.0/24 dev eth0 src 192.168.99.4 table eth0
ip route add default via 192.168.99.3 dev eth0 table eth0
ip rule add from 192.168.99.4 table eth0
ip rule add from all to 192.168.99.4 table eth0
ip route flush cache
...
I've done it like this:
#/etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
dns-nameservers 127.0.0.1
up route add -net 192.168.250.0/27 gw 192.168.1.2
up route add -net 192.168.250.32/27 gw 192.168.1.4
up route add -net 192.168.100.0/24 gw 192.168.1.2
up route add -net 192.168.96.0/24 gw 192.168.1.3
Use the directory intended for autostarting scripts
More details man interfaces or here
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question