Skip to contentSkip to conversation

ip route nat problem

LARTC Michael Harris 2 participants 2 messages Sep 22, 2004 – Sep 23, 2004

lore
Share & tools
lore
#0 lore raw

After upgrading our router from redhat 7.3 (linux 2.4.18 ) to mandrake 10.0 (linux 2.6.3) some of our routing scripts failed. This configuration worked properly before we changed distributions.

X.X.X.2 is supposed to recieve traffic for X.X.X.6 and nat that to Z.Z.Z.46

ip addr list |grep 'eth[0123]'
2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000

    inet X.X.X.2/28 brd X.X.X.15 scope global eth0
3: eth1: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    inet Z.Z.Z.7/24 brd Z.Z.Z.255 scope global eth1
4: eth2: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    inet Y.Y.Y.5/24 brd Y.Y.Y.255 scope global eth2
5: eth3: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    inet W.W.W.74/29 brd W.W.W.79 scope global eth3

My current routing table is:
W.W.W.72/29 dev eth3 scope link

X.X.X.0/28 dev eth0  scope link
Y.Y.Y.0/24 dev eth2  scope link
Z.Z.Z.0/24 dev eth1  scope link

127.0.0.0/8 dev lo scope link
default via W.W.W.73 dev eth3

When i try adding these rules:
ip route add default via X.X.X.1 dev eth0 table 200 ip route add nat X.X.X.6 via Z.Z.Z.46
ip rule add from Z.Z.Z.46 nat X.X.X.6 table 200

the second route causes this error: "RTNETLINK answers: File exists" i have also tried changing the command to "append" rather than "add" the route, but this has had no effect.

i have also tried this:
ip route add default via X.X.X.1 dev eth0 table 200
ip route append nat X.X.X.6 via Z.Z.Z.46 table 201
ip rule add to X.X.X.6 table 201
ip rule add from Z.Z.Z.46 nat X.X.X.6 table 200
That seems to work at first, however "ip route get 209.167.89.6" returns the following error: RTNETLINK answers: Invalid argument

Any help would be greatly appreciated

Signature · 5 lines
Sincerely,
Michael Harris
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#1 lore raw
Quoted 17 lines · Michael Harris

When i try adding these rules:
ip route add default via X.X.X.1 dev eth0 table 200 ip route add nat X.X.X.6 via Z.Z.Z.46
ip rule add from Z.Z.Z.46 nat X.X.X.6 table 200

the second route causes this error: "RTNETLINK answers: File exists" i have also tried changing the command to "append" rather than "add" the route, but this has had no effect.

i have also tried this:
ip route add default via X.X.X.1 dev eth0 table 200
ip route append nat X.X.X.6 via Z.Z.Z.46 table 201
ip rule add to X.X.X.6 table 201
ip rule add from Z.Z.Z.46 nat X.X.X.6 table 200
That seems to work at first, however "ip route get 209.167.89.6" returns the following error: RTNETLINK answers: Invalid argument

Quoted 3 lines

Any help would be greatly appreciated

IP_ROUTE_NAT is broken on 2.6 and was removed in 2.6.9-rc1, you should switch to netfilter NAT. Apparently there is also a stateless NAT target floating around somewhere, although I've never seen it.

Regards
Patrick
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/