[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <200906250238.40369.markus@selfnet.de>
Date: Thu, 25 Jun 2009 02:38:35 +0200
From: Markus Wick <markus@...fnet.de>
To: netdev@...r.kernel.org
Subject: "ip route local ..." outside the table 255 (local)
Hello
Is it possible to make a route of type local outside the local table?
I want to make a redirect without changing the destination ip address.
I was able to create this routes without any error messages, but no package
arrived at my socket.
Is this a bug or an undokumented feature?
I dont know where to search for the bug, but I write an example for reproduce.
Thanks
Markus
## This is a small script listening on 0.0.0.0:2525
## It sends back the src and dst ip and port
python repeat.py &
## try to connect, but there is no route to this network
## my computer has the 10.0.11.43, you have to change this
nc -s 10.0.11.43 192.168.34.56 2525
#> (UNKNOWN) [192.168.34.56] 2525 (?) : No route to host
## redirect everything to this network to the local machine
## and it works :-)
ip route add local 192.168.0.0/16 dev eth0 table local
nc -s 10.0.11.43 192.168.34.56 2525
#> SRC IP: 192.168.0.1
#> SRC Port: 43468
#> DST IP: 192.168.34.56
#> DST Port: 2525
## now the same in a new table
## delete the old route, create a new rule and add ower route
## but this time it is not working and I dont know why
ip route del 192.168.0.0/16 table local
ip rule add table 1 pref 1
ip route add local 192.168.0.0/16 dev eth0 table 1
nc -w 10 -s 10.0.11.43 192.168.34.56 2525
#> (UNKNOWN) [192.168.34.56] 2525 (?) : Connection timed out
## clean up everyting ;-)
ip route del 192.168.0.0/16 table 1
ip rule del pref 1
kill %
repeat.py:
#!/usr/bin/python
from socket import socket
serv = socket()
serv.bind(('',2525))
serv.listen(1)
while True:
(s,client) = serv.accept()
s.send('SRC IP: ' + str(client[0]) + '\n')
s.send('SRC Port: ' + str(client[1]) + '\n')
s.send('DST IP: ' + str(s.getsockname()[0]) + '\n')
s.send('DST Port: ' + str(s.getsockname()[1]) + '\n')
s.close()
Download attachment "signature.asc " of type "application/pgp-signature" (836 bytes)
Powered by blists - more mailing lists