Article 561QC Two gateways on two different subnets on the same interface

Two gateways on two different subnets on the same interface

by
robel
from LinuxQuestions.org on (#561QC)
I am about to switch from my current ISP to a new ISP. I have some servers and routers in my network and want to keep the network up and running while switching ISP. Of course, I must change the IP addresses of all my servers and routers. Luckily all of them are running Linux. :-)

Now, the new ISP has installed a new router and I have set up a new router to the new ISP. Everything with the new ISP is working and I am ready to go.

I would like to give each Linux box an additional IP-address and my question is how to do it the correct way". Each box will have two different IP addresses on the same interface. In that way I can change my DNS-server and I don't have to wait for DNS propagation.
My first attempt was simply add an address to eth0:0 with source routing, but that failed.

Code:eth0 x.y.z.1/24 default via zx.y.z.254
eth0:0 a.b.c.1/24 default via a.b.c.254

echo 200 NewISP" >> /etc/iproute2/rt_tables
ip rule add from a.b.c.1 table NewISP
ip route add default via a.b.c.254 table NewISPI have no idea why this didn't work. What did work was using macvlan:

Code:ip link add mac0 link eth0 address <MAC address> type macvlanWith the same source routing it worked, but is this the best solution?latest?d=yIl2AUoC8zA latest?i=lZIi5DxiYdI:uVuvLaRyqCo:F7zBnMy latest?i=lZIi5DxiYdI:uVuvLaRyqCo:V_sGLiP latest?d=qj6IDK7rITs latest?i=lZIi5DxiYdI:uVuvLaRyqCo:gIN9vFwlZIi5DxiYdI
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments