Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 12-02-2012, 09:59 AM   #1
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):
# 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 -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 -j MARK --set-mark 102
Part of my iptables rules:
iptables -t nat -A POSTROUTING -s ! -d -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 -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!


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) foamcuttersg1 Linux - Newbie 5 07-04-2010 02:12 PM
hdd-related download problem(upload 4-5MB/s, download ~1MB/s) tine Linux - Hardware 4 09-15-2004 03:06 PM
NIC: Upload/download different Birkoff Linux - Networking 3 05-26-2004 04:53 PM
download ,upload to ftp ody1 Linux - Networking 2 11-13-2003 05:27 AM
VSFTPD - can download but cant upload. Dirt Linux - Software 1 09-06-2003 08:42 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:58 PM.

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