Answer the question
In order to leave comments, you need to log in
How to set up routing on the server for two blocks of ip addresses?
Hello.
There is a server on Debian 7 on which the web server, telephony and so on are spinning. Previously, we bought a block for 8 ip-addresses 2.135.246.120-2.135.246.127. Over time, they began to be missed, they took another block of 32 addresses 2.135.246.192-2.135.246.223.
ifconfig
Trying to add a new interface
ifconfig eth0:2 2.135.246.194 netmask 255.255.255.224 up
ip route change 2.135.246.192/27 via 2.135.246.193 dev eth0
ip route change 2.135.246.192/27 via 2.135.246.193 dev eth0 src 2.135.246.194
Answer the question
In order to leave comments, you need to log in
You should configure ip rule and route lists to them. That is, something like this: If the packet arrives at the address from network 1, then the gateway will be 1, and if it arrives at the address from network 2, then the gateway = 2.
(man ip rule, man ip route)
Another option is BGP with your operator.
Good day!
Well, firstly, for different networks with different IPs it is better to create separate routing tables:
[[email protected] ~]$ ip rule
0: from all lookup local
32763: from 10.10.100.12 lookup gate100
32764: from 10.10.50.12 lookup gate2
32765: from all to 10.10.10.30 lookup shared_db
32766: from all lookup main
32767: from all lookup default
where each table will have its own gate:
[[email protected] ~]$ ip route show table gate2
default via 10.10.50.1 dev eth0
[[email protected] ~]$ ip r
default via 10.10.10.1 dev bond0
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question