Skip to contentSkip to conversation

redirect ROUTE

DISCUSSION Joel 1 participant 1 message May 21, 2003

lore
Share & tools
lore

Joel

author
#0 lore raw

Hi,

My situation is:
A:
LINK with ip 200.x.x.x
and
internal ip: 192.168.1.254
B:
ADSL router with ip 192.168.200.1
and
internal ip: 192.168.1.8
router default: 192.168.200.254

I need redirect port 80 to 192.168.1.8.
I am making NAT:
bimap xl0 192.168.1.8/32 -> 200.x.x.x/32

My problem is that the route default is not for A. With router default to A its OK.

Then I tried this :

# iptables -A PREROUTING -i eth0 -t mangle -p tcp --dport 80 -j MARK 
--set-mark 1
our
# iptables -A POSTROUTING -o eth0 -t mangle -p tcp --sport 80 -j MARK 
--set-mark 1
our
# iptables -A POSTROUTING -p tcp -t mangle -s 192.168.1.8 --sport 80 -j ROUTE 
--gw 192.168.1.254

nothing work with out router default to A.

# cat /etc/iproute2/rt_tables
#
# reserved values
#
255     local
254     main
253     default
0       unspec
#
# local
#
#1      inr.ruhep
201 www.out
---------------------------------------------------------
[root@joel /root]# ip route list table www.out
default via 192.168.1.254 dev eth0
--------------------------------------------------------
[root@joel /root]# /sbin/ip route add default via 192.168.1.254 dev eth0 table 
wwwl.out
-----------------------------------------------------
# ip rule ls
0:      from all lookup local
32765:  from all fwmark        1 lookup www.out
32766:  from all lookup main
32767:  from all lookup default

------------------------------------------------------

Thanks,

Joel