T
T
Talyan2019-09-01 17:43:04
linux
Talyan, 2019-09-01 17:43:04

How do I teach Debian to use my routes?

I have a car. It has routes:

[email protected]:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default          gw.srv             0.0.0.0         UG    0      0        0 eth0
10.0.1.0            *               255.255.255.0   U     0      0        0 vlan567
10.100.0.0          *               255.255.0.0     U     0      0        0 vlan2567
192.168.1.0         *               255.255.255.0   U     0      0        0 eth0

Now the server can fully access the Internet only through vlan2567 through which I DO NOT have access to the server from the network 172.17.17.0/24 (VPN).
I have access to the server only through eth0. That is, what needs to be done? Correctly. Replace the default route with dev vlan2567 and put the route at 172.17.17.0/24 through eth0, which I do myself.
Decision:
route del default
route add default gw 10.100.0.1 dev vlan2567
route add -net 172.17.17.0 netmask 255.255.255.0 gw [адрес шлюза в 192.168.1.0/24] dev eth0

Everyone is happy! The server can go to the Internet, I can go to the server.
But. How can I fix this in debian so that I don't write routes all the time.
If I put it in rc.local, then it is unlikely to help, because interfaces like VLAN2567 do not rise immediately, they will turn to DHCP until they wait for permission from billing - time will pass, and service networking will make the routes as it sees fit.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Michurin, 2019-09-01
@flapflapjack

More or less like this

V
vlarkanov, 2019-09-03
@vlarkanov

write commands for adding routes to /etc/network/interfaces after describing the desired interface like this:

allow-hotplug eth0
iface eth0 inet static
address 172.20.xx
netmask 255.255.255.0
up ip route add 172.20.70.0/24 via 172.20.71.y dev eth0
up ip route add ...
The key word here is up - i.e. commands will be executed when the interface is brought up.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question