RE: [LARTC] multiple gateway problem

Linux Advanced Routing and Traffic Control

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

 



First off, here's a diagram:


               I N T E R N E T
               /              \
   -------------             -------------
   | 10.4.44.1 |             | 10.4.44.2 |
   |  lucent   |             |   speed   |
   -------------             -------------
    port-fw 80                 port-fw 80
              \               /
               \             /
                \           /
                 -----------
                 |   hub   |
                 -----------
                      |
                      |
                      |
                      |
                     eth0
                --------------
                | 10.4.44.11 |
                |   linux    |
                --------------

I have a default gateway as specified in /etc/sysconfig/network:
	GATEWAYDEV=eth0
	GATEWAY=10.4.44.1

I ran the below commands to use multiple default gateways.

So here's what I would _like_ to see:
	Traffic coming to the box from the internal network uses the default route
from /etc/sysconfig/network.
	Traffic coming from the internet (from the 10.4.44.1 router, then
port-forwarded 10.4.44.11) should use 10.4.44.1 as the gateway to return the
packets to the client.
	10.4.44.2 should work identically to 10.4.44.1.

Right now, traffic coming from the system default gateway works great.
Traffic coming from 10.4.44.2 gets to the system, however I would guess that
it's being sent back to 10.4.44.1 as it is the default gateway.

As I'm watching a tcpdump, I see that packets are coming in with their
original (external) IP addresses, instead of the address of the router (I
was thinking that port forwarding temporarily changed the source IP of the
packet; apparently not).  So the setup is not working because external IPs
don't match 10.4.44.1 or 10.4.44.2, and the system's default gateway is
used.

So, I guess my question becomes: is there any way for linux to tell which
router the packet came from?  Could it tell maybe by mac address?

Thanks for the help!
Ross


-----Original Message-----
From: Whit Blauvelt [mailto:whit@xxxxxxxxxxxxx]
Sent: Tuesday, December 04, 2001 9:54 AM
To: Ross Simpson
Cc: lartc@xxxxxxxxxxxxxxx
Subject: Re: [LARTC] multiple gateway problem


Ross,

I'm new to this stuff myself, but do you have any default routes set up for
packets that are neither from 10.4.44.1 or 10.4.44.2? Are you testing from
inside or outside? In my own trials what you list below will allow outside
connections through either line, but inside-to-outside stuff isn't caught by
either rule and depends on general defaults.

I'm unclear though on just when a packet generated on the router takes on
which IP as its identity (for instance, when it presents with the
'localhost' IP). It does seem that when a request comes in on a certain
external IP that IP is preserved in the packets of a responding daemon, if
the daemon's on the router, so rules like yours apply to it.

Obviously I should spend an afternoon with a packet sniffer testing this
stuff out - I haven't run across a full explanation of it yet.

Whit

On Mon, Dec 03, 2001 at 11:15:42AM -0800, Ross Simpson wrote:

> echo 199 lucent >> /etc/iproute2/rt_tables (router #1)
> echo 200 speed >> /etc/iproute2/rt_tables (router #2)
> ip rule add from 10.4.44.1 table lucent
> ip rule add from 10.4.44.2 table speed
>
> ip rule ls:
> 0:      from all lookup local
> 32764:  from 10.4.44.2 lookup speed
> 32765:  from 10.4.44.1 lookup lucent
> 32766:  from all lookup main
> 32767:  from all lookup 253
>
> ip route add default via 10.4.44.1 dev eth0 table speed
> ip route add default via 10.4.44.2 dev eth0 table lucent
> ip route flush cache
>
> I can access forwarded ports on the external ip of the 'lucent' router,
but
> forwarded ports on the 'speed' router are not answering.
> I've verified that port forwarding on the speed router works.




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