All of lore.kernel.org
 help / color / mirror / Atom feed
* Query about tc configuration and associated network issues
@ 2016-02-15 18:06 Δημήτριος Μάστορας
  2016-02-15 22:43 ` Andy Furniss
  2016-02-16  0:24 ` Dave Taht
  0 siblings, 2 replies; 3+ messages in thread
From: Δημήτριος Μάστορας @ 2016-02-15 18:06 UTC (permalink / raw)
  To: lartc

[-- Attachment #1: Type: text/plain, Size: 1805 bytes --]

Hello,

I work on a master thesis project regarding broadband connection  
sharing. My network topology is as follows:
1. A PC which is connected to the Internet via eth0 and shares its  
connection with other computers via wlan0 (as a hotspot).
2. Two laptops serving as traffic generators connected to the hotspot  
through WiFi.
3. A PC serving as a traffic sink.

I’m using the D-ITG traffic generator to emulate HTTP traffic. One of  
the laptops runs ITGSend in multi-flow mode to generate simultaneously  
several flows(e.g. 100 flows) whose traffic is delivered to the sink  
(3) which runs ITGRecv.

I have tested this scenario without having any tc rules [qdisc, class,  
filter] applied, and it works fine.

The problem I'm facing is that when I am setting a bandwidth limit  
(downlink: 10Mbps, uplink:200Kbps) and testing different queueing  
configurations(for example HTB, prio) (see the attached file - SBS),  
ITGRecv gives me an error and drops the connection.

Given that without any tc rules applied my system works fine, I’m  
guessing that tc is affecting D-ITG somehow. After some researching I  
wasn’t able to pin point what is the issue. For example, my initial  
guess was the due to the limited bandwidth, lots of out of order  
packets were delivered to the sink, or IP fragmentation could be the  
issue, but I wasn't able to verify any of these assumptions through  
netstat –sa.

Does anyone have any idea what the problem could be? Is anything wrong  
with my tc configuration? Is there any chance that a kernel  
configuration might solve the issue?

In case this is not the appropriate mailing list for posting this  
question, do you have to suggest any other relevant mailing list that  
i could probably ping about this issue?

Thank you in advance,
Dimitris

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: SBS --]
[-- Type: text/x-shellscript; name=SBS, Size: 3788 bytes --]

#!/bin/bash

TC=/sbin/tc
IF=eth0		      # Interface 
IFHU=wlan3	      # Interface Home Users
IFGU=wlan5            # Interface Guest Users
IP="$(ifconfig eth0 | grep "inet addr" | cut -d ':' -f 2 | cut -d ' ' -f 1)"    # IP eth0 Interface
echo "eth0 Interface IP: $IP"
GHU="$(ifconfig $IFHU | grep "inet addr" | cut -d ':' -f 2 | cut -d ' ' -f 1)"    # IP Home Users Interface
HUS="$( ifconfig $IFHU | grep "inet addr" | cut -d ':' -f 2 | cut -d ' ' -f 1 | cut -d '.' -f 1-3)"	# Home User Subnet
echo "Gateway Home User IP: $GHU"
echo "Home User Subnet: $HUS.0/24"
GGU="$(ifconfig $IFGU | grep "inet addr" | cut -d ':' -f 2 | cut -d ' ' -f 1)"    # IP Guest Users Interface
GUS="$( ifconfig $IFGU | grep "inet addr" | cut -d ':' -f 2 | cut -d ' ' -f 1 | cut -d '.' -f 1-3)"	# Guest User Subnet
echo "Gateway Guest User IP: $GGU"
echo "Guest User Subnet: $GUS.0/24" 

start() {

echo "Set Download Speed"
read DOWNLOAD
echo "Set Upload Speed"
read UPLOAD
wondershaper $IFHU $UPLOAD $DOWNLOAD
wondershaper $IFGU $UPLOAD $DOWNLOAD 

BW=$(($UPLOAD))kbit
echo $BW
echo "Set Ratio "
read RATIO 
echo "Home User Bandwidth "
HUBW=$(((($UPLOAD*(100-$RATIO)/100))))kbit         # Home Users Limit
echo $HUBW
echo "Guest User Bandwidth "
GUBW=$((($UPLOAD*$RATIO)/100))kbit          # Guest Users Limit
echo $GUBW

PATH=/sbin:/bin:/usr/sbin:/usr/bin

iptables -F
iptables -Z
iptables -X
iptables -t mangle -F
iptables -t nat -F

echo "1" > /proc/sys/net/ipv4/ip_forward

iptables -t nat -P PREROUTING ACCEPT
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT

#NAT Guest Network
iptables -o $IF -I POSTROUTING -t nat -s 10.42.1.0/24 -j SNAT --to-source $IP
#NAT Home Network
iptables -o $IF -I POSTROUTING -t nat -s 10.42.0.0/24 -j SNAT --to-source $IP

####################Bandwith Limit - Home,Guest Users########################
    $TC qdisc add dev $IF root handle 1: htb default 30
    $TC class add dev $IF parent 1: classid 1:1 htb rate $BW
    $TC class add dev $IF parent 1:1 classid 1:10 htb rate $HUBW ceil $HUBW 
    $TC class add dev $IF parent 1:1 classid 1:20 htb rate $GUBW ceil $GUBW
    $TC class add dev $IF parent 1:1 classid 1:30 htb rate 10kbit ceil 10kbit
    iptables -I FORWARD 1 -p all -o $IFHU -d 10.42.0.0/24 -j MARK --set-mark 10
    iptables -I FORWARD 2 -p all -i $IFHU -s 10.42.0.0/24 -j MARK --set-mark 10
    iptables -I FORWARD 3 -p all -i $IFHU -o $IFHU -j MARK --set-mark 10
    iptables -I FORWARD 4 -p all -o $IFGU -d 10.42.1.0/24 -j MARK --set-mark 20
    iptables -I FORWARD 5 -p all -i $IFGU -s 10.42.1.0/24 -j MARK --set-mark 20
    iptables -I FORWARD 6 -p all -i $IFGU -o $IFGU -j MARK --set-mark 20
    $TC filter add dev $IF parent 1: protocol ip handle 10 fw flowid 1:10
    $TC filter add dev $IF parent 1: protocol ip handle 20 fw flowid 1:20
    $TC qdisc add dev $IF parent 1:10 handle 110: pfifo_fast
    $TC qdisc add dev $IF parent 1:20 handle 120: pfifo_fast
    $TC qdisc add dev $IF parent 1:30 handle 130: pfifo_fast
#############################################################################

}

stop() {

    $TC qdisc del dev $IF root
    wondershaper clear $IFHU
    wondershaper clear $IFGU

}

restart() {

    stop
    sleep 1
    start

}

show() {

    $TC -s qdisc ls dev $IF

}

case "$1" in

  start)

    echo "Starting bandwidth shaping: "
    start
    echo "done"
    ;;

  stop)

    echo "Stopping bandwidth shaping: "
    stop
    echo "done"
    ;;

  restart)

    echo -n "Restarting bandwidth shaping: "
    restart
    echo "done"
    ;;

  show)
    	    	    
    echo "Bandwidth shaping status for $IF:\n"
    show
    echo ""
    ;;

  *)

    pwd=$/home/dimitris/Dropbox/Thesis/Scripts
    echo "Usage: $(/usr/bin/dirname $pwd)/SBS1 {start|stop|restart|show}"
    ;;

esac

exit 0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Query about tc configuration and associated network issues
  2016-02-15 18:06 Query about tc configuration and associated network issues Δημήτριος Μάστορας
@ 2016-02-15 22:43 ` Andy Furniss
  2016-02-16  0:24 ` Dave Taht
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Furniss @ 2016-02-15 22:43 UTC (permalink / raw)
  To: lartc

Δημήτριος Μάστορας wrote:
> Hello,
>
> I work on a master thesis project regarding broadband connection
> sharing. My network topology is as follows: 1. A PC which is
> connected to the Internet via eth0 and shares its connection with
> other computers via wlan0 (as a hotspot). 2. Two laptops serving as
> traffic generators connected to the hotspot through WiFi. 3. A PC
> serving as a traffic sink.
>
> I’m using the D-ITG traffic generator to emulate HTTP traffic. One of
>  the laptops runs ITGSend in multi-flow mode to generate
> simultaneously several flows(e.g. 100 flows) whose traffic is
> delivered to the sink (3) which runs ITGRecv.
>
> I have tested this scenario without having any tc rules [qdisc,
> class, filter] applied, and it works fine.
>
> The problem I'm facing is that when I am setting a bandwidth limit
> (downlink: 10Mbps, uplink:200Kbps) and testing different queueing
> configurations(for example HTB, prio) (see the attached file - SBS),
>  ITGRecv gives me an error and drops the connection.
>
> Given that without any tc rules applied my system works fine, I’m
> guessing that tc is affecting D-ITG somehow. After some researching I
>  wasn’t able to pin point what is the issue. For example, my initial
>  guess was the due to the limited bandwidth, lots of out of order
> packets were delivered to the sink, or IP fragmentation could be the
> issue, but I wasn't able to verify any of these assumptions through
> netstat –sa.
>
> Does anyone have any idea what the problem could be? Is anything
> wrong with my tc configuration? Is there any chance that a kernel
> configuration might solve the issue?

arp will go to htb default unless you filter elsewhere and yours is only
10kbit. I've never tested pfifo_fast with htb - maybe it doesn't help
arp, plus its length may depend on the txqlen of the $IF - maybe for
testing consistency it would be better to use queues that you choose the
length/behavior of and don't forget about arp.

With htb if no default is used, unclassified goes unshaped - which is
nice for arp.

HFSC is different, unclassified is dropped, so not so good if arp is
unclassified.

wondershaper was flawed because you have make sure child bandwidths add
up to parents.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Query about tc configuration and associated network issues
  2016-02-15 18:06 Query about tc configuration and associated network issues Δημήτριος Μάστορας
  2016-02-15 22:43 ` Andy Furniss
@ 2016-02-16  0:24 ` Dave Taht
  1 sibling, 0 replies; 3+ messages in thread
From: Dave Taht @ 2016-02-16  0:24 UTC (permalink / raw)
  To: lartc

Dave Täht
Let's go make home routers and wifi faster! With better software!
https://www.gofundme.com/savewifi


On Mon, Feb 15, 2016 at 2:43 PM, Andy Furniss <adf.lists@gmail.com> wrote:
> Δημήτριος Μάστορας wrote:
>>
>> Hello,
>>
>> I work on a master thesis project regarding broadband connection
>> sharing. My network topology is as follows: 1. A PC which is
>> connected to the Internet via eth0 and shares its connection with
>> other computers via wlan0 (as a hotspot). 2. Two laptops serving as
>> traffic generators connected to the hotspot through WiFi. 3. A PC
>> serving as a traffic sink.
>>
>> I’m using the D-ITG traffic generator to emulate HTTP traffic. One of
>>  the laptops runs ITGSend in multi-flow mode to generate
>> simultaneously several flows(e.g. 100 flows) whose traffic is
>> delivered to the sink (3) which runs ITGRecv.
>>
>> I have tested this scenario without having any tc rules [qdisc,
>> class, filter] applied, and it works fine.
>>
>> The problem I'm facing is that when I am setting a bandwidth limit
>> (downlink: 10Mbps, uplink:200Kbps) and testing different queueing
>> configurations(for example HTB, prio) (see the attached file - SBS),
>>  ITGRecv gives me an error and drops the connection.
>>
>> Given that without any tc rules applied my system works fine, I’m
>> guessing that tc is affecting D-ITG somehow. After some researching I
>>  wasn’t able to pin point what is the issue. For example, my initial
>>  guess was the due to the limited bandwidth, lots of out of order
>> packets were delivered to the sink, or IP fragmentation could be the
>> issue, but I wasn't able to verify any of these assumptions through
>> netstat –sa.
>>
>> Does anyone have any idea what the problem could be? Is anything
>> wrong with my tc configuration? Is there any chance that a kernel
>> configuration might solve the issue?
>
>
> arp will go to htb default unless you filter elsewhere and yours is only
> 10kbit. I've never tested pfifo_fast with htb - maybe it doesn't help
> arp, plus its length may depend on the txqlen of the $IF - maybe for
> testing consistency it would be better to use queues that you choose the
> length/behavior of and don't forget about arp.
>
> With htb if no default is used, unclassified goes unshaped - which is
> nice for arp.
>
> HFSC is different, unclassified is dropped, so not so good if arp is
> unclassified.
>
> wondershaper was flawed because you have make sure child bandwidths add
> up to parents.

Leverage sqm-scripts for your tests.

http://www.bufferbloat.net/projects/cerowrt/wiki/Wondershaper_Must_Die

>
>
> --
> To unsubscribe from this list: send the line "unsubscribe lartc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-16  0:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-15 18:06 Query about tc configuration and associated network issues Δημήτριος Μάστορας
2016-02-15 22:43 ` Andy Furniss
2016-02-16  0:24 ` Dave Taht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.