All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Wick <markus@selfnet.de>
To: netdev@vger.kernel.org
Subject: "ip route local ..." outside the table 255 (local)
Date: Thu, 25 Jun 2009 02:38:35 +0200	[thread overview]
Message-ID: <200906250238.40369.markus@selfnet.de> (raw)

[-- 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 --]

             reply	other threads:[~2009-06-25  0:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-25  0:38 Markus Wick [this message]
2009-06-29 16:46 ` BugReport: "ip route local ..." outside the table 255 (local) Markus Wick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200906250238.40369.markus@selfnet.de \
    --to=markus@selfnet.de \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.