0

At work we have two WAN access. I wish to install an Ubuntu server/router that shares these two WAN to our internal LAN.

I have prepared a box with three interfaces (eth0, eth1 and eth3):

  • eth0 will be used for the first WAN IP address, for example 172.16.1.19/29
  • eth1 will be used for the second WAN IP address, for example 172.16.4.107/29
  • eth3 will be the internal LAN, let's say 192.168.1.1/24

The current config is simple (/etc/network/interface)

....
iface eth0 inet static
    address 172.16.4.107
    netmask 255.255.255.248 
    gateway 172.16.4.106
    dns-nameservers 8.8.8.8

iface eth1 inet static
    address 172.16.1.19
    netmask 255.255.255.248 
    gateway 172.16.1.18
    dns-nameservers 8.8.8.8

.....

Will that kind of configuration share the two WAN, or will it randomly use one of them?

Is there a way to merge these two WAN to be considered as only one with a better bandwidth? If so, then how can we configure that?

Greenonline
  • 2,182

3 Answers3

2

Will that kind of configuration share the two WAN, or will it randomly use one of them?

The Linux kernel will only use one default gateway.

Is there a way to merge these two WAN to be considered as only one with a better bandwidth? If so, then how can we configure that?

unless you add a load-balancing route:

ip route add default scope global nexthop via 172.16.4.106 dev eth0 weight 1 nexthop via 172.16.1.18 dev eth1 weight 1

**note: weight (1/1) tells the kernel to evenly distribute the connections between the gateways

Then do this to enable forwarding:

echo 1 > /proc/sys/net/ipv4/ip_forward

source (try using this. it works pretty well on my setup)

storm
  • 5,013
0

As far a I know this can be implemented by setting some static routes. I had to configure an environment like this once, with access to 3 different networks:

  • Network 1: Internet access 15.186.51.0/27
  • Network 2: Laboratory access 10.24.10.0/24
  • Network 3: Wireless LAN 16.186.51.0/27

I had to specify what traffic should go to network2 and what to network3, and all of the rest to network1. So, if you think this could work for you, have a look at Howto add permanent static routes in Ubuntu.

This could be not what you need since every host in your network will requiere to modify the corresponding configuration if apply, and also in Windows it is less adaptable.

0

Take a look here which will lead you to here. Take also a look at here.