22.11.2014 Views

Understanding TCP/IP Model Internals and Interfaces

Understanding TCP/IP Model Internals and Interfaces

Understanding TCP/IP Model Internals and Interfaces

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1508<br />

<strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong><br />

<strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

CONFIDENTIAL — RESTRICTED ACCESS:<br />

This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Lab 1: Tracing <strong>TCP</strong> Connection<br />

Background<br />

• <strong>TCP</strong> uses a 3-way h<strong>and</strong>shake to open connections<br />

• <strong>TCP</strong> performs a slow start at the beginning of connection<br />

• <strong>TCP</strong> uses a 4-way h<strong>and</strong>shake to close connections<br />

Objective<br />

Our goal is to observe the typical lifecycle of a <strong>TCP</strong> session. We will use OPNET Debugger (ODB)<br />

to help us trace <strong>and</strong> underst<strong>and</strong> <strong>TCP</strong> behavior. We are interested in seeing how the <strong>TCP</strong> model<br />

• establishes a connection<br />

• sends data during slow start<br />

• terminates connections<br />

Network <strong>Model</strong><br />

Network Description<br />

The workstation (“client”) downloads a 5,000-byte file from the “server” node. The traffic is sent<br />

over Ethernet with MTU set to 1,500 Bytes.<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

1


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Main Steps<br />

• Examine network configuration<br />

• Enable ODB while running simulation<br />

• Examine 3-way h<strong>and</strong>shake<br />

• Examine slow start<br />

• Examine connection termination<br />

• Print connection state (homework)<br />

• Print packet content (homework)<br />

Instructions<br />

Examine Network Configuration<br />

1. Start OPNET <strong>Model</strong>er.<br />

2. Open project 1508_lab1. Scenario FTP_5000_byte_download opens. This scenario has been<br />

fully configured for you.<br />

Examine <strong>TCP</strong> configuration<br />

Both client <strong>and</strong> server are running on Windows 2000. Check that <strong>TCP</strong> Parameters attribute on<br />

both is set to Windows 2000. Please contact one of the TAs if you do not know how to do<br />

this.<br />

Examine server settings<br />

3. What is the Slow Start Initial Count (MSS)? __________<br />

4. How many <strong>TCP</strong> segments will be sent after the connection is established? __________<br />

5. What is the <strong>TCP</strong> Maximum Segment Size? __________<br />

Hint 1: By using the Auto-assigned symbol, we are asking <strong>TCP</strong> to calculate <strong>TCP</strong> MSS based on<br />

the MTU of the lower layer, which is Ethernet. Ethernet MTU is 1,500 Bytes.<br />

Hint 2: The size of the <strong>TCP</strong> header is 20 bytes, <strong>and</strong> the size of the <strong>IP</strong> header is 20 bytes.<br />

Examine application configuration:<br />

Client is downloading data from the server.<br />

6. Verify that the file size is 5,000 Bytes. This is set on the Application Configuration object, in<br />

attribute Application Definitions->File Transfer - 5000 Bytes -> Description -> FTP -> File<br />

Size (bytes).<br />

7. How many <strong>TCP</strong> data segments will be used to send 5,000 bytes if there is no retransmission?<br />

____________<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

2


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Examine 3-Way H<strong>and</strong>shake<br />

Run the Simulation in ODB<br />

1. Click on Configure/Run DES button.<br />

If you do not see the dialog box shown in the screenshot below, click on “Detailed…” to bring it<br />

up.<br />

2. Configure the simulation to run in the ODB.<br />

a. Ensure that Use OPNET Simulation Debugger (ODB) is checked as shown below:<br />

b. Click on the Run button. OPNET Debugger Simulation Console comes up.<br />

c. If you do not see the simulation console in the upper right pane, click on “Console” tab so it<br />

appears.<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

3


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

3. Set a trace on <strong>TCP</strong><br />

a. To set a trace on <strong>TCP</strong>, type ltrace tcp in the ODB prompt as shown on the above picture <strong>and</strong><br />

press Enter.<br />

b. To continue the simulation, click on the Continue button.<br />

c. The simulation now continues <strong>and</strong> prints <strong>TCP</strong>-related information.<br />

4. Examine the 3-way h<strong>and</strong>shake. First, scroll up to the first event that gets printed. You can see<br />

that the server opens a connection at time 0.<br />

• Is this a passive or active connection? How do you know? _________________<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

4


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

• What is the local port number used by the server? _________________<br />

• At what event did the client’s <strong>TCP</strong> process receive an OPEN request from the application?<br />

_________________<br />

5. What are the sequence numbers of the segments comprising 3-way h<strong>and</strong>shake?<br />

a. First segment: ____________<br />

b. Second segment: ____________<br />

c. Third segment: ____________<br />

6. Were any options set in the SYN packets? _________________________________________<br />

Hint: See trace at events 125 <strong>and</strong> 146.<br />

Examine Slow Start<br />

1. Server’s <strong>TCP</strong> process then sends its first application data at event 230.<br />

a. How many segments are sent out at the beginning? ___________<br />

b. How is this related to the Slow Start Initial Count from step 3 of the Examine Network<br />

Configuration section?<br />

___________<br />

c. What are the sequence numbers <strong>and</strong> data length of the first 2 segments?<br />

1 st data segment<br />

2 nd data segment<br />

Sequence number<br />

Length<br />

2. What should be the ACK number acknowledging the second segment sent from client?<br />

___________<br />

3. Is this the same as the ACK number sent at event 276? ___________<br />

4. How many more segments did the server send before closing a connection? ___________<br />

5. How many bytes of data did the server send? ___________<br />

6. What was the actual Maximum Segment Size? ___________<br />

7. Is the number of segments sent by the server the same as the one you predicted in step 7 of<br />

Examine Network Configuration section?<br />

___________<br />

Examine Connection Termination<br />

1. Which side starts the connection termination process?<br />

hint: look for FIN segments<br />

___________<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

5


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

2. At what event did the other side send a FIN segment? ___________<br />

3. At what event was the connection finally closed on the client? ___________<br />

4. At what event was the connection finally closed on the server? ___________<br />

5. Click on Close to close the Simulation Execution window.<br />

END OF LAB 1<br />

Examine Congestion Window (Homework Lab)<br />

We want to determine the final congestion window on the server side before the session was closed.<br />

In step 4 above, we hope you determined that the connection was finally closed at event 458.<br />

Let’s run the simulation again, stop the simulation just before this event <strong>and</strong> print the congestion<br />

window.<br />

Recall that congestion window is printed from the diagnostic block of tcp_conn_v3.pr.m, so in order<br />

to print the state we will need to get the process model ID of tcp_conn_v3.pr.m on the server.<br />

1. Run the simulation in the ODB again following steps 1-2 from the section Run the Simulation<br />

in ODB above. Again, click on the Console tab if you do not see the console.<br />

2. Stop the simulation at event 458:<br />

a. Type evstop 458 in the simulation console window <strong>and</strong> press the Enter key. This will set a<br />

breakpoint to stop the simulation before event 458 is executed.<br />

b. Type cont in the simulation console window <strong>and</strong> press the Enter key to run the simulation<br />

until the above breakpoint is reached. Alternatively, you may click on the Continue button.<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

6


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

3. Get the process ID of the <strong>TCP</strong> process models on the server.<br />

a. The simulation has been stopped before an interrupt is delivered to the <strong>TCP</strong> module on the<br />

server. Locate tcp module on the server in the upper left pane:<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

7


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

b. tcp_conn_v3 process model is a child process of the tcp_manager_v3 process model. Exp<strong>and</strong><br />

tcp module (click on + sign) <strong>and</strong> tcp_manager process (click on + sign) to get a list of <strong>TCP</strong><br />

connection process models on the node:<br />

4. What is the process ID of the active <strong>TCP</strong> process on server? ___________<br />

5. Type prodiag 53 in the Simulation Console to get connection state information just before the<br />

session is closed. You should see the following output:<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

8


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

6. At what state is the connection? ___________<br />

7. What is the size of congestion window? (Hint: cwnd variable is used to store the congestion<br />

window)<br />

___________<br />

8. Is there any unsent data in the send or retransmission buffer? ___________<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

9


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

9. Type cont in the Simulation Execution window or click on the Continue button to let the<br />

simulation complete.<br />

10. Click on Close to close the Simulation Execution window.<br />

Examine Packet Content (Homework Lab)<br />

Client received ACK of SYN (as well as a SYN) at event 172. Let us examine its content.<br />

1. Run the simulation again, <strong>and</strong> stop it before event 172 is executed, by typing the following in the<br />

Simulation Execution console:<br />

evstop 172<br />

cont<br />

2. You can see that <strong>TCP</strong> is about to receive a packet with ID = 3. Print the packet content.<br />

a. Click on the Packet Content tab in the lower right pane of the Simulation Execution window<br />

<strong>and</strong> specify Packet ID as 3. Press the Enter key.<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

10


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

b. The packet content is printed in the same pane:<br />

3. What is the ACK number carried in the header of this segment? ____________<br />

4. Does the segment contain any data? ____________<br />

5. Are there any flags set in the <strong>TCP</strong> header? ____________<br />

6. What <strong>TCP</strong> options does the segment contain? ____________<br />

7. Type cont to complete the simulation. Close all the windows. Close the project.<br />

Summary<br />

You have seen how OPNET Debugger can help you underst<strong>and</strong> the model behavior.<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

11


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Lab 2: <strong>TCP</strong> Flavor Comparison<br />

Background<br />

<strong>TCP</strong> detects a packet loss when:<br />

• Retransmission timer expires, or<br />

• n-th duplicate acknowledgement is received for the connection.<br />

<strong>TCP</strong> flavors differ in how they respond to packet loss. While all <strong>TCP</strong> implementations reset the<br />

congestion window after retransmission timeout expiration to one maximum segment size (MSS),<br />

they may proceed differently after duplicate ACKs are received. The missing segment is always<br />

resent immediately, but transmission of new or unacknowledged data depends on the selected flavor.<br />

We will compare the following flavors:<br />

• Tahoe—Fast retransmit followed by slow start<br />

• Reno—Fast retransmit followed by fast recovery<br />

• New Reno—Similar to Reno, but does not halve congestion window multiple times during<br />

recovery process<br />

• Selective acknowledgement (SACK)—Selective retransmission based on received selective<br />

acknowledgements<br />

• Reno with Explicit Congestion Notification (ECN) – similar to Reno, but has ability to<br />

process congestion notification from network upon which it performs fast recovery<br />

Objective<br />

We will study <strong>TCP</strong> behavior after three segments are dropped from the same window of data. The<br />

following graph shows the sequence numbers of sent <strong>and</strong> dropped segments.<br />

Dropped<br />

segments<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

12


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

For each of the modeled <strong>TCP</strong> flavors, we will examine:<br />

• Segment retransmission process (the order in which segments are retransmitted)<br />

• The reason why segments get retransmitted—fast recovery vs. expiration of retransmission<br />

timeout timer<br />

• Congestion window after drops<br />

We will compare:<br />

• Application response time<br />

Network <strong>Model</strong><br />

Network Description<br />

The workstation downloads a 30,000-byte file from the server. <strong>TCP</strong> Maximum Segment Size is 536<br />

Bytes. The packet analyzer is used to drop selected segments <strong>and</strong> collect statistics.<br />

Main Configuration Steps<br />

• Examine network configuration<br />

• Configure <strong>TCP</strong> Reno on hosts, run the simulation, collect <strong>and</strong> analyze results<br />

• Configure <strong>TCP</strong> SACK on hosts, run the simulation, collect <strong>and</strong> analyze results<br />

• Run simulation for <strong>TCP</strong> Tahoe, <strong>TCP</strong> New Reno <strong>and</strong> <strong>TCP</strong> Reno with ECN<br />

• Compare response time across scenarios<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

13


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Instructions<br />

Examine Network Configuration<br />

The basic configuration is the same across all scenarios. We will be only changing the <strong>TCP</strong> flavor.<br />

1. Start OPNET <strong>Model</strong>er.<br />

2. Open project 1508_lab2; scenario Reno opens. This scenario has been fully configured for you.<br />

3. Examine <strong>TCP</strong> configuration.<br />

Workstation <strong>and</strong> server have been configured identically. Open the <strong>TCP</strong> Parameters attribute<br />

on one of them, <strong>and</strong> check the following:<br />

a. Receive Buffer is set to 65,535 bytes. Since this value is greater than the size of transmitted<br />

file, the size of the <strong>TCP</strong> receive buffer will never prevent data from being sent.<br />

b. Maximum ACK Delay is 0.001 sec. This will cause ACKs to be sent almost immediately<br />

after receiving a segment.<br />

c. Maximum Segment Size is set to 536 bytes.<br />

This also implies that congestion window will be increasing in increments of 536 Bytes.<br />

d. Slow-Start Initial Count (MSS) is set to 2 segments.<br />

4. Examine packet analyzer configuration.<br />

The <strong>TCP</strong> Packet Analyzer node can be used to selectively drop segments <strong>and</strong> to introduce<br />

additional network delay to the segment. Segments to be dropped are identified by their order<br />

(e.g., first segment, second…) In this lab, three segments (23, 27, <strong>and</strong> 28) are dropped by the<br />

analyzer_svr_wkstn node.<br />

a. Edit attribute on analyzer_svr_wkstn <strong>and</strong> observe the following configuration for Segment<br />

Discard List.<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

14


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

5. Select “DES->Choose Individual Statistics” to open the Choose Results window. Take note of<br />

the selected <strong>TCP</strong> statistics. We will collect:<br />

• Application response time<br />

• Size of <strong>TCP</strong> congestion window on server<br />

• Sequence number of dropped <strong>and</strong> forwarded segments on the traffic analyzer<br />

a. Right-click in the project editor <strong>and</strong> select<br />

Choose Individual DES Statistics to see the selected statistics.<br />

b. Exp<strong>and</strong> Node Statistics <strong>and</strong> then <strong>TCP</strong> Connection.<br />

c. Click on Congestion Window Size (bytes) to see the details.<br />

d. Ensure that the Collection mode is All values.<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

15


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Configure <strong>TCP</strong> Reno on Hosts, Run the Simulation, <strong>and</strong> Collect Results<br />

1. <strong>TCP</strong> Reno supports fast retransmission <strong>and</strong> fast recovery.<br />

a. Fast Recovery has been already enabled on both the workstation <strong>and</strong> the server by setting<br />

<strong>TCP</strong> -> <strong>TCP</strong> Parameters -> Fast Recovery to Reno:<br />

2. Run the simulation.<br />

a. Click on the Configure/Run Discrete Event Simulation (DES) button.<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

16


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

b. Click Run.<br />

c. When the simulation is completed, click Close to dismiss the simulation window.<br />

3. Load statistics into the provided templates.<br />

There are two statistics that we will analyze further:<br />

• <strong>TCP</strong> Congestion Window Size collected on the server<br />

• Sequence Numbers of <strong>TCP</strong> Segments that were<br />

o forwarded by packet analyzer<br />

o dropped by the analyzer<br />

The panels for the above statistics have been already created for you.<br />

a. Display the provided templates by clicking on the Hide/Show Graph Panels button.<br />

Two panels should appear.<br />

b. Select “DES->Panel Operations->Reload Data Into All Panels” to reload the panels.<br />

4. You will get the following results:<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

17


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Results Analysis<br />

Congestion Window<br />

Examine <strong>TCP</strong> Connection.Congestion Window Size (bytes) graph to answer the following.<br />

To get an exact value, position your mouse in the desired region, <strong>and</strong> read the tooltip for the Nearest<br />

Point:<br />

1. What was the congestion window size before the packet loss was detected? ___________<br />

2. What did the congestion window size value change to after detecting packet loss? _________<br />

3. Why did the congestion window keep increasing after the loss was detected? ___________<br />

4. Why did the congestion window stay flat for a large period? ___________<br />

5. How did the server recover from packet loss—using fast retransmit or timeout retransmission?<br />

______________<br />

6. How many times was a slow start performed during the session lifetime? ___________<br />

Retransmission Pattern<br />

Examine sequence number of forwarded <strong>and</strong> dropped segments graph to answer the following.<br />

To get an exact value, position your mouse in the desired region <strong>and</strong> read the tooltip for the Nearest<br />

Point.<br />

7. How many segments were retransmitted? ___________<br />

8. Were any segments retransmitted unnecessarily? ___________<br />

9. When was the last segment sent? ___________<br />

Detailed Analysis (Homework)<br />

The size of the congestion window just before fast retransmission was 12,864 bytes. The congestion<br />

window after fast retransmission is reset to<br />

12,864 / 2 + 3 * MSS = 6,432 + 3 * 536 = 8, 040<br />

Note: In this calculation, when the congestion window is halved, it is rounded down to an integral<br />

multiple of the MSS. In this example, 12,864 is 24 * 536, the result of the division is also an integral<br />

multiple of the MSS. If the window had been 23 * 536 = 12,328, then the result would be 11.5 *<br />

536 = 6,164, which must be rounded down to 11 * 536 = 5,895.<br />

The sender then continues receiving more duplicate ACKs <strong>and</strong> increases its congestion window by<br />

one MSS for each ACK. At time 1.086 seconds, the ACK for retransmitted segment 23 takes the<br />

server out of fast recovery <strong>and</strong> the congestion window is set to half of the pre-fast retransmission<br />

value. The sender then receives 3 duplicate ACKs for segment 26 <strong>and</strong> resends segment 27 using the<br />

fast retransmission algorithm. However, because the server does not receive more ACKs, its<br />

congestion window could not increase further. To be able to send more data, it has to wait for the<br />

retransmission timer to expire. This increases application response time considerably.<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

18


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Configure <strong>TCP</strong> SACK on Hosts, Run the Simulation, <strong>and</strong> Collect Results<br />

1. Select Scenarios -> Switch to Scenario to switch to scenario SACK.<br />

2. <strong>TCP</strong> SACK supports fast retransmission <strong>and</strong> fast recovery.<br />

<strong>TCP</strong> SACK has been enabled <strong>and</strong> Fast Recovery has been set to Reno on both the workstation<br />

<strong>and</strong> the server:<br />

3. Repeat steps 2 through 3 from page 16 to run the simulation, <strong>and</strong> load results into templates. You<br />

should see the following results:<br />

Results Analysis<br />

Congestion Window<br />

1. What was the congestion window size before the packet loss was detected? ___________<br />

2. What did the congestion window size value change to after detecting packet loss? _________<br />

3. Why didn’t the congestion window change after retransmission? _______________________<br />

______________<br />

Retransmission Pattern<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

19


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

4. How many segments were retransmitted? ___________<br />

5. Were any segments retransmitted unnecessarily? ___________<br />

6. When is the last segment sent? ___________<br />

Detailed Analysis (Homework)<br />

Similar to the flavors we have already examined, <strong>TCP</strong> SACK retransmits segment 23 using the fast<br />

retransmit algorithm. However, it uses a different approach to determine when <strong>and</strong> which packets are<br />

sent out during fast recovery. It calculates the amount of in-flight data based on selective<br />

acknowledgements that it has received. Data can be sent only if the amount of outst<strong>and</strong>ing data is<br />

lower than the size of the congestion window. Because it has information about which segments<br />

were received, it is able to resend only missing segments <strong>and</strong> then continue with transmission of<br />

unsent data.<br />

Run Simulation for <strong>TCP</strong> Tahoe, <strong>TCP</strong> New Reno <strong>and</strong> <strong>TCP</strong> Reno with ECN Support<br />

1. Select Scenarios -> Manage Scenario.<br />

2. Set “Results” to “collect” for Tahoe, new Reno <strong>and</strong> ECN scenarios.<br />

3. Click OK to run the simulations.<br />

4. Click Close after simulation completes.<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

20


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Comparison across Scenarios<br />

Let us now compare the results across scenarios.<br />

Application Statistics<br />

Examine Client FTP.Download Response Time statistics available on a graph in the last scenario.<br />

Repeat step 3 from page 17.<br />

1. Which flavor results in the lowest application response time? ___________<br />

2. Which two flavors tie for second place in application response time? ___________<br />

3. Which flavor results in the highest response time <strong>and</strong> why? ___________<br />

__________________________________________________________________________<br />

4. Why do you think <strong>TCP</strong> Reno with ECN support outperformed all other <strong>TCP</strong> flavors?<br />

__________________________________________________________________________<br />

5. Why do you think <strong>TCP</strong> Reno performed worse than <strong>TCP</strong> Tahoe, which does not use fast<br />

recovery?<br />

___________<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

21


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Summary<br />

We have seen how packets are retransmitted <strong>and</strong> the congestion window is calculated depending on<br />

a selected <strong>TCP</strong> flavor.<br />

We can observe that <strong>TCP</strong> Reno with ECN support outperforms <strong>TCP</strong> SACK <strong>and</strong> New Reno, while<br />

Reno has the worst response time for this case. Moreover, Reno is even “slower” than Tahoe. This<br />

may be surprising, because Reno was designed as an improvement over Tahoe. However, this is<br />

because Reno is optimized for networks with a small packet discard ratio, whereas we presented a<br />

case in which multiple packets were dropped from the same window of data. The reason that <strong>TCP</strong><br />

Reno with ECN support offers the best response time is that in this case no packets are actually<br />

dropped.<br />

Note:<br />

For a comparison, we have also executed simulations in which only one segment is dropped<br />

(segment 23). In this case, Reno should perform better than Tahoe. That this is indeed the case can<br />

be seen from the graph below.<br />

END OF LAB 2<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

22


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Homework Lab 2<br />

In this lab you will finish our analysis of the selected <strong>TCP</strong> flavors <strong>and</strong> compare their response to<br />

three packet drops from the same window of data.<br />

Main Steps<br />

• Analyze <strong>TCP</strong> Tahoe behavior<br />

• Analyze <strong>TCP</strong> New Reno behavior<br />

• Analyze <strong>TCP</strong> Reno with ECN support behavior.<br />

• Compare response time across scenarios.<br />

Analyze <strong>TCP</strong> Tahoe<br />

2. Select Scenarios -> Switch to Scenario to switch to scenario Tahoe.<br />

3. <strong>TCP</strong> Tahoe supports fast retransmission <strong>and</strong> resets the congestion window to one MSS after<br />

segment retransmission. Check that Fast Retransmission is enabled <strong>and</strong> Fast Recovery is<br />

disabled. Your <strong>TCP</strong> settings on the workstation <strong>and</strong> server are shown below.<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

23


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

3. Repeat steps 2 through 3 from page 16 to run the simulation, <strong>and</strong> load results into templates.<br />

You should see the following results:<br />

Retransmitted<br />

segments<br />

Results Analysis<br />

Congestion Window<br />

Examine <strong>TCP</strong> Connection.Congestion Window Size (bytes) graph to answer the following.<br />

To get an exact value, position your mouse in the desired region <strong>and</strong> read the tooltip for the Nearest<br />

Point:<br />

1. What was the congestion window size before the packet loss was detected? ___________<br />

2. What did the congestion window size value change to after detecting packet loss? _________<br />

3. How did the server recover from packet loss, by using fast retransmit or timeout retransmission?<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

24


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

___________<br />

4. How many times was a slow start performed during the session lifetime? ___________<br />

Retransmission Pattern<br />

Examine Sequence number of forwarded <strong>and</strong> dropped segments graph to answer the following.<br />

5. How many segments were retransmitted? ___________<br />

6. Were any segments retransmitted unnecessarily? ___________<br />

7. When was the last segment sent? ___________<br />

Detailed Analysis<br />

Sequence Numbers <strong>and</strong> ACK Numbers<br />

Note: Segments are identified by their segment sequence numbers (e.g., segment 1, 2…) In the<br />

following text, the term “ACK for segment X” means that segment X has been received successfully<br />

<strong>and</strong> the next expected segment is segment X + 1.<br />

The server retransmits segment 23 after it has received a third duplicate ACK <strong>and</strong> set its congestion<br />

window to one MSS. After the client receives the retransmitted segment, it also processes the<br />

previously received segments 24, 25, <strong>and</strong> 26 <strong>and</strong> sends an ACK acknowledging segments 23 through<br />

26. This allows the receiver to increase its congestion window to 2 <strong>and</strong> resend segments 27 <strong>and</strong> 28.<br />

The ACK for segment 27 increases the server’s congestion window to 3 <strong>and</strong> segments 29 <strong>and</strong> 30 can<br />

be resent. The ACK for segment 28 acknowledges all segments up through segment 46 (which has<br />

sequence number 24,121). (These segments had been sent before the server received the third<br />

duplicate ACK <strong>and</strong> cut the congestion window.) The server then continues sending unsent data, but<br />

with the reduced congestion window.<br />

Notice that segments 29 <strong>and</strong> 30 were unnecessarily retransmitted, <strong>and</strong> <strong>TCP</strong> Tahoe recovers from the<br />

packet lost without retransmission timeout expiration.<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

25


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Analyze <strong>TCP</strong> New Reno<br />

4. Select Scenarios -> Switch to Scenario to switch to scenario New_Reno.<br />

5. <strong>TCP</strong> New Reno supports fast retransmission <strong>and</strong> fast recovery. However, contrary to <strong>TCP</strong> Reno,<br />

it halves the congestion window only once during recovery process.<br />

a. Fast Recovery has been already enabled on both the workstation <strong>and</strong> the server by setting<br />

<strong>TCP</strong> Parameters->Fast Recovery to New Reno:<br />

3. Repeat steps 2 through 3 from page 16 to run the simulation, <strong>and</strong> load results into templates. You<br />

should see the following results:<br />

Results Analysis<br />

Congestion Window<br />

Examine <strong>TCP</strong> Connection.Congestion Window Size (bytes) graph to answer the following.<br />

To get an exact value, point the mouse to the desired point <strong>and</strong> read the tooltip.<br />

1. What was the congestion window size before the packet loss was detected? ___________<br />

2. What did the congestion window size value change to after detecting packet loss? _________<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

26


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

3. How did the server recover from packet loss, by using fast retransmit or timeout retransmission?<br />

______________<br />

4. How many times was a slow start performed during the session lifetime? ___________<br />

Retransmission Pattern<br />

Examine sequence number of forwarded <strong>and</strong> dropped segments graph to answer the following.<br />

5. How many segments were retransmitted? ___________<br />

6. Were any segments retransmitted unnecessarily? ___________<br />

7. When is the last segment sent? ___________<br />

Detailed Analysis<br />

The size of the congestion window just before fast retransmission was 12,328 bytes. After fast<br />

retransmission, the congestion window is reset to<br />

12,864 / 2 + 3 * MSS = 6,432 + 3 * 536 = 8, 040<br />

Note: In this calculation, when the congestion window is halved, it is rounded down to an integral<br />

multiple of the MSS. In this example, 12,864 is 24 * 536, the result of the division is also an integral<br />

multiple of the MSS. If the window had been 23 * 536 = 12,328, then the result would be 11.5 *<br />

536 = 6,164, which must be rounded down to 11 * 536 = 5,895.<br />

Note: 12,328/2 is rounded down to the increments of MSS, rather than to the actual value (6,164).<br />

The process then continues receiving more duplicate ACKs <strong>and</strong> increases its congestion window by<br />

one MSS for each received ACK. Unlike in Reno, the ACK for the retransmitted segment 23 does<br />

not take New Reno out of the recovery process. New Reno will keep increasing its congestion<br />

window for each received ACK until the ACK for the last segment sent before retransmission is<br />

received (which is segment 46). When the client receives the retransmitted segment 28, then it will<br />

send an acknowledgement for all the outst<strong>and</strong>ing segments. When the sender gets this<br />

acknowledgement, fast recovery ends, <strong>and</strong> the sender enters slow start.<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

27


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Analyze <strong>TCP</strong> Reno with Explicit Congestion Notification<br />

1. Select Scenarios -> Switch to Scenario to switch to scenario ECN.<br />

2. Make sure that ECN has been enabled on both the sender <strong>and</strong> the receiver:<br />

3. Open the attributes window for the analyzer_svr_wkstn node. Notice that the packet dropper<br />

was configured to mark packets rather than drop them:<br />

4. Repeat the steps 2 <strong>and</strong> 3 from page 16 to load results into templates. You should see the<br />

following results:<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

28


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Results Analysis<br />

Congestion Window<br />

1. What was the congestion window size before the congestion was detected? ___________<br />

2. After congestion was detected, what was the new size of the congestion window? _________<br />

3. Did the traffic analyzer drop any segments? _______________________<br />

Retransmission Pattern<br />

4. How many segments were retransmitted? ___________<br />

Detailed Analysis<br />

Notice that the packet analyzer did not drop any segments, but the sender reacted to the congestion<br />

notification by decreasing the congestion window. It did not have to retransmit the segment though,<br />

because the segment was received by the client.<br />

Comparison across Scenarios<br />

Let us now compare the results across scenarios.<br />

Congestion Window<br />

1. Which <strong>TCP</strong> flavor had to use timeout retransmission to recover from loss? ___________<br />

Retransmission Pattern<br />

2. Which <strong>TCP</strong> flavor(s) retransmitted packets unnecessarily? ___________<br />

3. Which <strong>TCP</strong> flavor did not have to retransmit at all? ___________<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

29


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

30


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Lab 3: Interfacing a Custom Lower Layer to <strong>IP</strong><br />

Overview<br />

The OPNET <strong>IP</strong> model has an open API that allows any custom MAC layer to interface with <strong>IP</strong>. In<br />

this lab you will interface a simple MAC layer to <strong>IP</strong>. Any lower layer interfacing with <strong>IP</strong> must<br />

perform the following four steps.<br />

• Address assignment<br />

• Process Registry<br />

• H<strong>and</strong>le packets coming from <strong>IP</strong><br />

• H<strong>and</strong>le packets coming in from the network<br />

Objectives<br />

• Interface the simple_mac MAC model to <strong>IP</strong><br />

• Use a test network to verify proper operation<br />

Instructions<br />

The simple_mac Process<br />

The simple_mac process provides a custom lower layer which can be interfaced with the <strong>IP</strong><br />

layer. This process will be used throughout this lab.<br />

1. Open the process model simple_mac present in the C:\op_models directory.<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

31


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Initialization: Address Assignment<br />

Each MAC process in the network must have a unique integer address. This address may be<br />

manually assigned via an attribute or programmatically generated. The simple_mac process uses the<br />

OPNET auto-addressing package called oms_aa to assign addresses. This package is capable of<br />

assigning unique integer addresses to all or some of the nodes in the network. More information<br />

about this package is available in the session material of 1528–Accelerating <strong>Model</strong> Development<br />

with OPNET’s <strong>Model</strong> Support Libraries. The address must be assigned before proceeding to the<br />

next step (process registry).<br />

Initialization: Process Registry<br />

In this step, the MAC process must publish its address in the model-wide process registry so that the<br />

ARP module in each node can learn the MAC address. This information is later used to translate <strong>IP</strong><br />

addresses to MAC addresses.<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

32


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

The MAC process must set the following two attributes:<br />

Attribute Name Attribute Type Attribute Value<br />

“protocol” OMSC_PR_STRING “mac”<br />

“address” OMSC_PR_INT64 MAC address<br />

The MAC process must publish these attributes by the third interrupt, because the ARP process<br />

performs discovery in the fourth interrupt.<br />

In the simple_mac process, this registry is occurring in the function<br />

simple_mac_oms_process_register (), which is called from the exit execs of the<br />

Register state. You can look at the function block (Code Blocks / Function Block or button) of<br />

the process to see the call to oms_pr_process_register ().<br />

H<strong>and</strong>ling a Packet from <strong>IP</strong><br />

H<strong>and</strong>ling a packet from <strong>IP</strong> involves the following steps:<br />

• Identify an <strong>IP</strong> packet<br />

• Determine the destination MAC address to which the packet needs to be sent<br />

• Encapsulate the <strong>IP</strong> datagram in a MAC packet with the appropriate header<br />

• Send the MAC packet to the transmitter<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

33


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Identifying an <strong>IP</strong> Packet<br />

When the simple_mac process model receives a stream interrupt, it needs to decide whether the<br />

packet is from the ARP layer or from the receiver. This is done based on the input stream index.<br />

Refer to the transition macros PACKET_FROM_<strong>IP</strong> <strong>and</strong> PACKET_FROM_NTWK defined in the Header<br />

block (Code Blocks / Header Block or button) of the process model. The relevant lines are<br />

reproduced below.<br />

/***** Transition Macros ******/<br />

#define PACKET_FROM_<strong>IP</strong> (in_strm == SMC_IN_STRM_INDEX_FROM_ARP)<br />

#define PACKET_FROM_NTWK (in_strm == SMC_IN_STRM_INDEX_FROM_RCV)<br />

/* Macro corresponding to stream indices */<br />

#define SMC_OUT_STRM_INDEX_TO_ARP 0<br />

#define SMC_OUT_STRM_INDEX_TO_XMT 1<br />

#define SMC_IN_STRM_INDEX_FROM_ARP 0<br />

#define SMC_IN_STRM_INDEX_FROM_RCV 1<br />

Note: The stream indices do not have to be hard-coded like this. Instead the MAC process can<br />

perform a graph walk at initialization <strong>and</strong> determine these values <strong>and</strong> store them as state variables.<br />

This approach was not used for this lab for the sake of simplicity.<br />

Determining the Destination MAC Address<br />

Every packet from the ARP layer will have an ICI of type ip_mac_req associated with the stream<br />

interrupt. The destination address of the packet will be specified in the dest_addr field of the ICI.<br />

Note:<br />

• Since the ARP module reuses the ICI, the MAC layer SHOULD NOT destroy the ICI after<br />

h<strong>and</strong>ling the packet.<br />

• For broadcast packets, the dest_addr field will be set to <strong>IP</strong>C_PHYS_ADDR_BROADCAST.<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

34


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Coding Changes<br />

Make the Necessary Coding Changes to H<strong>and</strong>le a Packet from <strong>IP</strong><br />

1. Open the function block (Code Blocks / Function Block or button) of the simple_mac<br />

process model.<br />

2. Scroll down to the simple_mac_packet_from_ip_h<strong>and</strong>le function (line 105).<br />

3. Edit the function as follows. (Lines to be added are in bold).<br />

FIN (simple_mac_packet_from_ip_h<strong>and</strong>le (ip_pkptr));<br />

/* Get the ici associated with the interrupt. The */<br />

/* destination address of the packet will be specified */<br />

/* in the ici. */<br />

arp_ici_ptr = op_intrpt_ici ();<br />

/* Get the destination address from the ici. */<br />

op_ici_attr_get_int32 (arp_ici_ptr, "dest_addr", &dest_addr);<br />

/* Print a trace Message */<br />

if (SMC_LTRACE_ACTIVE)<br />

{<br />

sprintf (msg, "Destination Address: %d", dest_addr);<br />

op_prg_odb_print_major ("Received a Packet from <strong>IP</strong>",<br />

msg, OPC_NIL);<br />

}<br />

/* Create the MAC Packet. */<br />

mac_pkptr = op_pk_create_fmt ("simple_mac");<br />

/* Set the source <strong>and</strong> dest addresses in the packet */<br />

op_pk_nfd_set_int32 (mac_pkptr, "source address", my_address);<br />

op_pk_nfd_set_int32 (mac_pkptr, "dest address", dest_addr);<br />

/* Encapsulate the <strong>IP</strong> Datagram in the MAC Packet */<br />

op_pk_nfd_set_pkt (mac_pkptr, "data", ip_pkptr);<br />

/* Send the packet out to the transmitter. */<br />

op_pk_send (mac_pkptr, SMC_OUT_STRM_INDEX_TO_XMT);<br />

FOUT;<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

35


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Sending a Packet to <strong>IP</strong><br />

The MAC process receives a packet from the network, it decapsulates the <strong>IP</strong> packet from the MAC<br />

packet <strong>and</strong> sends it to the ARP module. No ICIs are involved here. In the simple_mac process model<br />

this is performed in the function simple_mac_packet_from_ntwk_h<strong>and</strong>le (no need to<br />

make any coding changes):<br />

FIN (simple_mac_packet_from_ntwk_h<strong>and</strong>le (mac_pkptr));<br />

/* Decapsulate the <strong>IP</strong> datagram from the packet. */<br />

op_pk_nfd_get (mac_pkptr, "data", &ip_pkptr);<br />

/* Print a trace Message */<br />

if (SMC_LTRACE_ACTIVE)<br />

{<br />

/* Get the source address from the packet */<br />

op_pk_nfd_get (mac_pkptr, "source address",<br />

&source_address);<br />

sprintf (msg, "Source Address: %d", source_address);<br />

op_prg_odb_print_major ("Received a Packet from the”<br />

“Network", msg, OPC_NIL);<br />

}<br />

/* Send the packet to the higher layer. */<br />

op_pk_send (ip_pkptr, SMC_OUT_STRM_INDEX_TO_ARP);<br />

/* Destroy the MAC packet. */<br />

op_pk_destroy (mac_pkptr);<br />

FOUT;<br />

Save <strong>and</strong> Compile the Process <strong>Model</strong><br />

1. Save <strong>and</strong> compile the process model.<br />

2. If you are having problems in compilation, you may<br />

a. Close the simple_mac process model.<br />

b. Open the simple_mac_ref process model.<br />

c. Save it as simple_mac.<br />

d. Recompile.<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

36


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Test the Network<br />

Open the Test Project<br />

We will now use a simple network to verify that the MAC layer is working correctly.<br />

1. Open the project 1508_lab_3. If you did not make the coding changes to the simple_mac<br />

process model, you may use the 1508_lab_3_Ref project.<br />

The project should open up in the scenario named simple_ping_network.<br />

Network Description<br />

The network consists of two nodes of type simple_mac_wkstn connected to each other. A ping<br />

dem<strong>and</strong> has also been configured from wkstn_1 to wkstn_2. The MAC <strong>and</strong> the <strong>IP</strong> addresses on both<br />

the nodes are set to Auto Assigned. The simulation <strong>IP</strong> auto-addressing package works with custom<br />

wireline MAC layers also. Shown below are the attributes for the wkstn_1 <strong>and</strong> wkstn_2 nodes<br />

which effect <strong>IP</strong> addressing. These attributes can be accessed by right-clicking on the node <strong>and</strong><br />

selecting Edit Attributes.<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

37


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Run the Simulation in ODB<br />

1. Click on the Configure / Run Discrete Event Simulation action button.<br />

2. In the treeview on the left, go to Execution / OPNET Debugger.<br />

3. Check the Use OPNET Simulation Debugger (ODB) checkbox in the right panel.<br />

4. Click Run.<br />

When the simulation starts you will see a single Simulation Execution window open. Inside this<br />

window, three tabs are defined: the Console tab provides an interface for the ODB comm<strong>and</strong>s<br />

<strong>and</strong> output, the Progress tab displays information about the overall simulation progress, <strong>and</strong> the<br />

<strong>Model</strong> tab allows the user an interactive view of the network where nodes can easily be selected<br />

for graphical debugging.<br />

5. Select the Console tab so further debugging can be accomplished on this scenario.<br />

Inspect Trace Messages<br />

We will run the simulation with a trace on the label simple_mac so that we can see the debug<br />

messages printed out by the simple_mac process model.<br />

1. In the ODB console (the ODB> box), enter the following comm<strong>and</strong>s:<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

38


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

a. tstop 105 (<strong>and</strong> then Enter). This comm<strong>and</strong> sets a breakpoint for 105 seconds. Our<br />

ping traffic starts at 100 seconds, so this is a good place to stop.<br />

b. ltrace simple_mac (<strong>and</strong> then Enter). This comm<strong>and</strong> enables trace for the label<br />

simple_mac.<br />

c. cont (<strong>and</strong> then Enter). This comm<strong>and</strong> executes the simulation until a breakpoint.<br />

Examine the trace messages.<br />

2. Complete the simulation.<br />

a. cont (<strong>and</strong> then Enter).<br />

3. Close the simulation window once the simulation has finished.<br />

Ping Results<br />

The record route option was enabled for the ping dem<strong>and</strong>. An output table entry is created<br />

corresponding to each successful ping dem<strong>and</strong>. Verify that there is an entry corresponding to the<br />

ping dem<strong>and</strong>.<br />

Verify Ping Results<br />

1. Click on the View Results action button (or right-click in the project workspace <strong>and</strong> select<br />

View Results) to open up the view results dialog box.<br />

2. In the window that opens, click on the DES Run (1) Table tab.<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

39


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

3. Select the Ping Report from the left treeview <strong>and</strong> click Show.<br />

Note that the ping dem<strong>and</strong> was successful.<br />

Larger Network Scenario<br />

The project also contains a second scenario named Larger_Network that consists of several<br />

simple_mac <strong>and</strong> ppp_wkstns connected using routers. Ping dem<strong>and</strong>s have been configured between<br />

many nodes.<br />

Switch to the Scenario Named Larger_Network<br />

1. Select Scenarios / Switch to Scenario / Larger_Network.<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

40


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Run the Simulation<br />

1. Select DES / Run Discrete Event Simulation.<br />

2. After the simulation completes, click Close.<br />

Verify Ping Results<br />

1. Click on the View Results action button to open up the view result dialog box.<br />

2. Click on the DES Run (1) Table tab.<br />

Note that there are Ping Reports corresponding to all the ping dem<strong>and</strong>s in the network.<br />

This shows that <strong>IP</strong> can route between different interface types.<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

41


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

END OF LAB 3<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

42


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Lab 1 Answers: Tracing <strong>TCP</strong> Connection<br />

Examine Network Configuration<br />

3. What is the Slow Start Initial Count (MSS)? 2<br />

4. How many <strong>TCP</strong> segments will be sent after the connection is established? 2<br />

5. What is the Maximum Segment Size? 1460 Bytes<br />

6. Estimate how many <strong>TCP</strong> data segments will be used to send 5,000 Bytes? 4<br />

Examine 3-Way H<strong>and</strong>shake<br />

4. Scroll up to the first event that gets printed. You can see that the server opens a connection at<br />

time 0.<br />

a. Is this a passive or active connection? Passive<br />

b. What is the local port number used by the server? 20<br />

c. When did the client receive an OPEN request from the application? At time 101sec,<br />

event 125<br />

5. What are the sequence numbers of the packets comprising 3-way h<strong>and</strong>shake?<br />

a. First segment: 25250000<br />

b. Second segment: 25250001<br />

c. Third segment: 25250001<br />

6. Were any options set in the SYN packets? Yes, MSS <strong>and</strong> SACK-Permitted<br />

Examine Slow Start<br />

1. Server’s <strong>TCP</strong> process then sends its first application data.<br />

a. How many segments are sent out at the beginning? 2<br />

b. How is this related to the Slow Start Initial Count from step 3b of the Examine Network<br />

Configuration section?<br />

It is equal.<br />

c. What are the sequence numbers <strong>and</strong> data length of the first 2 segments?<br />

Sequence number<br />

Length<br />

1 st data segment 25250002 1460<br />

2 nd data segment 25251462 1460<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

43


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

2. What should be the ACK number of the next segment sent from client? 25252922<br />

3. Is this the same as the ACK number sent at event 260? Yes.<br />

4. How many more segments did the server send before closing a connection? 2<br />

5. How many bytes of data did the server send? 5008<br />

6. What was the actual Maximum Segment Size? 1460<br />

7. Is the number of segments sent by the server the same as you predicted ? It should be 4<br />

Examine Connection Termination<br />

1. Which side starts the connection termination process? server<br />

2. When did client send a FIN segment? At event 400<br />

3. When was the connection finally closed on the client? At event 461<br />

4. When was the connection finally closed on the server? At event 463<br />

Examine Congestion Window (Homework Lab)<br />

4. What is the process ID of the active <strong>TCP</strong> process on server? 53<br />

6. What state is the connection at? TIME_WAIT<br />

7. What is the size of the congestion window? 7,300 Bytes or 5<br />

segments<br />

8. Is there any unsent data in the send or retransmission buffer? No, send buffer size is 0<br />

Examine Packet Content (Homework Lab)<br />

3. What is the ACK number of this segment? 25250001<br />

4. Does it contain any data? No<br />

5. Are there any flags set in the <strong>TCP</strong> header? Yes, SYN <strong>and</strong> ACK flags<br />

6. What options does it contain? MSS, SACK-Permitted<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

44


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

Lab 2 Answers: <strong>TCP</strong> Flavor Comparison<br />

<strong>TCP</strong> Reno:<br />

1. What was the congestion window before the packet loss was detected? 12,864 Bytes<br />

2. What was the congestion window after the loss was detected? 8,040 Bytes<br />

3. Why did the congestion window keep increasing after the loss was detected?<br />

This is due to the arrival of duplicate ACKs.<br />

4. Why did the congestion window stay flat for a large period?<br />

Sender could not send new data, it had to wait for a retransmission timer to expire<br />

Note: You can typically conclude this whenever you see a large gap when no data is sent.<br />

5. How did the server recover from packet loss – using fast retransmit or timeout retransmission?<br />

Retransmission timeout expiration<br />

6. How many times was a slow start performed during the session lifetime?<br />

Twice – when the session started <strong>and</strong> when the timer expired.<br />

7. How many segments were retransmitted? 3<br />

8. Were any segments retransmitted unnecessarily? No<br />

9. When is the last segment sent? At about 2.6 seconds<br />

<strong>TCP</strong> SACK<br />

1. What was the congestion window before the packet loss was detected? 12,864 Bytes<br />

2. What was the congestion window after the loss was detected? 6,432 Bytes<br />

3. Why did not congestion window change after retransmission?<br />

<strong>TCP</strong> SACK does not use congestion window to decide when to send a packet during fast<br />

recovery. It has its own algorithm that uses an estimation of how much data is outst<strong>and</strong>ing.<br />

4. How many segments were retransmitted? 3<br />

5. Were any segments retransmitted unnecessarily? No<br />

6. When is the last segment sent? About 1.2 sec<br />

Comparison across Scenarios<br />

1. Which flavor results in the lowest application response time? Reno with ECN<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

45


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

2. Which two flavors tie for second place in application response time? <strong>TCP</strong> SACK, New Reno<br />

3. What flavor resulted in the highest response time <strong>and</strong> why? Reno<br />

It had to wait for a timeout before resending the third dropped segment.<br />

4. Why do you think <strong>TCP</strong> Reno with ECN support outperformed all other <strong>TCP</strong> flavors?<br />

It did not have to retransmit any segment.<br />

5. Why do you think <strong>TCP</strong> Reno performed worse than <strong>TCP</strong> Tahoe, which does not use fast<br />

recovery?<br />

It had to wait for retransmission timer expiration.<br />

<strong>TCP</strong> Tahoe:<br />

1. What was the congestion window before the packet loss was detected? 12,864 Bytes<br />

2. What was the congestion window after the loss was detected? 536 Bytes<br />

3. How did the server recover from packet loss, by using fast retransmit or timeout retransmission?<br />

Using fast recovery<br />

4. How many times was a slow start performed during the session lifetime?<br />

Slow start was performed twice – when the session opened <strong>and</strong> when the packet drop was<br />

detected.<br />

5. How many segments were retransmitted? 5<br />

6. Were any segments retransmitted unnecessarily? Yes, 2 of them<br />

7. When is the last segment sent? At about 1.4 sec<br />

<strong>TCP</strong> New Reno<br />

1. What was the congestion window before the packet loss was detected? 12,864 Bytes<br />

2. What was the congestion window after the loss was detected? 8,040 Bytes<br />

3. How did the server recover from packet loss, by using fast retransmit or timeout retransmission?<br />

Fast recovery<br />

4. How many times was a slow start performed during the session lifetime? once<br />

5. How many segments were retransmitted? 3<br />

6. Were any segments retransmitted unnecessarily? No<br />

7. When is the last segment sent? At about 1.2 sec<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

46


1508 <strong>Underst<strong>and</strong>ing</strong> <strong>TCP</strong>/<strong>IP</strong> <strong>Model</strong> <strong>Internals</strong> <strong>and</strong> <strong>Interfaces</strong><br />

<strong>TCP</strong> Reno with ECN Support<br />

1. What was the congestion window size before the congestion was detected? 12,328 Bytes<br />

2. After congestion was detected, what was the new size of the congestion window? 5,896 Bytes<br />

3. Did the traffic analyzer drop any segments? No<br />

4. How many segments were retransmitted? None<br />

Comparison across Scenarios<br />

1. Which <strong>TCP</strong> flavor had to use timeout retransmission to recover from loss? Reno<br />

2. Which <strong>TCP</strong> flavor(s) retransmitted packets unnecessarily? Tahoe<br />

3. Which <strong>TCP</strong> flavor did not have to retransmit at all? Reno with ECN<br />

CONFIDENTIAL – RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc.<br />

© 2010 OPNET Technologies, Inc.<br />

47

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!