Skip to contentSkip to conversation

Imposible configuration?

DISCUSSION Christian E. López Finnberg 2 participants 2 messages May 14, 2004

lore
Share & tools
lore
#0 lore raw

Hi all, Please I need some help...

I have a server with kernel 2.6.6 (netfilter activated), LAN 192.168.0.x/24 and 15 ISDN dial-up interfaces IPPPx. The ISDN interfaces are configured to be dial-on-demand and they connect to 15 different win98 machines.

My nightmare started when I realized that windows 98 RAS server always assigns the same IPs (192.168.55.1 to the Server and 192.168.55.2 to the client). I want to automaticaly connect to any of this machines (so the source connection is in my own LAN).I assigned in my LAN a "virtual" IP to each remote PC (192.168.2.1, 192.168.3.1, ... and so on) and create the apropiate routes to it:

My ISDN interfaces looks like this:
ippp0 Link encap:Point-to-Point Protocol

          inet addr:192.168.55.2  P-t-P:192.168.55.1  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1
          collisions:0 txqueuelen:30
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

And My routes are this way:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.1     0.0.0.0         255.255.255.255 UH    0      0        0 ippp0
192.168.3.1     0.0.0.0         255.255.255.255 UH    0      0        0 ippp1
192.168.4.1     0.0.0.0         255.255.255.255 UH    0      0        0 ippp2
192.168.5.1     0.0.0.0         255.255.255.255 UH    0      0        0 ippp3
192.168.6.1     0.0.0.0         255.255.255.255 UH    0      0        0 ippp4

...

So the only resting step is to translate 192.168.x.1 to 192.168.55.1 in the apropiate interface (In a POSTROUTE way), but I dont
see a form to do this. :-(

It is there any way of do this with netfilter or Linux?.
I saw an old document that do something like this, but it used obsolet ipnatadm tool.

Many thanx,

Christian E. López Finnberg
Las Palmas de Gran Canaria.

#1 lore raw
Quoted 3 lines · Christian E. López Finnberg

So the only resting step is to translate 192.168.x.1 to 192.168.55.1 in the apropiate interface (In a POSTROUTE way), but I dont
see a form to do this. :-(

I see your point. You can't change destination in POSTROUTING, so your approach is not appropriate.

You should implement policy routing against Netfilter mark :

	iptables -t mangle -A PREROUTING -d 192.168.2.1 \
		-j MARK --set-mark 0
	iptables -t mangle -A PREROUTING -d 192.168.2.1 \
		-j DNAT --to 192.168.55.1

Then, set policy routing as explained in LARTC[1] using iproute2 :

echo 200 ippp0 >> /etc/iproute2/rt_tables ip rule add fwmark 0 table ippp0 ip route add default dev ippp0 table ippp0

Do the same for every route you have, or script in a loop.

[1] http://lartc.org/

Signature · 2 lines
http://www.netexit.com/~sid/
PGP KeyID: 157E98EE FingerPrint: FA62226DA9E72FA8AECAA240008B480E157E98EE
Quoted 2 lines
Quoted 2 lines

Hi! I'm your friendly neighbourhood signature virus. Copy me to your signature file and help me spread!