Re[2]: simple dual Internet connection setup not sending return packets on correct interface

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



BJM> Which is irrelevant.  I have just put a third NIC in the machine to put
BJM> the PPPoE and Cable connections on different NICs and still the same
BJM> problem.  Packets have PPPoE's source address, but are sent physically
BJM> on Cable connected NIC.

iirc, to have two working internet connections on one (nat'ing)
computer you basically need two things (in my example its eth0 and
eth1)

1) SNAT to the right source address, like
iptables -A POSTROUTING -j nat -t SNAT [-s from.where or -d to.where]\
         --to-source source.addr.of.eth0
iptables -A POSTROUTING -j nat -t SNAT [-s from.where or -d to.where]\
         --to-source source.addr.of.eth1

2) two routing tables, like
 ip route add default via eth0.gateway.ip.address dev eth0 table 1
 ip route add default via eth1.gateway.ip.address dev eth1 table 2
maybe you dont even need the "via xx" thing, the dev xxx is enough.

then you can classify packets to use the connection you want using
 ip rule add WHATEVER lookup N (whatever could be "to x.x.x.x" or "from
 x.x.x.x", same as in the SNAT example, N could be 1 or 2)

if you want the router to respond to packets correcty (ie. to answer
ping on both interfaces) you need to
 ip rule add iif eth0 lookup 1
 ip rule add iif eth1 lookup 2
so packets coming from eth0/eth1 are routed using the correct routing
table.

i wrote all this from scratch so accept my apologies for any errors i
might have done but in my understanding this is how it should work in
general.

-
diab








_______________________________________________
LARTC mailing list / LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux