Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

Configuring two internet connections

Writer Matthew Harrington

First, I'm know there's lots of topics about this kind of problem but I can't found a solution to my specific problem.

In my setup I have a Linux server with three interfaces:

ethLAN for LAN with IP 192.168.10.3/24

ethOI for WAN Oi Internet Provider with IP 10.1.1.3/24 GW 10.1.1.1

ethGTC for WAN GTC Internet Provider with IP 10.4.1.3/24 GW 10.4.1.1

In principle my setup should be simple: all internet access from the server and lan clients should be routed by ethOI. The ethGTC was used only to incoming traffic for specific services.

My /etc/network/interfaces looks like:

auto ethLAN
iface ethLAN inet static
address 192.168.10.3
netmask 255.255.255.0
network 192.168.10.0
broadcast 192.168.10.255
auto ethOI
iface ethOI inet static
address 10.1.1.3
netmask 255.255.255.0
network 10.1.1.0
broadcast 10.1.1.255
gateway 10.1.1.1
dns-nameservers 192.168.10.1 8.8.8.8 8.8.4.4
dns-search hsi.local
auto ethGTC
iface ethGTC inet dhcp

And this is my route -n:

0.0.0.0 10.1.1.1 0.0.0.0 UG 0 0 0 ethOI
10.1.1.0 0.0.0.0 255.255.255.0 U 0 0 0 ethOI
10.4.1.0 0.0.0.0 255.255.255.0 U 0 0 0 ethGTC
192.168.10.0 0.0.0.0 255.255.255.0 U 0 0 0 ethLAN

However I couldn't make this work properly.

ping 192.168.10.x works but ping machine-name or ping machine-name.hsi.local doesn't.

But If I down the ethGTC all works fine.

1

1 Answer

By default, you can only have one default gateway on a system.

With iproute2, you have the ability to setup an additional routing table, for one thing, and allow this table to be used by the system based on rules, for another thing.

Test this:

First, install iproute2

sudo su
apt-get install iproute2

Second, configure static interfaces

sudo su
nano /etc/network/interfaces
auto ethLAN
iface ethLAN inet static
address 192.168.10.3
netmask 255.255.255.0
network 192.168.10.0
broadcast 192.168.10.255
auto ethOI
iface ethOI inet static
address 10.1.1.3
netmask 255.255.255.0
network 10.1.1.0
broadcast 10.1.1.255
gateway 10.1.1.1
dns-nameservers 192.168.10.1 8.8.8.8 8.8.4.4
dns-search hsi.local
auto ethGTC
iface ethGTC inet static
address 10.4.1.3
netmask 255.255.255.0
network 10.4.1.0
broadcast 10.4.1.255
gateway 10.4.1.1

Finally, configure the news routing tables

sudo su
echo 200 adsl1 >> /etc/iproute2/rt_tables
echo 201 adsl2 >> /etc/iproute2/rt_tables
ip route add 10.1.1.0/24 dev ethOI src 10.1.1.3 table adsl1
ip route add default via 10.1.1.1 table adsl1
ip route add 10.4.1.0/24 dev ethGTC src 10.4.1.3 table adsl2
ip route add default via 10.4.1.1 table adsl2
ip route add 10.1.1.0/24 dev ethOI src 10.1.1.3
ip route add 10.4.1.0/24 dev ethGTC src 10.4.1.3
ip rule add from 10.1.1.3 table adsl1
ip rule add from 10.4.1.3 table adsl2
ip route add default scope global nexthop via 10.1.1.3 dev ethOI weight 1 nexthop via 10.4.1.3 dev ethGTC weight 2
0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy