Networking With Raspberry Pi 2

From Iwan
Jump to: navigation, search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

I created a shoppinglist and order the Raspberry Pi components (below)

RPI Hosts

rpi2-1 = B8:27:EB:CD:CF:E4

rpi2-2 = B8:27:EB:7E:C7:AC

The Mac address information is correct according IEEE ouisearch

Software

Install Ubuntu for the Raspberry Pi 2

  1. Build the RPI2 into the SOS Behuizing Regenboog
    1. The case is build out of small plates that are numbered, the numbers indicate the order of the plates where the RPI2 falls in.
    2. The most top and most bottom plates are blank
  2. Formatted the SD card with SD Formatter
  3. Created OS image for RPI2
    1. Ubuntu MATE
      1. Downloaded Win32 Disk Imager
      2. Downloaded Ubuntu MATE
      3. Wrote the image to the microSD card
    2. Ubuntu 14.04 LTS
      1. Downloaded + created image Ubuntu 14.04 LTS
  4. Booted up the RPI2 and did the pre-install steps needed for:
    1. Ubuntu MATE
    2. Ubuntu 14.04 LTS

Enable SSH

iwan@rpi2-1:~$ sudo apt-get install openssh-server 
iwan@rpi2-2:~$ sudo apt-get install openssh-server 

Now I am able to log in with SSH.

Install Iperf

iwan@rpi2-1:~$ sudo apt-get install iperf 
iwan@rpi2-2:~$ sudo apt-get install iperf 

Install Tshark and Wireshark

iwan@rpi2-1:~$ sudo apt-get install tshark wireshark 
iwan@rpi2-2:~$ sudo apt-get install tshark wireshark 

Iperf

Check IP addresses

iwan@rpi2-1:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr b8:27:eb:cd:cf:e4  
          inet addr:10.11.11.175 Bcast:10.11.11.255  Mask:255.255.255.0
          inet6 addr: fe80::ba27:ebff:fecd:cfe4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3794 errors:0 dropped:0 overruns:0 frame:0
          TX packets:696 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1343222 (1.3 MB)  TX bytes:86769 (86.7 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:362 errors:0 dropped:0 overruns:0 frame:0
          TX packets:362 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:34861 (34.8 KB)  TX bytes:34861 (34.8 KB)

iwan@rpi2-1:~$
iwan@rpi2-2:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr b8:27:eb:7e:c7:ac  
          inet addr:10.11.11.171 Bcast:10.11.11.255  Mask:255.255.255.0
          inet6 addr: fe80::ba27:ebff:fe7e:c7ac/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8185 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2738 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:5417894 (5.4 MB)  TX bytes:450477 (450.4 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:633 errors:0 dropped:0 overruns:0 frame:0
          TX packets:633 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:72151 (72.1 KB)  TX bytes:72151 (72.1 KB)

iwan@rpi2-2:~$
Hostname Role IP Address
rpi2-1 SERVER 10.11.11.175
rpi2-2 CLIENT 10.11.11.171

Test 1

Start the iperf server service on rpi2-1.

iwan@rpi2-1:~$ iperf -s
----
root ##b##Server listening##!b## on TCP port 5001
TCP window size: 85.3 KByte (default)
----

Start the iperf client service on rpi2-2.

iwan@rpi2-2:~$ iperf -c 10.11.11.175 
----
root ##b##Client connecting to 10.11.11.175, TCP port 5001
TCP window size: 43.8 KByte (default)
----
[  3] local 10.11.11.171 port 53385 connected with 10.11.11.175 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec   113 MBytes  94.4 Mbits/sec
iwan@rpi2-2:~$ 

View results on the server.

iwan@rpi2-1:~$ iperf -s
----
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
----
[  4] local 10.11.11.175 port 5001 connected with 10.11.11.171 port 53385
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-10.0 sec   113 MBytes  94.1 Mbits/sec

Test 2

Start the iperf server service on rpi2-1.

iwan@rpi2-1:~$ iperf -s
----
root ##b##Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
----

Start the iperf client service on rpi2-2.

iwan@rpi2-2:~$ iperf -c 10.11.11.175 -r
----
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
----
----
root ##b##Client connecting##!b## to 10.11.11.175, TCP port 5001
TCP window size: 70.0 KByte (default)
----
[  5] local 10.11.11.171 port 53386 connected with 10.11.11.175 port 5001
[ ID] Interval       Transfer     Bandwidth
[  5]  0.0-10.0 sec   112 MBytes  93.6 Mbits/sec
[  4] local 10.11.11.171 port 5001 connected with 10.11.11.175 port 40047
[  4]  0.0-10.1 sec   113 MBytes  94.1 Mbits/sec
iwan@rpi2-2:~$

View results on the server.

iwan@rpi2-1:~$ iperf -s
----
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
----
[  4] local 10.11.11.175 port 5001 connected with 10.11.11.171 port 53386
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-10.1 sec   112 MBytes  93.2 Mbits/sec
----
root ##b##Client connecting##!b## to 10.11.11.171, TCP port 5001
TCP window size: 70.0 KByte (default)
----
[  4] local 10.11.11.175 port 40047 connected with 10.11.11.171 port 5001
[  4]  0.0-10.0 sec   113 MBytes  94.4 Mbits/sec

Conclusion

At first I was wondering why I did not got more troughput then 1 Gb/sec, but then I discovered that the RPi2 only has a FastEthernet interface, and I tought it had a GigabitEthernet interface:

iwan@rpi2-1:~$ dmesg|grep eth0
[    2.356975] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-bcm2708_usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:cd:cf:e4
[   30.472266] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[   32.084114] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
iwan@rpi2-1:~$ 
iwan@rpi2-2:~$ dmesg|grep eth0
[    2.340162] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-bcm2708_usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:7e:c7:ac
[   29.505781] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[   31.131441] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
iwan@rpi2-2:~$ 

Tshark and Wireshark

Cisco Switch Config

Device Switchport Role
Source box Gi0/22 SOURCE
Wireshark box Gi0/23 DESTINATION
!
interface GigabitEthernet0/22
 description Source box 
 switchport access vlan 11
 switchport mode access
 spanning-tree portfast
 no shut
!
default interface GigabitEthernet0/23
! 
monitor session 1 source interface gigabitEthernet 0/22 both
!
monitor session 1 destination interface gigabitEthernet 0/23 encapsulation replicate
!

Wireshark Capture

iwan@rpi2-1:~$ sudo tshark -f "port 80" -i eth0 -w /tmp/capture-18-06-15-1542.cap
[sudo] password for iwan: 
tshark: Lua: Error during loading:
 [string "/usr/share/wireshark/init.lua"]:46: dofile has been disabled due to running Wireshark as superuser. 
See http://wiki.wireshark.org/CaptureSetup/CapturePrivileges for help in running Wireshark as an unprivileged user.
Running as user "root" and group "root". This could be dangerous.
root ##b##Capturing on 'eth0'
1027

Ctrl-C

The capture was aborted with the "Ctrl-C" input.

View if the results are available:

iwan@rpi2-1:/$ cd tmp/
iwan@rpi2-1:/tmp$ ls -l
total 876
-rw------- 1 root root 894976 Jun 18 15:46 capture-18-06-15-1542.cap
iwan@rpi2-1:/tmp$ 

Usefull links