All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thilo Schulz <arny@ats.s.bawue.de>
To: lartc@vger.kernel.org
Subject: [LARTC] Fwmark problem - policy routing does not work.
Date: Tue, 23 Apr 2002 17:23:58 +0000	[thread overview]
Message-ID: <marc-lartc-101958268206904@msgid-missing> (raw)

Well, I'm stating my problem from the beginning:
I have a computer in my LAN with 2 ips (192.168.1.10 and 192.168.1.11), the 
latter one created by "ip addr add" and users on that computer, and depending 
on the uid of the created packets i want those to take another source address.
Of course, it should start with marking the packets with a simple iptables 
rule:

iptables  -t mangle  -A OUTPUT  -m owner --uid-owner 1001 -j MARK --set-mark 1

so, next step should be, to create a new table, so i entered this into 
/etc/iproute2/rt_tables:
1       thilo

so that table 1 should have the identifier "thilo".

Next step is, to enter a rule for this table:
ip rule add fwmark 1 table thilo

and indeed:
router:/etc/init.d# ip rule ls
0:      from all lookup local
32765:  from all fwmark        1 lookup thilo
32766:  from all lookup main
32767:  from all lookup default
router:/etc/init.d#

now, i should only have to enter the route into the table:
ip route add 192.168.1.0/24 dev eth0 src 192.168.1.11 proto kernel

a final "ip route flush cash", and this should be it.
As soon, as i log in as user "thilo" (uid 1001), and i for example connect 
per ssh to 192.168.1.4 (another computer in my lan), it _should_ show me 
logged in from 192.168.1.11, but instead it still shows:
thilo    pts/8        Apr 23 18:37 (192.168.1.10).

The table as well as the route entry are correct, i am sure of this, for i 
have tested removing the fwmark rule and instead added:
ip rule add to 192.168.1.4 table thilo
everything worked then as i have intended, and it showed me logged in from 
192.168.1.11 then.

So it might be, that the Marks are not being set, i checked that too, i 
replaced the 
iptables  -t mangle  -A OUTPUT  -m owner --uid-owner 1001 -j MARK --set-mark 1
with
iptables  -t mangle  -A OUTPUT  -p tcp --dport 22 -j MARK --set-mark 1
- still no success. So I tried placing this rule into the PREROUTING chain 
(for testing though, INPUT should be absolutely correct), and - oh wonder - 
no success either ;)

Another problems checked too: I have enabled MARK based routing in the kernel 
(policy routing, everything switched on ..)

So I only can ask you on this mailing list - anyone got an idea of what 
is/what i did wrong?

- Thilo Schulz
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

             reply	other threads:[~2002-04-23 17:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-23 17:23 Thilo Schulz [this message]
2002-04-24 11:42 ` [LARTC] Fwmark problem - policy routing does not work Thilo Schulz
2002-04-24 11:50 ` Stef Coene
2002-04-24 12:40 ` Thilo Schulz
2002-04-26 19:44 ` Adrian Chung
2002-04-26 20:01 ` Thilo Schulz
2002-04-26 20:08 ` Adrian Chung
2002-04-27  8:25 ` Arthur van Leeuwen
2002-04-27  8:51 ` Thilo Schulz
2002-04-27 10:04 ` Julian Anastasov
2002-04-27 11:40 ` Adrian Chung
2002-04-27 12:02 ` Arthur van Leeuwen

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=marc-lartc-101958268206904@msgid-missing \
    --to=arny@ats.s.bawue.de \
    --cc=lartc@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.