routing based on user id

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all!

I've got 2 (soon 3) internet connection. 1 - via ADSL, 2(and3) via ppp
My network:
http://desima.objectis.net/network-diag

linux1:
user1.user2
eth0=192.168.1.1
ppp0=192.168.5.2( gw 192.168.5.1)
gw=192.168.1.2 ( thru ADSL)
compA=192.168.1.6
compB=192.168.1.15
gw2=192.168.1.217  via ppp to different ISP


All works for compA and CompB, 
user1 should use default gw(192.168.1.2)
user2 should use ppp0

For user2 it will work only if I change his route thru gw2(not ppp0):

iptables -A OUTPUT -t mangle -m owner --uid-owner 1006 -j MARK --set-mark=0x1
ip rule add fwmark 0x01 table gw2
ip route add default via 192.168.1.217 table gw2
ip route flush cache

But If I change his route via ppp0 (table T2)  all traffic stop for him
but will work ok for users CompA and B (using SNAT)
iptables -t nat -A POSTROUTING -o ppp0 -j SNAT --to-source 192.168.7.2

According to tcpdump packets going:
192.168.5.2>200.200.200.200 
and back 192.168.5.2<200.200.200.200
but for some reason not reaching user2

How I can enable routing thru ppp0 for user2?
(I will need it lateer for user3 using ppp1)

Any help greatly appreciated

Configs:
ip rule ls:
0: from all lookup local
32750: from all fwmark 0x1 lookup T2
32751: from 192.168.5.2 lookup T2
32752: from 192.168.5.1 lookup T2
32756: from 192.168.1.6 lookup T1
32757: from 192.168.1.15 lookup T2
32766: from all lookup main
32767: from all lookup default

ip route table T2
192.168.5.0 dev ppp0 scope link src 192.168.5.2
192.168.1.0/24 dev eth0 scope link
127.0.0.0/8 dev lo scope link
default via 192.168.5.1 dev ppp0

ip route ls
192.168.1.0 dev eth0 scope link src 192.168.1.1
192.168.5.1 dev ppp0 proto kernel scope link src 192.168.5.2
203.97.61.42 via 192.168.1.2 dev eth0
192.168.1.0/24 dev eth0 scope link
127.0.0.0/8 dev lo scope link
default via 192.168.1.2 dev eth0
_______________________________________________
LARTC mailing list
LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc


[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux