Masq/Sharing 2 Internet connections

From: AcCeSsDeNiEd (dillon_at_SpamMinuSaccessdenied.darktech.org)
Date: 08/14/04


Date: Sat, 14 Aug 2004 18:30:20 +0800

I'm pulling my hair out getting this one to work.

So anyone out there plz help.

I have this setup:

                                                                 ________
                                          +------------+ /
                                          | | |
                            +-------------+ Provider 1 +-------
        __ | | | /
    ___/ \_ eth0 +------+-------+ +------------+ |
  _/ \__ -----| eth2 | /
 / | | |
| Local network + Linux router | | Internet
 \_ eth1 | | |
   \__ __/ -----| ppp0 | \
      \___/ +------+-------+ +------------+ |
                            | | | \
                            +-------------+ Provider 2 +-------
                                          | | |
                                          +------------+ \________

eth0 and eth1 are connected to my Local area network:

eth0=10.30.1.0
eth1=10.20.0.0

eth2 is connected to the internet via a lease line.
ppp0 is connected to an ADSL provider:

eth2=161.18.195.4
ppp0=220.255.206.242

I need the users on eth0 to access the internet via eth2 and
          the users at eth1 should access the internet via ppp0

I read the Linux Advance networking at: http://www.lartc.org/howto/lartc.rpdb.multiple-links.html
And this is what I did:

Added tables 'IPQ_eth2' and 'ADSL' in /etc/iproute2/rt_tables

eth2:
#/sbin/ip route add 161.18.195.0 dev eth2 src 161.18.195.4 table IPQ_eth2
#/sbin/ip route add default via 161.18.195.1 table IPQ_eth2
#/sbin/ip route add 161.18.195.0 dev eth2 src 61.8.195.4
#/sbin/ip rule add from 161.18.195.4 table IPQ_eth2

ppp0:
#/sbin/ip route add 220.255.206.0 dev ppp0 src 220.255.206.242 table ADSL
#/sbin/ip route add default via 220.255.206.1 table ADSL
#/sbin/ip route add 220.255.206.0 dev ppp0 src 220.255.206.242
#/sbin/ip rule add from 220.255.206.242 table ADSL

Ok, from here on, packets coming into the Internet connections get out/back via their own respective
gateways. That works.

Next to share the internet connections:
In my IPTABLES:

#Enable NAT routing from eth2
$IPT -t nat -A POSTROUTING -o eth2 -s 10.30.1.0/24 -j MASQUERADE

#Enable NAT routing from ppp0 (ADSL)
$IPT -t nat -A POSTROUTING -o ppp0 -s 10.20.0.0/22 -j MASQUERADE

This is where the problem is. Only the ppp0 sharing works with the eth1 users.
That is, if I don't set a default gateway on the linux box.
Setting a default gateway (161.18.195.1) in ifcfg-eth2 has reverse results.
I can only get either one sharing to work but not both.

What am I missing?
Thanks a million.

To e-mail, remove the obvious



Relevant Pages

  • Re: Branch Office MVBASE network access
    ... Each factory has a 256k ADSL line into BT IP Clear and then back to head ... Each of the factories just has a Cisco 1700 and an 8 or 16 port hub! ... serving serial connections to some equally ... These routers connect over 56k WAN links to our MVBASE server. ...
    (comp.databases.pick)
  • Re: Booting PC disconnects ADSL Modem
    ... connections and that all wires are known properly constructed (a ... Now what happens to the ADSL ... The diagnostics have one even better feature - the last ... confirm the suspect computer's safety ground ...
    (microsoft.public.windowsxp.general)
  • Re: Old TCP connections after IP address change
    ... Plug PC into adsl modem and hope for the best ... iptables: NAT: MASQUERADE vs SNAT, ... # connections will survive a reconnect. ...
    (comp.os.linux.networking)
  • Re: Would you expect this device to support ADSL directly?
    ... > Reading the description at the bottom, would you expect it to support ADSL ... A customer review which complains that it 'doesn't support ADSL' says "It only ... has RJ-45 for Ethernet connections so it's fine for NTL cable.". ... manufacturer web sites. ...
    (uk.comp.homebuilt)
  • Re: Winroute and multiple internet connections
    ... > I'm trying to set up and use two internet connections ... I use Winroute Pro to share a cable and ADSL connection with my LAN. ... When setting up 2 Internet connections, remember to force one of them to be ...
    (comp.security.firewalls)