Apr 042012
 

iperf can help you test the bandwidth of your network setup via a TCP connection:

# On one computer:
iperf -s -w 2M -i 1 -p 2222
# On the other computer:
iperf -c the.one.computer.local -w 2M -i 1 -p 2222

Or test via UDP (be careful, this is more likely to have a negative impact on your network):

# On one computer
iperf -s -u -i 1 -p 2222
# On the other computer:
iperf -c the.one.computer.local -u -b 300M -i 1 -p 2222

This will show you jitter, and the percentage of lost datagrams.

Sep 062010
 

Install OpenVPN

sudo aptitude install openvpn
# open port 1194 (as shown here for the ufw firewall interface):
sudo ufw allow 1194

Become an Certificate Authority

Alternative to this way: Use TinyCA (there are Ubuntu packages available).

sudo mkdir /etc/openvpn/easy-rsa/
sudo cp -R /usr/share/doc/openvpn/examples/easy-rsa/2.0/* /etc/openvpn/easy-rsa/
sudo chown -R $USER /etc/openvpn/easy-rsa/
cat << EOF | sudo tee -a /etc/openvpn/easy-rsa/vars >/dev/null
export KEY_COUNTRY="DE"
export KEY_PROVINCE="Hesse"
export KEY_CITY="Frankfurt"
export KEY_ORG="Your Organization"
export KEY_EMAIL="contact@example.org"
EOF

create the server certificates:

cd /etc/openvpn/easy-rsa/
source vars
./clean-all
./build-dh
./pkitool --initca
./pkitool --server server
cd keys
openvpn --genkey --secret ta.key
sudo cp server.crt server.key ca.crt dh1024.pem ta.key /etc/openvpn/

After making changes to the configuration restart the server:

Nov 012009
 

Let’s say you network is kinda slow and you are sure that there is nothing wrong with your hardware (broken cables, bad switches etc.). The first thing you should have a look at are your DNS servers. If the primary one is unreachable and the secondary is, you network works but is slow connecting.

Comment → #17 of bug 433972 describes exactly my symptoms.

Take a look at your dns setup ( /etc/resolv.conf ) and remove any bad dns servers. → solved.

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
Aug 182009
 

Commonly used tools to test network bandwith are:

  • bmon
  • bwbar
  • bwm
  • bwm-ng
  • iftop
  • iperf
  • ipfm
  • ttcp
  • speedometer
  • cbm
  • ibmonitor
  • pktstat
  • mactrack
  • MRTG
  • Cacti

bmon

I really like bmon, its a small footprint real time bandwidth monitor for network interfaces on the command line. Press g for console graphics and d for detailed stats.

sudo aptitude install bmon

Speedometer

http://excess.org/speedometer/

Screenshot: http://excess.org/media/image/2008/05/speedometer.png
written in python, monitors network interfaces,

sudo aptitude install speedometer

Usage Examples from the project website How long it will take for my 38MB transfer to finish?

Aug 182009
 

Analyse the situation by taking a look at the configuration and stats:

ifconfig -a
netstat -s

Check if your gateway and DNS servers are reachable. If only one of the dns servers is not reachable edit /etc/resolv.conf manually (will be overwritten by next network change).

To set the network interface eth1 to 100MBits full duplex with no autonegotiation:

sudo ethtool -s eth1 autoneg off speed 100 duplex full
sudo ifdown eth1 && sudo ifup eth1

and for permanent setup change /etc/network/interface :

pre-up /usr/sbin/ethtool -s $IFACE speed 100 duplex full autoneg off
VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
Aug 182009
 

If your ssh connection is established only with a delay of about 2-4 seconds (even when you are connected to a fast network), you can try the tips in this post.

What to try first

Debug you ssh connection: using ssh philipp@lion.ath.cx -p 28 -vvv (note the -vvv switch at the end).
Often key authentication fails for some reason (wrong key, …) so you should be able to solve the issue this way.

What to try next

Edit the configuration file /etc/ssh/sshd_config on the server:
add or uncomment the line containing UseDNS no.

Aug 182009
 

http://deice.daug.net/netcat_speed.html
http://www.linuxhomenetworking.com/forums/showthread.php?t=18736
http://lxer.com/module/forums/t/26336/
good (short!): http://www.odium.com.au/?p=78

listen on machine A:

nc -v -v -l -n -p 2222 >/dev/null

on newer versions of netcat (Ubuntu 10.04) you must use

nc.traditional -v -v -l -n -p 2222 >/dev/null

Send from machine B:

time yes|nc -v -v -n tklaus.selfip.org 2222 >/dev/null

waiting a bit, then hit Ctrl+C and get something like:

real    0m55.098s
user    0m4.579s
sys     0m2.301s

on machine A you see

sent 0, rcvd 355480892

calculate: google tells us that 355480892 bytes / 55.09 seconds in Mbps is: (355 480 892 bytes) / (55.09 seconds) = 49.2304225 Mbps NOTE that the above result was without the -n switch on the server side (machine A).