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

A routing, source routing and masquerading with 3 networks



Hello!

I need to masquerade a network only if the destination is some network and
the source is one of the net

In Debian frozen (to be released as potato) the configuration is this

/etc/network/interfaces
-----------------------
iface eth0 inet static
        address a.b.c.d
        network a.b.c.128
        netmask 255.255.255.252
        gateway a.b.c.129

iface eth1 inet static
     address net1a.net1b.net1c.129
     network net1a.net1b.net1c.128
     netmask 255.255.255.128

iface eth1:0 inet static
     address net2a.net2b.net2c.3
     network net2a.net2b.net2c.0
     netmask 255.255.255.128
     up ip route add net1a.net1b.net1c.128/25 dev eth1 table 2
     #default gateway for net2
     up ip route add 0.0.0.0/0 via net2a.net2b.net2c.1 table 2
     # now the rule to make net2 use routing table 2.
     up ip rule add from net2a.net2b.net2c.0/25 lookup 2
------------------------------------------

The net2 has a special condition that all packets that goes to a net3/24
must be masqueraded as if it goes from eth0 instead of going via
net2a.net2b.net2c.1(eth1:0)

The problem is that 
 ipchains -A forward -j MASQ  -s net2a.net2b.net2c/25 -d net3/24

does not do nothing. All packets are routed as the table says, so it does
not masquerade.

Kernel: 2.2.14

Can you giveme a clue how to solve that?

-- 
Bye
    Carlos Barros.


Reply to: