Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Multiple gateways, one NIC?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
The_Great_Sephiroth
Veteran
Veteran


Joined: 03 Oct 2014
Posts: 1394
Location: Fayetteville, NC, USA

PostPosted: Thu Feb 18, 2016 7:19 pm    Post subject: Multiple gateways, one NIC? Reply with quote

I have a client with two separate Internet connections. I have DHCP setup to offer two gateways, but how do I do this on Linux systems? One NIC, two gateways. I assume one will be default and the other not default, but how do I do this? I have one Debian system and two Gentoo systems that need this setup.
_________________
Ever picture systemd as what runs "The Borg"?
Back to top
View user's profile Send private message
szatox
Veteran
Veteran


Joined: 27 Aug 2013
Posts: 1762

PostPosted: Thu Feb 18, 2016 8:17 pm    Post subject: Reply with quote

What is the purpose of those 2 connections (And 2 gateways) on a single NIC?
It is possible to set both as default, but it would result in changing the active connection every few seconds and the resulting link would be very unstable.
However, if you add metric, you can have a failover. You could also try some sort of IP based load balancing, configuring routes to different zones/IP pools via separate gateways.

Also, how did you set the DHCP? Don't they compete to get the client?
Back to top
View user's profile Send private message
gordonb3
Apprentice
Apprentice


Joined: 01 Jul 2015
Posts: 185

PostPosted: Fri Feb 19, 2016 9:23 am    Post subject: Reply with quote

Use option 121 (classless static routes) to set both static and default routes. Option 3 (default route) is ignored by linux dhcp client. Problem is that option 121 does not allow setting a metric value to prioritize gateways, but your dhcp client may in fact add this based on the order in which these are given. The only way to know is to try.

To set up some kind of load balance you can divide traffic between the two gateways by using a netmask of 128 (i.e 0.0.0.0/128 and 128.0.0.0/128) and add the redundancy in the gateways themselves.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6754
Location: Blighty

PostPosted: Fri Feb 19, 2016 5:07 pm    Post subject: Reply with quote

This kind of decision is best made at a router.

Take a 3 port router for example (such as the EdgeRouter LITE which I use at home)

* Port 1 - LAN
* Port 2 - ISP1
* Port 3 - ISP2

Configre DHCP to set the default route on clients to an IP on the LAN interface.
Then which ISP is chosen by the router and the client's blissfully don't care.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum