Solved How to add persistent static route across reboot?

Status
Not open for further replies.

TECH198

New User
Joined
Dec 13, 2021
Messages
23
Reaction score
3
Running 3CX (Debian), helping out someone adding static route..

However i've added add route to /etc/networtk/iterfaces under Debian 10, but also, for various unknown reasons i'm not sure understanding yet, you must also add route manually as well to command line.... Not sure the reason this manual route add line is needed as well (unless its just to check currently). but then stoping network services init.d then rebooting and listing routing table: route or route /rn the static route is gone.



route -p (Windows equivalent) or some other persistent would be helpful.

Specially targeting Debian 10, nor any other version, as syntax is different.
 
Hi @TECH198,

Just chiming in, if the above suggestion doesn't work: This is more of a Debian question which may be better to post on a Debian forum, I'd suggest not making any changes to anything that would affect the 3CX default setup.
 
Edit /etc/network/interfaces file and add your permanent routes.

Example:

auto ens192
allow-hotplug ens192
iface ens192 inet static
address 192.168.221.54/24
gateway 192.168.221.1
dns-nameservers 82.99.137.41 212.158.133.41
up ip route add 192.168.0.0/24 via 192.168.221.1 dev ens192
up ip route add 192.168.1.0/24 via 192.168.221.1 dev ens192

Last step is restart network:

~] /etc/init.d/networking restart
# or
~] systemctl restart networking
 
  • Love
Reactions: thaposto
Neither worked.
 
It works, you are doing something wrong.
 
  • Like
Reactions: NickD_3CX
your right, i was doing something wrong..solved... The problem was i needed to have two gateways.

Both NICs, (one of them with static route), cannot go out primary gateway as well.
 
  • Like
Reactions: NickD_3CX
Glad you got it figured out.

Marking as 'Solved'.
 
Status
Not open for further replies.

Members Online Now

Forum statistics

Threads
111,832
Messages
589,282
Members
164,662
Latest member
DejanMDS