FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 12-04-2010, 04:54 PM
Kaushal Shriyan
 
Default Internet Bandwidth

Hi
I have two network connections at home.I can connect both.. one on wired and another on wirelessbut the wired connection becomes the default route so all traffic goes through that

I want to have my bittorrent traffic go through the non-default route.is that possible ?
Thanks
Kaushal
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 12-04-2010, 06:20 PM
Sambit Bikas Pal
 
Default Internet Bandwidth

On Sat, Dec 4, 2010 at 23:24, Kaushal Shriyan <kaushalshriyan@gmail.com> wrote:
> Hi
> I have two network connections at home.I can connect both.. one on wired and
> another on wireless
> but the wired connection becomes the default route so all traffic goes
> through that
> I want to have my bittorrent traffic go through the non-default route.is
> that possible ?

Yes that's absolutely possible. A couple of lines of iptables script
will serve the purpose. You can selectively (based on the destination
port) redirect traffic to a particular interface. In case you need
help in writing the iptables script, let me know.

--
Sambit Bikas Pal
Dept of Physics,
Indian Institute Of Science Education & Research, Kolkata

Web: *http://www.botcyb.org
OpenPGP Key: http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x8E57F8B897D372B3

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 12-05-2010, 01:26 AM
Kaushal Shriyan
 
Default Internet Bandwidth

On Sun, Dec 5, 2010 at 12:50 AM, Sambit Bikas Pal <sambitbikaspal@gmail.com> wrote:


On Sat, Dec 4, 2010 at 23:24, Kaushal Shriyan <kaushalshriyan@gmail.com> wrote:

> Hi

> I have two network connections at home.I can connect both.. one on wired and

> another on wireless

> but the wired connection becomes the default route so all traffic goes

> through that

> I want to have my bittorrent traffic go through the non-default route.is

> that possible ?



Yes that's absolutely possible. A couple of lines of iptables script

will serve the purpose. You can selectively (based on the destination

port) redirect traffic to a particular interface. In case you need

help in writing the iptables script, let me know.



--

Sambit Bikas Pal

Hi Sambit,
Thanks for the quick reply. So what i understand is to enable iptables on my laptop or desktop to accomplish it.Please help me understand with some examples. Would appreciate if you can share me the iptables script.


Thanks and Regards
Kaushal
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 12-05-2010, 01:10 PM
Sambit Bikas Pal
 
Default Internet Bandwidth

On Sun, Dec 5, 2010 at 07:56, Kaushal Shriyan <kaushalshriyan@gmail.com> wrote:
> Hi Sambit,
> Thanks for the quick reply. So what i understand is to enable iptables on my
> laptop or desktop to accomplish it.
> Please help me understand with some examples. Would appreciate if you can
> share me the iptables script.

Hi Kaushal,
It turns out slightly more complicated than I thought initially, but
nevertheless can be done.
You need two things- iptables and iproute2, both are there, by default
in ubuntu. Follow the instructions given below.

###########################################
#login as root
sudo su

#Create a new policy routing table for the non-default interface
echo 1 WIFI >> /etc/iproute2/rt_tables

#information about the non defualt interface

ip route add 192.168.1.0/24 dev wlan0 src 192.168.1.10 table WIFI
ip route add default via 192.168.1.1 dev wlan0 table WIFI

#Remember to change 192.168.1.0/24 with the subnet of your wifi
network, 192.168.1.10 with the address of your wlan0 interface
#Replace wlan0 with the name of your wifi interface
#Replace 192.168.1.1 with the gateway ip address


#Add routing rule, replacing 192.168.1.10 with the ip address of your
wifi interface

ip rule add from 192.168.1.10/32 table WIFI
ip rule add to 192.168.1.10/32 table WIFI

#check the rules

ip rule show

#Now executing the iptable script to mark packets

iptables -A PREROUTING -t mangle -i eth0 -p tcp --dport 6881:6999 -j
MARK --set-mark 1

#Bit torrent uses ports from 6881 to 6999, so iptables is marking
packets destined for those ports.

#Finally add a rule to send marked packets via the non defualt gateway

ip rule add from all fwmark 1 table WIFI

#######################################

Let me know if there is any confusion.

Hope it helps.


--
Sambit Bikas Pal
Dept of Physics,
Indian Institute Of Science Education & Research, Kolkata

Web: *http://www.botcyb.org
OpenPGP Key: http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x8E57F8B897D372B3

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 12-06-2010, 02:31 PM
Kaushal Shriyan
 
Default Internet Bandwidth

On Sun, Dec 5, 2010 at 7:40 PM, Sambit Bikas Pal <sambitbikaspal@gmail.com> wrote:


On Sun, Dec 5, 2010 at 07:56, Kaushal Shriyan <kaushalshriyan@gmail.com> wrote:

> Hi Sambit,

> Thanks for the quick reply. So what i understand is to enable iptables on my

> laptop or desktop to accomplish it.

> Please help me understand with some examples. Would appreciate if you can

> share me the iptables script.



Hi Kaushal,

It turns out slightly more complicated than I thought initially, but

nevertheless can be done.

You need two things- iptables and iproute2, both are there, by default

in ubuntu. Follow the instructions given below.



###########################################

#login as root

sudo su



#Create a new policy routing table for the non-default interface

echo 1 WIFI >> /etc/iproute2/rt_tables



#information about the non defualt interface



ip route add 192.168.1.0/24 dev wlan0 src 192.168.1.10 table WIFI

ip route add default via 192.168.1.1 dev wlan0 table WIFI



#Remember to change 192.168.1.0/24 with the subnet of your wifi

network, 192.168.1.10 with the address of your wlan0 interface

#Replace wlan0 with the name of your wifi interface

#Replace 192.168.1.1 with the gateway ip address





#Add routing rule, replacing 192.168.1.10 with the ip address of your

wifi interface



ip rule add from 192.168.1.10/32 table WIFI

ip rule add to 192.168.1.10/32 table WIFI



#check the rules



ip rule show



#Now executing the iptable script to mark packets



iptables -A PREROUTING -t mangle -i eth0 -p tcp --dport 6881:6999 -j

MARK --set-mark 1



#Bit torrent uses ports from 6881 to 6999, so iptables is marking

packets destined for those ports.



#Finally add a rule to send marked packets via the non defualt gateway



ip rule add from all fwmark 1 table WIFI



#######################################



Let me know if there is any confusion.



Hope it helps.





--

Sambit Bikas Pal

Dept of Physics,

Indian Institute Of Science Education & Research, Kolkata


Hi Sambit
Thanks for sharing the iptables script. I will*definitely*try it out and update you with my findings.


Thanks again and much appreciated.
Thanks
Kaushal*
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 05:19 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org