LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Reply
 
Search this Thread
Old 12-02-2012, 10:59 AM   #1
uBoTo
LQ Newbie
 
Registered: Sep 2008
Location: Varna, Bulgaria
Posts: 9

Rep: Reputation: 0
Question tc - download and upload shpaer on one device


Hi! I have three devices on my Slackware machine: eth0 - LAN for my needs; eth1 - WAN access; eth2 - LAN, where I want to attach one access point and use it as Hotspot. I`ve tried to install hotspot server, but I`ve lost one day and nothing. So I decided only to limit the download/upload speed and the connections per user. I have one script for shaping download and upload bandwidth, but it is for two devices (LAN and WAN):
Code:
# In this script: eth1 - WAN; eth2 - LAN
#This limits upload traffic
tc qdisc add dev eth1 root handle 1: htb default 2 r2q 1
tc class add dev eth1 parent 1: classid  1:1 htb rate 128kbps ceil 128kbps
tc class add dev eth1 parent 1:1 classid 1:2 htb rate 3kbps ceil 30kbps                                                                                                                                         
tc filter add dev eth1 parent 1:0 prio 0 protocol ip handle 2 fw flowid 1:2 
iptables -A PREROUTING -t mangle -i eth2 -s 10.10.10.2 -j MARK --set-mark 2
#This limits download traffic
tc qdisc add dev eth2 root handle 2: htb default 2 r2q 1
tc class add dev eth2 parent 2: classid  2:1 htb rate 1024kbps ceil 1024kbps
tc class add dev eth2 parent 2:1 classid 2:2 htb rate 28kbps ceil 256kbps
tc filter add dev eth2 parent 2:0 prio 0 protocol ip handle 102 fw flowid 2:2
iptables -A POSTROUTING -t mangle -o eth2 -d 10.10.10.2 -j MARK --set-mark 102
Part of my iptables rules:
Code:
iptables -t nat -A POSTROUTING -s 10.10.10.0/24 ! -d 10.10.10.0/24 -j SNAT --to-source x.x.x.x # Use one of my WAN IPs for incoming/outgoing connections
iptables -A FORWARD -i eth2 -o eth0 -j REJECT
iptables -A FORWARD -i eth2 -o eth1 -j ACCEPT
iptables -I FORWARD -o eth2 -j ACCEPT
iptables -I FORWARD -p tcp --syn -m iprange --src-range 10.10.10.5-10.10.10.15 -m connlimit --connlimit-above 15 -j DROP
I want to use this shaping code, because with it I can control the bandwidth for each IP. How should I transform it to work? Thanks in advance!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I download (upload) engrave-11.py foamcuttersg1 Linux - Newbie 5 07-04-2010 03:12 PM
hdd-related download problem(upload 4-5MB/s, download ~1MB/s) tine Linux - Hardware 4 09-15-2004 04:06 PM
NIC: Upload/download different Birkoff Linux - Networking 3 05-26-2004 05:53 PM
download ,upload to ftp ody1 Linux - Networking 2 11-13-2003 06:27 AM
VSFTPD - can download but cant upload. Dirt Linux - Software 1 09-06-2003 09:42 PM


All times are GMT -5. The time now is 11:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration