= [http://groups.geni.net/geni/wiki/Tutorials/Layer2Ping/Procedure Layer 2 Ping] = {{{ #!html
Image Map
}}} == 2. Execute the Experiment == === 2.1 Open two terminal windows === Click on the terminal program icon on the dock to the left of your screen. This will open up a terminal. From the "File" menu of the terminal program, select "New Window" to open a second terminal window. === 2.2 Log into the server node === From terminal 1, ssh into the server node. '''ExoGENI Rack:''' {{{ssh -p -l root }}} '''InstaGENI Rack:''' {{{ssh -p }}} === 2.3 Log into the client node === From terminal 2, ssh into the client node. '''ExoGENI Rack:''' {{{ssh -p -l root }}} '''InstaGENI Rack:''' {{{ssh -p }}} === 2.4 Gather information about the network interfaces on the server and client === Find the name and hardware address (MAC address) of the data network interface on the server and the client. 1. In terminal 1 where you are logged into the server, type {{{ifconfig}}}. This will list all network interfaces on the server. Look for the interface with the IP address 10.20.30.40, This is the IP address specified in our request RSpec. On your worksheet record the name and hardware address of this interface. 2. In terminal 2 where you are logged into the client, type {{{ifconfig}}}. This will list all network interfaces on the server. Look for the interface with the IP address 10.20.30.41, This is the IP address specified in our request RSpec. On your worksheet record the name and hardware address of this interface. === 2.5 Verify you can connect to the client from the server and vice versa === We will use ping to do this. 1. In terminal 1 (server node), type {{{ping -c 3 10.20.30.41}}}. 2. In terminal 2 (client node), type {{{ping -c 3 10.20.30.40}}}. If the pings succeed you know you have IP connectivity between the two nodes. === 2.6 Download and install !PingPlus on the server and client nodes === We will download and install a program that does Layer 2 pings on the server and client nodes. Do this on both nodes: {{{ wget http://www.gpolab.bbn.com/experiment-support/PingPlus/pingPlus-0.2.tar.gz tar xvfz pingPlus-0.2.tar.gz }}} You should see a directory called {{{pingPlus-0.2}}}. This directory has the source code for {{{pingPlus}}}. === 2.7 Compile pingPlus === Do this on both nodes: '''ExoGENI: ''' ExoGENI nodes do not include a compiler. Download and install the compiler: {{{ apt-get update apt-get install build-essential }}} We are now ready to compile {{{pingPlus}}}: {{{ cd pingPlus-0.2 make }}} === 2.8 Turn off IP on the data interface === We now turn off IP on the data interface. ''Be very careful to not turn off IP on any of the other interfaces as this will make your node unreachable.'' '''ExoGENI:''' {{{ service neuca stop /sbin/ifconfig 0.0.0.0 }}} '''InstaGENI:''' {{{ sudo /sbin/ifconfig 0.0.0.0 }}} === 2.9 Run {{{pingPlus}}} === In terminal 1 (server node): {{{ ./pingPlusListener 10002 }}} The 10002 is the value we'll use for the type field in the header of the Ethernet frames we send and receive. The above command tells the server to look for Ethernet packets of this type. (In this exercise you can use almost any value for this type field.) In terminal 2 (client node): {{{ ./pingPlus 10002 }}} This tells the client to send an Ethernet frame with destination address set to the server's data interface MAC address and with the type field set to 10002. This frame will be sent out of the specified interface on the client. The client prints out the contents of the data field of the frame it sent to the server and the contents of the data field in the frame it got back from the server. In terminal 1 (server node), kill the {{{pingPlusListener}}} by typing {{{control-c}}}. === 2.10 Examine the {{{pingPlus}}} program === Open up an editor (vi or emacs) to view {{{pingPlus.c}}}. All the interesting stuff happens starting line 110 of this file: - Open a Layer 2 socket (lines 110 - 115) - Bind the socket to the specified interface (lines 117 - 125) - In a buffer compose the contents of the data portion of the Ethernet frame to be sent to the server. In our case the data portion has the format "RQ:+" (line 133) - Send the packet. The send is successful if the return from {{{sendPacket}}} matches the number of bytes sent. The {{{sendPacket}}} function is implemented in the file {{{packetFunctions.c}}} in this directory. This function sets the appropriate header fields in the ethernet frame before sending it. - Wait for the server to respond (line 145). The {{{receivePacket}}} function is implemented in file {{{packetFunctions.c}}}. === 2.11 Modify {{{pingPlus}}} to measure round-trip delays === You should by now have a feel for how Layer 2 sockets work. You can now modify ping2Plus to measure round-trip delays similar to the Layer 3 ping. You will want to: - get the current time before you send the packet using - get the current time when you get a response from the server. === 2.12 (Optional) Get a solution to the exercise === To see a solution to this exercise, create a new directory and dowload the solution to that directory: {{{ cd wget http://www.gpolab.bbn.com/experiment-support/PingPlus/pingPlus_v3.tar.gz tar xvfz pingPlus_v3.tar.gz cd pingPlus_v3 }}} The file {{{pingPlus.c}}} in this directory will have the solution. The statements that do the timing measurement are around lines 151 and 175. = [wiki:Tutorials/Layer2Ping/Procedure/Finish Next: Finish] =