Networking Forums

Networking Forums > Computer Networking > Linux Networking > Routing with iproute2 and ipchains - src address wont translate

Reply
Thread Tools Display Modes

Routing with iproute2 and ipchains - src address wont translate

 
 
Dan Temple
Guest
Posts: n/a

 
      12-23-2003, 01:57 PM
Hi,

I'm trying to get my server to route from/to a specific local machine to an
ADSL router using ipchains forwarding and ip route. The new ADSL router
Is connected to my Linux box on a second Ethernet card eth1.

Object of exercise - to enable a specific local PC to talk to the ADSL
Router as though it was directly connected, by selecting the PCs preferred
gateway to be the Linux box.

The two subnets are 10.242.22.0/24:

ADSL router: 10.242.22.161
server eth1: 10.242.22.162

...and 172.18.12.0/24:

server eth0: 172.18.12.2
localpc : 172.18.12.3
mygateway: 172.18.12.254 <- this is the one I normally use for Internet access
and is the default gateway of the Linux box.

First, the ipchains.

# ipchains -A forward -i eth1 --source 172.18.12.3 -j MASQ --log
# ipchains -A forward -j DENY --log
# echo 1 > /proc/sys/net/ipv4/ip_forward

And the routing:

# ip rule add from 172.18.12.3 nat 10.242.22.162 table officepc
# ip route add 10.242.22.0/24 dev eth1 src 10.242.22.162 table officepc
# ip route add default via 10.242.22.161 table officepc

But the source address does not appear to get translated:

# ip route get 53.205.22.69 from 172.18.12.3 iif eth0
53.205.22.69 from 172.18.12.3 via 10.242.22.161 dev eth1 src 172.18.12.2
cache <masq,src-direct> mtu 1500 advmss 1460 iif eth0

A sample ipchains log line:
Dec 22 20:50:44 server kernel: Packet log: forward DENY eth0 \
PROTO=1 172.18.12.3:8 53.205.22.69:0 L=60 S=0x00 I=47713 F=0x0000 T=127 (#2)

The packets are being sent out with the un-translated address 172.18.12.2.
I've checked that it works if I set my default gateway to the ADSL router - then
I can happily ping the router from the local pc.

I'm using a stock RedHat 2.4.18-3 kernel and the .config
file appears to have all the right features enabled.

Any help gratefully received...

/Dan

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Translate bytes in IP address Netzer Windows Networking 1 06-02-2007 04:31 AM
iproute2 & routing table disappears Oleksandr Samoylyk Linux Networking 1 05-14-2006 05:44 AM
iproute2 source routing Sven Boeckelmann Linux Networking 0 10-31-2005 01:50 PM
iproute2 source routing to remote host Sven Boeckelmann Linux Networking 0 10-31-2005 01:46 PM
iproute2 source routing Sven Boeckelmann Linux Networking 0 10-30-2005 01:11 PM



1 2 3 4 5 6 7 8 9 10 11