Multiple default gateways.

Ken D'Ambrosio ken at jots.org
Wed Apr 26 09:21:22 EDT 2017


Hey, all.  This is something I've tried (and failed) to get working for 
time out of mind.  Recently, I'd come to need it yet again -- this time 
in virtualland: I needed multiple NICs on the same VM able to respond to 
external queries, often off the same subnet.  And I needed them 
responding via the NIC the query came in on.  We'd been making this 
"work" by setting up lots of static host routes and stuff, but it still 
felt as hokey as it had in years past.  Then someone on a BBS I'm on 
pasted this link:
https://kindlund.wordpress.com/2007/11/19/configuring-multiple-default-routes-in-linux/

I'd fooled around with policy based routing -- even bought a book! -- 
but it just never "clicked," and none of the examples I saw online (as, 
indeed, the page also proclaims) showed exactly how to do what I wanted 
to do.  But now I have a VM with queries being responded to by the NIC 
the query comes in on.  The stock default gateway still works for 
internally originated packets, but inbound packets are now "bound" to 
the NIC they come in on.

And there was great rejoicing.  (I just won $10 from myself that I've 
had hanging on my cube wall for two years.)

Anyway... yeah.  I'm happy.  Thought others might find it useful, too.

-Ken


More information about the gnhlug-discuss mailing list