netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* "ip route local ..." outside the table 255 (local)
@ 2009-06-25  0:38 Markus Wick
  2009-06-29 16:46 ` BugReport: " Markus Wick
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Wick @ 2009-06-25  0:38 UTC (permalink / raw)
  To: netdev

[-- Attachment #1: Type: text/plain, Size: 1864 bytes --]

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()

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* BugReport: "ip route local ..." outside the table 255 (local)
  2009-06-25  0:38 "ip route local ..." outside the table 255 (local) Markus Wick
@ 2009-06-29 16:46 ` Markus Wick
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Wick @ 2009-06-29 16:46 UTC (permalink / raw)
  To: netdev

[-- Attachment #1: Type: Text/Plain, Size: 541 bytes --]

Hello

Has anybody tried it? I think it is a bug but I don't know where.
Perhaps the mistake is in the routing decision (or in the userspace 
application). iptables trace shows the packages in the filter/input table.
Perhaps socket lookout?

Please can somebody try the following example and confirm it:

sudo ip route add local 192.168.56.0/24 dev eth0 table local
ping 192.168.56.1
## *succeed*

sudo ip route add local 192.168.57.0/24 dev eth0 table main
ping 192.168.57.1
## connect: Invalid argument

Thanks

Markus

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-06-29 16:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-25  0:38 "ip route local ..." outside the table 255 (local) Markus Wick
2009-06-29 16:46 ` BugReport: " Markus Wick

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).