Tag Archives: OpenWRT

Traffic shaper benchmark

These are the results of a traffic shaper benchmark. This previous post describes the complete configuration and setup instructions on OpenWRT.

I’ll be running a simple ping while doing a speedtest on speedtest.net.

Benchmark without shaping

Ping results

Below you can find the ping response times. The destination is www.google.com.

$ ping www.google.com
PING www.google.com (173.194.66.105) 56(84) bytes of data.
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=1 ttl=47 time=24.9 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=2 ttl=47 time=18.9 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=3 ttl=47 time=19.6 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=4 ttl=47 time=52.7 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=5 ttl=47 time=134 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=6 ttl=47 time=89.8 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=7 ttl=47 time=177 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=8 ttl=47 time=246 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=9 ttl=47 time=250 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=10 ttl=47 time=210 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=11 ttl=47 time=368 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=12 ttl=47 time=307 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=13 ttl=47 time=391 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=14 ttl=47 time=21.2 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=15 ttl=47 time=63.1 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=16 ttl=47 time=300 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=17 ttl=47 time=366 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=18 ttl=47 time=190 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=19 ttl=47 time=412 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=20 ttl=47 time=464 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=21 ttl=47 time=148 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=22 ttl=47 time=499 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=23 ttl=47 time=658 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=24 ttl=47 time=507 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=25 ttl=47 time=485 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=26 ttl=47 time=734 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=27 ttl=47 time=704 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=28 ttl=47 time=52.2 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=29 ttl=47 time=893 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=30 ttl=47 time=885 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=31 ttl=47 time=298 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=32 ttl=47 time=18.5 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=33 ttl=47 time=20.5 ms
64 bytes from we-in-f105.1e100.net (173.194.66.105): icmp_req=34 ttl=47 time=18.1 ms
^C
--- www.google.com ping statistics ---
34 packets transmitted, 34 received, 0% packet loss, time 33036ms
rtt min/avg/max/mdev = 18.141/295.204/893.783/254.974 ms
$

Speedtest results

Without shaping

Traffic shaper benchmark without shaping

Benchmark with shaping

Ping results

$ ping www.google.com
PING www.google.com (173.194.67.106) 56(84) bytes of data.
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=1 ttl=47 time=19.1 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=2 ttl=47 time=18.4 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=3 ttl=47 time=18.2 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=4 ttl=47 time=18.9 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=5 ttl=47 time=24.4 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=6 ttl=47 time=28.7 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=7 ttl=47 time=25.6 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=8 ttl=47 time=25.6 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=9 ttl=47 time=30.8 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=10 ttl=47 time=22.7 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=11 ttl=47 time=24.2 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=12 ttl=47 time=24.8 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=13 ttl=47 time=22.7 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=14 ttl=47 time=24.5 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=15 ttl=47 time=22.1 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=16 ttl=47 time=20.1 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=17 ttl=47 time=19.7 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=18 ttl=47 time=20.8 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=19 ttl=47 time=21.1 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=20 ttl=47 time=17.5 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=21 ttl=47 time=21.9 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=22 ttl=47 time=17.8 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=23 ttl=47 time=19.9 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=24 ttl=47 time=21.2 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=25 ttl=47 time=18.0 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=26 ttl=47 time=22.6 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=27 ttl=47 time=20.8 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=28 ttl=47 time=20.0 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=29 ttl=47 time=18.6 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=30 ttl=47 time=17.3 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=31 ttl=47 time=20.3 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=32 ttl=47 time=18.8 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=33 ttl=47 time=17.5 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=34 ttl=47 time=18.1 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=35 ttl=47 time=18.5 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=36 ttl=47 time=19.2 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=37 ttl=47 time=18.2 ms
64 bytes from wi-in-f106.1e100.net (173.194.67.106): icmp_req=38 ttl=47 time=18.8 ms
^C
--- www.google.com ping statistics ---
38 packets transmitted, 38 received, 0% packet loss, time 37052ms
rtt min/avg/max/mdev = 17.320/21.026/30.842/3.183 ms
$

Speedtest results

shape

Traffic shaper benchmark with shaping

Differences

1. With shaping : lower download and upload speeds.
2. With shaping : speedtest has almost no impact on ping
3. Without shaping : speedtest is higher
4. Without shaping : ping response times increased a lot during the speedtest. Average is 15 times higher during speedtest.

Conclusion

1. The 2 speedtests show that the traffic shaper is limitting the amount of bandwidth that is used for upload and downloads from the internet. This seems to be a disadvantage.
2. The ping results show that the speedtest has a high impact on the response times. With traffic shaping enabled, this impact goes away. This is a clear advantage and the primary reason why I do traffic shaping on my network. The traffic of my voip phones are getting the same threatment as the ICMP packets. This results in better call quality.

Traffic shaping with OpenWRT

This post will explain how to do traffic shaping with openwrt. It’s using a script which you can easily customize to your own needs.

What is traffic shaping?

Traffic shaping is slowing down certain packets.

Why slowing packets down? I want to go as fast as possible!

On a typical network you have different types of traffic f.e.

  • web browsing
  • smtp traffic for sending/receiving emails
  • bittorrent
  • voip
  • ssh

Some types af traffic require a lot of bandwidth. Other types of traffic require a small amount of bandwidth but require a low latency. By shaping certain traffic you can create room for other traffic. Without shaping, your openwrt internet router would behave like a brainless fifo queue. With a correctly configured traffic shaper, your openwrt internet router will intelligently prioritize packets based on a number of criteria.

Why shaping traffic?

I started doing traffic shaping because I noticed problems with call quality using voip phones. I’m using Siemens Gigaset C610 IP. These call quality problems happened during whenever backups where sent to a cloud provider. While it’s important to take regular backups, I didn’t want those backups to have an influence on my voip traffic. At all times, the voip traffic needs a higher priority then backups.

Howto to start traffic shaping with OpenWRT?

In order to start traffic shaping with OpenWRT, you have to install some packages.

Install required packages

# opkg update
# opkg install tc kmod-sched

Install script

You can download my script here.
Please make sure to edit the variable on top of the file.
Note that I started ‘The ultimate traffic confitioner’ from lartc.org

Run script at boot time

Add this line to /etc/rc.local . Make sure you insert the line before the ‘exit 0’.

sh /etc/shape.sh

Future post…

In a future post I’ll show what I gained with traffic shaping with openwrt.
Traffic shaper benchmark

 

Update on 2013/05/03 : added kmod-sched to the list of packages to install
Update on 2013/05/08 : added link to benchmark post.

Enable IPv6 on OpenWRT

This guide describes how you can enable IPv6 on OpenWRT. This guide assumes that your ISP does not provide a native IPv6 address. We’ll make use of the 6to4 relay servers. No account is required to start using the service. The howto assumes you have OpenWRT running on your router. OpenWRT Backfire 10.03.1 has been installed on my Netgear WNDR3800.

Install the required packages.

This can be done by the HTTP GUI or CLI. Below you find the commands to execute when installing the packages using CLI.

opkg update
opkg install kmod-ipv6 ip6tables radvd ip 6to4

Configure a new interface

Configure an extra interface that will have your IPv6 address. This can be done by adding the below lines to /etc/config/network

config 'interface' '6rd'
   option 'proto' '6to4'
   option 'adv_subnet' '1'
   option 'adv_interface' 'lan'

Add new interface to WAN zone

Open /etc/config/firewall and locate configuration for the ‘wan’ zone.

config 'zone'
   option 'name' 'wan'

One of the configuration settings lists the attached networks. Add ‘6rd’ to the list.

   option 'network' '6rd wan'

Configure Router Advertisement Daemon

Radvd is the daemon that announces the ipv6 router on the internal network. IPv6 clients will listen for Router Advertisements (RA) to configure their interfaces with an IPv6 address. This process is called StateLess Address AutoConfiguration. (SLAAC)
To enable radvd, edit ‘/etc/config/radvd’ and change the ‘ignore’ to ‘0’

config interface
   option interface 'lan'
   option AdvSendAdvert 1
   option AdvManagedFlag 0
   option AdvOtherConfigFlag 0
   list client ''
   option ignore 0

Enable IPv6 forwarding

Add the following to /etc/sysctl.conf

# enable ipv6 forwarding
net.ipv6.conf.all.forwarding=1

Reboot your router

This one is pretty easy. Just run the below command and wait.

reboot<enter>

Test

First try to ping my server using its IPv6 address. Run the following command on your router. This will verify of your router can access IPv6 addresses.

ping6 -c 4 2001:470:7071:1::6

If this works, you can proceed with the following tests. Try to browse to the following URL with one of the PC within the LAN of your router. As you can see the URL contains an IPv6 address.

http://[2a01:4f8:a0:9261::7]/

If you were able to access the above URL, your PC has IPv6 connectivity. Now, let’s test if you can resolve AAAA records. Try the following URL.

http://ipv6.rivy.org

If this was successful, you should be able to browse any IPv6 enabled website on the internet.

Questions or feedback

Feel free to contact me via the comments section if you have questions. Any feedback is appreciated.