Skip to contentSkip to conversation

MASQUERADE for 2 Internet connections

DISCUSSION Rimas 3 participants 3 messages Sep 9, 2002

lore
Share & tools
lore

Rimas

author
#0 lore raw

Hi folks,

I have configured NAT for 1 Inet connection :
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE - working solution

I use 10.105.105.x internal IP addresing

Now I have a second one Inet connection (eth2).

How to make MASQUERADE like this:
1st Inet - MASQUERADE for 10.105.105.100-105
2nd Inet - MASQUERADE for 10.105.105.xx for all except 100-105

Basicly to use the same IP addresing for both Inet connections

Thanks in advance

Rimas

#1 lore raw
Quoted 5 lines · Rimas

Hi folks,

I have configured NAT for 1 Inet connection :
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE - working solution

Quoted 7 lines

I use 10.105.105.x internal IP addresing

Now I have a second one Inet connection (eth2).

How to make MASQUERADE like this:
1st Inet - MASQUERADE for 10.105.105.100-105
2nd Inet - MASQUERADE for 10.105.105.xx for all except 100-105

MASQUERADING is not your problem. All you need to do is have two rules:

iptables -A POSTROUTING -t nat -o eth0 -j MASQUERADE iptables -A POSTROUTING -t nat -o eth2 -j MASQUERADE

That will masquerade all packets going out of the two external interfaces.

The tricky bit is to get your routing to direct packets from 10.105.105.100-105 via eth0 and to direct packets from the rest of 10.105.105.0/24 via eth2.

To do this you need to investigate iproute2
http://defiant.coinet.com/iproute2

It's not difficult - but it's not netfilter.

Antony.

Signature · 3 lines
If you want to be happy for an hour, get drunk.
If you want to be happy for a year, get married.
If you want to be happy for a lifetime, get a garden.
#2 lore raw
In reply to Rimas

Why you don't maquerade the hole net?

iptables -A POSTROUTING -t nat -s 10.105.105.0/24 -d 0.0.0.0/0.0.0.0 -o eth0 -j MASQUERADE

----- Original Message -----
From: Rimas
To: [email protected]
Sent: Monday, September 09, 2002 2:56 PM
Subject: MASQUERADE for 2 Internet connections

Hi folks,

I have configured NAT for 1 Inet connection :
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE - working solution

I use 10.105.105.x internal IP addresing

Now I have a second one Inet connection (eth2).

How to make MASQUERADE like this:
1st Inet - MASQUERADE for 10.105.105.100-105
2nd Inet - MASQUERADE for 10.105.105.xx for all except 100-105

Basicly to use the same IP addresing for both Inet connections

Thanks in advance

Rimas