Network Related Command

Static and DHCP IP Conf.

sudo emacs -nw /etc/network/interfaces
auto eth0
iface eth0 inet static
auto lo eth0
iface eth0 inet dhcp
iface lo inet loopback

Configure DNS

sudo vim /etc/dhcp/dhclient.conf
prepend domain-name-servers;
prepend domain-name-servers;

Bandwidth Monitor

mmahmood@mmahmood-Vostro-3400:~$ ifstat -T
       eth3               Total       
 KB/s in  KB/s out   KB/s in  KB/s out
    0.59      0.14      0.59      0.14
   12.13      3.80     12.13      3.80
    5.88      0.16      5.88      0.16
    1.30      2.27      1.30      2.27
mmahmood@mmahmood-Vostro-3400:~$ vnstat -l -i eth3
Monitoring eth3...    (press CTRL-C to stop)

   rx:        4 kbit/s     9 p/s          tx:        0 kbit/s     3 p/s

See details.

Limit Bandwidth

sudo apt-get install wondershaper
sudo wondershaper eth1 256 128 # wondershaper {interface} {down} {up} kilobit
sudo wondershaper clear eth1

Limit Bandwidth Application-wise

trickle -u {up} -d {down} {program}
trickle -u 16 -d 32 firefox # set firefox max download speed to 32Kbyte, upload 16Kbyte

If experiencing following error, then path is wrong for firefox.

trickle: Could not reach trickled, working independently: No such file or directory
trickle: exec(): No such file or directory
trickle -u 16 -d 32  /opt/firefox/firefox

If command not set, it runs in daemon collaborative-mode. That means, if a single program run via trickle, it can consume 100 KByte. Two programs can each consume 50 KByte.

trickled -d 100 -u 100

Watch HTTp request

$ sudo tcpflow -i any -C -J port 80
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License