Network models · Fundamentals · Module 2
Encapsulation and decapsulation · page 2 of 3
Show topologyHide topology
Four devices in a column, joined by three cables. At the top the host H1: its eth0, address ending .10, is cabled to the switch SW1’s Et0/1. SW1’s Et0/0 is cabled to the router R1’s Et0/0, address ending .1. Both of SW1’s cables are one network, 10.0.1.0/24, written on each of them; SW1 itself has no address. R1’s Et0/1, address ending .1, is cabled to the host H2 at the bottom, its eth0 ending .20, in the network 10.0.2.0/24, written on that cable. A legend explains the short forms.
Verify
Read one packet, header by header
Which of R1’s lines show the headers of the packet with H2’s greeting?
An IP line and the TCP line under it. R1 opened a connection to port 2001 on H2 with telnet, and H2’s program sent its greeting. With debug ip packet detail on, R1 printed lines for every packet of the connection. It is a new connection, so R1’s side uses port 39804, not the 44091 of “hello from R1”. Three packets came in from H2; one of them carries the greeting.
R1’s lines for the packet with the greeting and for R1’s answer to it, when everything works.
Tap a line, or “Not in the output”, then submit.
Find the line that tells R1 which of its programs gets the greeting.
R1#show logging | include IP:|TCP… 24 more lines (see Full output)… 4 more lines (see Full output)… 24 more lines (see Full output)
- The IP header: from 10.0.2.20 to 10.0.2.1.
- The TCP header: from port 2001 to R1’s port 39804.
Full output · 56 lines
R1#show logging | include IP:|TCPIP: tableid=0, s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1) nexthop=10.0.2.20, routed via FIBIP: s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1), len 52, sending TCP src=39804, dst=2001, seq=1420762395, ack=0, win=65535 SYNIP: s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1), len 52, sending full packet TCP src=39804, dst=2001, seq=1420762395, ack=0, win=65535 SYNIP: s=10.0.2.20 (Ethernet0/1), d=10.0.2.1 (nil), len 52, input feature TCP src=2001, dst=39804, seq=3811766141, ack=1420762396, win=64240 ACK SYN, MCI Check(110), rtype 0, forus FALSE, sendself FALSE, mtu 0, fwdchk FALSEIP: s=10.0.2.20 (Ethernet0/1), d=10.0.2.1 (nil), len 52, rcvd 2 TCP src=2001, dst=39804, seq=3811766141, ack=1420762396, win=64240 ACK SYNIP: s=10.0.2.20 (Ethernet0/1), d=10.0.2.1 (nil), len 52, stop process pak for forus packet TCP src=2001, dst=39804, seq=3811766141, ack=1420762396, win=64240 ACK SYNIP: tableid=0, s=10.0.2.20 (Ethernet0/1), d=10.0.2.1 (Ethernet0/1) nexthop=10.0.2.1, routed via RIBIP: tableid=0, s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1) nexthop=10.0.2.20, routed via FIBIP: s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1), len 40, sending TCP src=39804, dst=2001, seq=1420762396, ack=3811766142, win=32768 ACKIP: s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1), len 40, sending full packet TCP src=39804, dst=2001, seq=1420762396, ack=3811766142, win=32768 ACKIP: tableid=0, s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1) nexthop=10.0.2.20, routed via FIBIP: s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1), len 40, sending TCP src=39804, dst=2001, seq=1420762396, ack=3811766142, win=32768 ACKIP: s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1), len 40, sending full packet TCP src=39804, dst=2001, seq=1420762396, ack=3811766142, win=32768 ACKIP: s=10.0.2.20 (Ethernet0/1), d=10.0.2.1 (nil), len 54, input feature TCP src=2001, dst=39804, seq=3811766142, ack=1420762396, win=502 ACK PSH, MCI Check(110), rtype 0, forus FALSE, sendself FALSE, mtu 0, fwdchk FALSEIP: s=10.0.2.20 (Ethernet0/1), d=10.0.2.1 (nil), len 54, rcvd 2 TCP src=2001, dst=39804, seq=3811766142, ack=1420762396, win=502 ACK PSHIP: s=10.0.2.20 (Ethernet0/1), d=10.0.2.1 (nil), len 54, stop process pak for forus packet TCP src=2001, dst=39804, seq=3811766142, ack=1420762396, win=502 ACK PSHIP: tableid=0, s=10.0.2.20 (Ethernet0/1), d=10.0.2.1 (Ethernet0/1) nexthop=10.0.2.1, routed via RIBIP: tableid=0, s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1) nexthop=10.0.2.20, routed via FIBIP: s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1), len 40, sending TCP src=39804, dst=2001, seq=1420762396, ack=3811766156, win=32764 ACKIP: s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1), len 40, sending full packet TCP src=39804, dst=2001, seq=1420762396, ack=3811766156, win=32764 ACKIP: tableid=0, s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1) nexthop=10.0.2.20, routed via FIBIP: s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1), len 40, sending TCP src=39804, dst=2001, seq=1420762396, ack=3811766156, win=32768 ACKIP: s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1), len 40, sending full packet TCP src=39804, dst=2001, seq=1420762396, ack=3811766156, win=32768 ACKIP: tableid=0, s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1) nexthop=10.0.2.20, routed via FIBIP: s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1), len 40, sending TCP src=39804, dst=2001, seq=1420762396, ack=3811766156, win=32768 ACK PSH FINIP: s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1), len 40, sending full packet TCP src=39804, dst=2001, seq=1420762396, ack=3811766156, win=32768 ACK PSH FINIP: s=10.0.2.20 (Ethernet0/1), d=10.0.2.1 (nil), len 40, input feature TCP src=2001, dst=39804, seq=3811766156, ack=1420762397, win=502 ACK FIN, MCI Check(110), rtype 0, forus FALSE, sendself FALSE, mtu 0, fwdchk FALSEIP: s=10.0.2.20 (Ethernet0/1), d=10.0.2.1 (nil), len 40, rcvd 2 TCP src=2001, dst=39804, seq=3811766156, ack=1420762397, win=502 ACK FINIP: s=10.0.2.20 (Ethernet0/1), d=10.0.2.1 (nil), len 40, stop process pak for forus packet TCP src=2001, dst=39804, seq=3811766156, ack=1420762397, win=502 ACK FINIP: tableid=0, s=10.0.2.20 (Ethernet0/1), d=10.0.2.1 (Ethernet0/1) nexthop=10.0.2.1, routed via RIBIP: tableid=0, s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1) nexthop=10.0.2.20, routed via FIBIP: s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1), len 40, sending TCP src=39804, dst=2001, seq=1420762397, ack=3811766157, win=32768 ACKIP: s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1), len 40, sending full packet TCP src=39804, dst=2001, seq=1420762397, ack=3811766157, win=32768 ACK
From the outside in, the greeting’s frame holds an Ethernet header and trailer, IP header, TCP header and data (Figure 2.4).
Five parts in a column: four from the outside in, then the frame’s trailer behind the data. Each part has two lines beside it: what R1 prints for it, and what that means. Ethernet header: not in R1’s lines; the MAC addresses are in show arp. IP header: s=10.0.2.20 and d=10.0.2.1; len 54 is the whole packet. TCP header, drawn in the accent color: src=2001 and dst=39804, the two programs. Data: “hello from H2”, 14 bytes with its line end. Trailer: not in R1’s lines; it holds the frame check sequence.
On the IP line, s= and d= are the source and destination addresses of the IP header. The interface names in brackets and the last words are R1’s own notes, so read them apart from the header. (Ethernet0/1) after s= is the interface the packet came in on. (nil) after d= means no interface out, here because the packet is for R1 itself.
len counts the whole packet in bytes, IP header, TCP header and the greeting. R1’s answer carries no data and reads len 40; the greeting’s packet is 14 bytes longer, and those bytes are “hello from H2” and its line end.
With the program on H2 stopped, R1 tried to connect again:
No program waits on port 2001 on H2, so H2 refused the connection.
R1#show logging… 27 more lines (see Full output)IP: s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1), len 52, sending1 TCP src=61495, dst=2001, seq=2418396838, ack=0, win=65535 SYN… 7 more lines (see Full output)2IP: s=10.0.2.20 (Ethernet0/1), d=10.0.2.1 (nil), len 40, rcvd 23 TCP src=2001, dst=61495, seq=0, ack=2418396839, win=0 ACK RST… 6 more lines (see Full output)
- R1’s attempt to connect, a TCP segment to port 2001.
- A packet came back for R1:
rcvd 2. Its IP header is from 10.0.2.20, so H2 is there, and H2’s network layer passed R1’s segment up. src=2001andRST, the refusal.
Full output · 44 lines
R1#show loggingSyslog logging: enabled (0 messages dropped, 2 messages rate-limited, 0 flushes, 0 overruns, xml disabled, filtering disabled) No Active Message Discriminator. No Inactive Message Discriminator. Console logging: disabled Monitor logging: level debugging, 0 messages logged, xml disabled, filtering disabled Buffer logging: level debugging, 336 messages logged, xml disabled, filtering disabled Exception Logging: size (4096 bytes) Count and timestamp logging messages: disabled Persistent logging: disabled Trap logging: level informational, 57 message lines logged Logging Source-Interface: VRF Name: Log Buffer (128000 bytes): Nov 25 21:10:03.547: %SYS-4-LOG_CLEARED: Logging buffer was cleared by user UnknownFIBipv4-packet-proc: route packet from (local) src 10.0.2.1 dst 10.0.2.20FIBfwd-proc: packet routed by adj to Ethernet0/1 10.0.2.20FIBipv4-packet-proc: packet routing succeededIP: tableid=0, s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1) nexthop=10.0.2.20, routed via FIBIP: s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1), len 52, sending TCP src=61495, dst=2001, seq=2418396838, ack=0, win=65535 SYNIP: s=10.0.2.1 (local), d=10.0.2.20 (Ethernet0/1), len 52, sending full packet TCP src=61495, dst=2001, seq=2418396838, ack=0, win=65535 SYNIP: s=10.0.2.20 (Ethernet0/1), d=10.0.2.1 (nil), len 40, input feature TCP src=2001, dst=61495, seq=0, ack=2418396839, win=0 ACK RST, MCI Check(110), rtype 0, forus FALSE, sendself FALSE, mtu 0, fwdchk FALSEFIBipv4-packet-proc: route packet from Ethernet0/1 src 10.0.2.20 dst 10.0.2.1FIBfwd-proc: Default:10.0.2.1/32 receive entryFIBipv4-packet-proc: packet routing failedIP: s=10.0.2.20 (Ethernet0/1), d=10.0.2.1 (nil), len 40, rcvd 2 TCP src=2001, dst=61495, seq=0, ack=2418396839, win=0 ACK RSTIP: s=10.0.2.20 (Ethernet0/1), d=10.0.2.1 (nil), len 40, stop process pak for forus packet TCP src=2001, dst=61495, seq=0, ack=2418396839, win=0 ACK RSTFIBipv4-packet-proc: route packet from Ethernet0/1 src 10.0.2.20 dst 10.0.2.1FIBfwd-proc: Default:10.0.2.1/32 receive entryFIBipv4-packet-proc: packet routing failedIP: tableid=0, s=10.0.2.20 (Ethernet0/1), d=10.0.2.1 (Ethernet0/1) nexthop=10.0.2.1, routed via RIB
In a working network, these three endings of R1’s IP lines show where each packet went:
| Line ends in | Means | Look next |
|---|---|---|
sending | R1 has the packet and its way out, the interface in brackets | the next line for the same packet |
sending full packet | the packet went out | a reply: a line ending in rcvd 2 |
rcvd 2 | a packet for R1 arrived; R1 passes it up | its TCP line: the two ports |
Why did R1’s answer to the greeting leave by Ethernet0/1? Its address and mask. Ethernet0/1 has the address 10.0.2.1/24, and a destination inside that network is sent straight out of it, so it went out there.
| Command | What it does | Default | Where you see the result |
|---|---|---|---|
ip address <address> <mask> | sets the interface’s address and the mask of its network; one interface only | no address | show ip interface Ethernet0/1 | include Internet address |