You are not logged in.
Hello Guys
I have ths following situation
On my notebook i'm connected through wlan0 to my router and also connected through usb0 to my mobile phone 3g
This is what i want to do:
The ports of torrents and emule uses usb0
All the rest (80, 443, 25, 143, 22, etc) uses wlan0
So im going to have one link dedicated to my downloads and another to the rest.
Useful info:
ip wlan0: 192.168.1.100
gw wlan0: 192.168.1.1
ip usb0: 192.168.100.100
gw usb0: 192.168.100.254
Here is what I'm doing
I created a table called 3g on /etc/iproute2/rt_tables
Then
iptables -t mangle -A POSTROUTING -p tcp --dport 51413 -j MARK --set-mark 2
ip route add default via 192.168.100.254 dev usb0 table 3g
ip rule add fwmark 2 table 3g
ip route flush cache
It doesn't work, if I set another rule on ip rule like:
ip rule add to SOME_IP lookup 3g
When I access SOME_IP it uses the usb0 link as it should
But the packages that uses the port 51413 doesn't goes out through usb0
I checked it using bwm-ng and iptables -t mangle POSTROUTING -nvL (few packages are getting the mark 2) so I think the error it's here
Does anyone knows what could it be?
Thank you,
Wagner
Last edited by Brief (2010-05-10 02:40:15)
New Challenges Means New Achievements
Offline
Perhaps it's udp traffic? There's a whole lot of other rules you need to maintain sanity when doing this kind of stuff... You might be interested in this script I wrote (well, am writing)... It works OK, but run it in PRINT_ONLY mode first to double check the output )
http://github.com/fukawi2/pb-route
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
to check that if it is actually a tcp/udp proble,, try setting the fwmark to port tcp port 80, and then goto www.whatismyipaddress.com to see if its using the 3g ip address, if this works, then the problem might be with your mangle table rules.
Offline
I've tried to set the fwmark on port 80 and it didn't worked also
I'm going to try this script in perl fukawi2, as soon as I have time to it, thanks for sharing
New Challenges Means New Achievements
Offline
I'm going to try this script in perl fukawi2, as soon as I have time to it, thanks for sharing
No problem -- please do give any feedback on problem you find so I can fix them up
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
i think that it might be because the routing decision is made before the postrouting chain, and since the rule for fwmark is executed before the packet is fwmark'ed, it means that the kernel routes it to the default interface, and not to the 3g interface, try setting the fwmark rule to the PREROUTING mangle chain and see if it works or not.
Offline