Network basics · Introduction · Module 1
What a network is: hosts, links and packets
Show topologyHide topology
H1 at the top is joined to R1 by the link 10.0.1.0/24, from H1’s eth0 to R1’s Ethernet0/0. R1 is joined to H2 at the bottom by the link 10.0.2.0/24, from R1’s Ethernet0/1 to H2’s eth0. Each device is drawn as an outline icon, a laptop for a host and a circle with crossing arrows for the router, with its name beside it. At each cable end, the interface name sits left of the cable and the last number of its address right of it; each link’s range of addresses is written beside its cable. A legend at the bottom explains the short forms.
What a network is
Devices, links and the packets they send
Devices joined by links
H1 and H2 are two computers, and H1 has a photo for H2, but no cable runs straight between them. So how does the photo get across?
It needs a device in the middle to pass it on. Both computers are cabled to R1, which passes the photo’s data from H1’s cable to H2’s.
Each of these cables is a link, a path that joins two devices, and a link can also be a radio path, such as Wi-Fi. R1 is a router, one kind of device that passes data on from one link to another.
H1 and H2, the computers at either end, are hosts, devices that send and receive data for the people or programs using them. So is the phone or computer in front of you.
Together, H1, R1, H2 and the two cables make a network, devices joined so they can send data to each other. Two devices and one cable are already a network.
A phone and a laptop on the same Wi-Fi can send data to each other, so they are on a network, with or without the internet. People often say “network” and mean the internet, one very large network built from many smaller ones, so a small network can seem not to count. The internet is only the largest example, and two devices that can reach each other are enough.
Each cable end here meets its own interface, the place where a device attaches to a link. On a cabled network like this one, a device uses one interface for each link it joins. H1 and H2 each use one, eth0.
R1 joins two links and so uses two of its interfaces, Ethernet0/0 on H1’s link and Ethernet0/1 on H2’s (Et0/0 and Et0/1 in Figure 1.1). Each device names its own interfaces, and R1’s names differ from the hosts’ eth0.
From top to bottom: the host H1, a cable, the router R1, a cable, the host H2. A tag “host” points at H1. A tag “link”, drawn in the accent color with its arrow, points at the cable between H1 and R1. A tag “interface”, on the left below R1, points at where the cable to H2 meets R1, the end named Et0/1. Each of the four cable ends is named beside it: eth0, Et0/0, Et0/1 and eth0 from top to bottom. A note at the bottom counts three devices and two links.
Data travels in packets
When H1 sends the photo, does the whole photo cross the links at once, or something smaller?
Something smaller. The photo crosses as packets, small pieces of data, each sent across a network on its own. Data too large for one packet is cut into several packets, and in Figure 1.2, H1 cuts its data for H2 into three.
Only the sender, H1, is drawn. Under it, a bar labeled “H1’s data for H2” is split by two dashed cut lines into three pieces. An arrow runs down from each piece to a packet tag, and each of the three tags reads “packet, to H2”. The first tag is drawn in the accent color.
Between H1 and H2, the photo crosses the links as separate packets. It looks whole when it leaves and whole when it arrives, so the packets in between stay out of sight. On the way through R1, each packet crosses the links on its own, and no whole photo travels.
Then how does R1 know where each one is going? Each packet carries where it comes from and where it goes. Where it goes names where the packet must arrive, for R1 and each device on the way. Where it comes from tells the receiver where to send a reply.
How it works
A packet’s trip from H1 to H2
H1’s packet reaches R1, which has an interface on each link. Where does the packet come in, and where does it leave?
How a network’s devices are joined by links is its topology, a name also used for a drawing of it, like Figure 1.3. Step through it to follow the packet one link at a time.
Step 1 of 6
H1 has data for H2. It puts the data in a packet for H2.
Step 2 of 6
The packet leaves H1 through its interface eth0 and crosses the link to R1.
Step 3 of 6
The packet enters R1 through Ethernet0/0. R1 counts it there as a packet that came in.
It came in on H1’s link. Which interface does it leave through?
- Ethernet0/0, back toward H1.: Ethernet0/0 is where the packet came in, on H1’s link. Sending it out there would take it back toward H1, away from H2.
- Ethernet0/1, toward H2. (Correct): The packet goes to H2, and H2’s link ends at R1’s Ethernet0/1, drawn as Et0/1 in the topology. So the packet leaves R1 there.
- Both interfaces at once.: The packet goes to H2 only, so R1 has no reason to send it back onto H1’s link.
Step 4 of 6
R1 sends the packet out through Ethernet0/1, onto H2’s link, and counts it there as a packet that went out.
Step 5 of 6
The packet enters H2 through eth0, and H2 takes the data.
Step 6 of 6
H2’s reply makes the same trip the other way, in at Ethernet0/1 and out at Ethernet0/0, to H1. So each of R1’s interfaces counts packets going in and packets going out.
H1 at the top, R1 in the middle and H2 at the bottom, joined by two cables, with each interface named beside its cable end: eth0 at H1, Et0/0 and Et0/1 at R1, eth0 at H2. Step by step, a tag “packet · to H2” moves down beside the first cable, then beside the second, each time with a short arrow beside the cable pointing down, while notes appear one by one: “in at Et0/0” and “out at Et0/1” on the right of R1, then “H2 takes the data” beside H2. In the last step, tags “reply · to H1” come back up beside both cables, with the short arrows pointing up, from H2 to R1 and from R1 to H1, and notes on the left of R1 read, from top to bottom, “out at Et0/0” (level with Et0/0) and “in at Et0/1”. Both reply hops belong to this step, so both short arrows are drawn in the link color; the tag beside the first cable, where the reply reaches H1, is highlighted. The notes of the trip there stay, drawn dashed.
Answer here to see step 4, or tap “Skip, show me”.
R1 takes in a packet on one link and sends it out on the link toward where the packet is going. Since each link meets R1 at its own interface, the packet enters through one interface and leaves through another.
Can you see this trip happen? You can, on R1 itself. A command is the text you type to ask a device to do something or to show something, and the text the device prints in reply is its output.
R1 keeps a count of the packets that enter and leave each of its interfaces. The command show interfaces, followed by an interface name, prints a long report on that interface, and two of its lines hold these packet counts. On the packets input line, the first number counts the packets that came in, and on the packets output line, the packets that went out.
R1’s counts were cleared to zero, and then H1 sent five test packets to H2, packets sent only to check that a reply comes back. H2 replied to each one. Hosts and routers often send other packets besides a test. In this network, though, the counts stayed at zero while no test was running, so every packet R1 counted is one of H1’s test packets or one of H2’s replies.
First, R1 shows the counts of Ethernet0/0, the interface on H1’s link, just after they were cleared. R1 runs Cisco’s IOS XE software.
R1#show interfaces Ethernet0/01Ethernet0/0 is up, line protocol is up … 14 more lines (see Full output)2 0 packets input, 0 bytes, 0 no buffer… 4 more lines (see Full output)3 0 packets output, 0 bytes, 0 underruns… 6 more lines (see Full output)
is upandline protocol is uptogether mean the interface is working.- Nothing has come in yet.
- Nothing has gone out yet.
At that moment Ethernet0/1 showed the same, zero in and zero out.
Full output · 27 lines
R1#show interfaces Ethernet0/0Ethernet0/0 is up, line protocol is up Hardware is AmdP2, address is aabb.cc00.0300 (bia aabb.cc00.0300) Internet address is 10.0.1.1/24 MTU 1500 bytes, BW 10000 Kbit/sec, DLY 1000 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation ARPA, loopback not set Keepalive not set ARP type: ARPA, ARP Timeout 04:00:00 Last input 00:00:15, output 00:00:15, output hang never Last clearing of "show interface" counters 00:00:05 Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 Queueing strategy: fifo Output queue: 0/40 (size/max) 5 minute input rate 0 bits/sec, 0 packets/sec 5 minute output rate 0 bits/sec, 0 packets/sec 0 packets input, 0 bytes, 0 no buffer Received 0 broadcasts (0 IP multicasts) 0 runts, 0 giants, 0 throttles 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored 0 input packets with dribble condition detected 0 packets output, 0 bytes, 0 underruns Output 0 broadcasts (0 IP multicasts) 0 output errors, 0 collisions, 0 interface resets 0 unknown protocol drops 0 babbles, 0 late collision, 0 deferred 0 lost carrier, 0 no carrier 0 output buffer failures, 0 output buffers swapped out
R1 then shows the same interface, right after H1 sent its five test packets. Compare the two packet lines with the zeros before.
R1#show interfaces Ethernet0/0Ethernet0/0 is up, line protocol is up … 14 more lines (see Full output)1 5 packets input, 490 bytes, 0 no buffer… 4 more lines (see Full output)2 5 packets output, 490 bytes, 0 underruns… 6 more lines (see Full output)
- In at Ethernet0/0, H1’s five packets.
- Out at Ethernet0/0, the five replies on their way to H1.
Full output · 27 lines
R1#show interfaces Ethernet0/0Ethernet0/0 is up, line protocol is up Hardware is AmdP2, address is aabb.cc00.0300 (bia aabb.cc00.0300) Internet address is 10.0.1.1/24 MTU 1500 bytes, BW 10000 Kbit/sec, DLY 1000 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation ARPA, loopback not set Keepalive not set ARP type: ARPA, ARP Timeout 04:00:00 Last input 00:00:34, output 00:00:13, output hang never Last clearing of "show interface" counters 00:00:23 Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 Queueing strategy: fifo Output queue: 0/40 (size/max) 5 minute input rate 0 bits/sec, 0 packets/sec 5 minute output rate 0 bits/sec, 0 packets/sec 5 packets input, 490 bytes, 0 no buffer Received 0 broadcasts (0 IP multicasts) 0 runts, 0 giants, 0 throttles 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored 0 input packets with dribble condition detected 5 packets output, 490 bytes, 0 underruns Output 0 broadcasts (0 IP multicasts) 0 output errors, 0 collisions, 0 interface resets 0 unknown protocol drops 0 babbles, 0 late collision, 0 deferred 0 lost carrier, 0 no carrier 0 output buffer failures, 0 output buffers swapped out
At the same moment, R1 shows Ethernet0/1, the interface on H2’s link.
R1#show interfaces Ethernet0/1Ethernet0/1 is up, line protocol is up … 14 more lines (see Full output)1 5 packets input, 490 bytes, 0 no buffer… 4 more lines (see Full output)2 5 packets output, 490 bytes, 0 underruns… 6 more lines (see Full output)
- In at Ethernet0/1, H2’s five replies.
- Out at Ethernet0/1, H1’s five packets on their way to H2.
Full output · 27 lines
R1#show interfaces Ethernet0/1Ethernet0/1 is up, line protocol is up Hardware is AmdP2, address is aabb.cc00.0310 (bia aabb.cc00.0310) Internet address is 10.0.2.1/24 MTU 1500 bytes, BW 10000 Kbit/sec, DLY 1000 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation ARPA, loopback not set Keepalive not set ARP type: ARPA, ARP Timeout 04:00:00 Last input 00:00:34, output 00:00:14, output hang never Last clearing of "show interface" counters 00:00:23 Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 Queueing strategy: fifo Output queue: 0/40 (size/max) 5 minute input rate 0 bits/sec, 0 packets/sec 5 minute output rate 0 bits/sec, 0 packets/sec 5 packets input, 490 bytes, 0 no buffer Received 0 broadcasts (0 IP multicasts) 0 runts, 0 giants, 0 throttles 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored 0 input packets with dribble condition detected 5 packets output, 490 bytes, 0 underruns Output 0 broadcasts (0 IP multicasts) 0 output errors, 0 collisions, 0 interface resets 0 unknown protocol drops 0 babbles, 0 late collision, 0 deferred 0 lost carrier, 0 no carrier 0 output buffer failures, 0 output buffers swapped out
R1 passed every packet of the test in at one interface and out at the other. It counted each of the ten packets, H1’s five test packets and H2’s five replies, once on the way in and once on the way out, at two different interfaces. A laptop usually shows its user just one network connection, and that picture carries over to a device in the middle, as if everything passed through one shared place. R1 has a separate interface for each of its two links instead.
Follow the reply from H2’s side, one link at a time.
Verify
Read R1’s list of interfaces
Which of R1’s interfaces are in use, and are they working?
The command show ip interface brief lists R1’s interfaces, one line per interface. It shows four, but only two are joined to links.
The Interface column names each line, and up in both the Status and Protocol columns means the interface is working. The IP-Address column holds an interface’s address, a number that other devices use to send packets to that interface, and unassigned means it has none. When something stops working, look here first for an interface that is not up in both columns.
R1 lists its interfaces while the network works.
Tap a line, or “Not in the output”, then submit.
Find the line of the interface on H2’s link.
- Ethernet0/0 is on H1’s link,
upandup. - 10.0.2.1 is R1’s own address on H2’s link.
- No address (
unassigned) andadministratively down, which means turned off on R1. Neither is joined to a link.
Full output · 5 lines
R1#show ip interface briefInterface IP-Address OK? Method Status ProtocolEthernet0/0 10.0.1.1 YES TFTP up up Ethernet0/1 10.0.2.1 YES TFTP up up Ethernet0/2 unassigned YES unset administratively down down Ethernet0/3 unassigned YES unset administratively down down
Scroll sideways to see the whole output
But does a packet get through to the host at the cable’s far end? Two up values do not show that. R1 can test it.
On R1, the command ping makes five tries, each a test packet to an address, and counts the replies that come back. H1’s interface has the address 10.0.1.10, and H2’s has 10.0.2.20. In the output, each exclamation mark stands for one test packet that got a reply, a dot for one that got no reply in time, and the success line counts the replies.
R1 sends these test packets itself, so a test of H1 crosses only H1’s link, and a test of H2 crosses only H2’s link. A router can send test packets of its own like these, but it is still a router, because its job is passing other devices’ packets on.
First, R1 tests H1.
R1#ping 10.0.1.10Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 10.0.1.10, timeout is 2 seconds:1!!!!!2Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
- Five
!marks, so all five test packets got a reply. 5/5counts those same five replies.
Then R1 tests H2.
R1#ping 10.0.2.20… 2 more lines (see Full output)!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
Full output · 4 lines
R1#ping 10.0.2.20Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 10.0.2.20, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
So both of R1’s links carry packets there and back. H1’s five test packets also crossed R1 to H2 and each got a reply, so the whole path from H1 through R1 to H2 works.
Key idea
show ip interface brief says which interfaces work. ping says whether packets get there and back.
R1#ping 10.0.2.20… 2 more lines (see Full output).!!!!… 1 more line (see Full output)
Full output · 4 lines
R1#ping 10.0.2.20Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 10.0.2.20, timeout is 2 seconds:.!!!!Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/1 ms
Troubleshoot
When an interface is turned off
What does R1 show when one of its interfaces is turned off, and what still works?
When a host you are trying to reach stops answering, the whole network can look broken. In this case, R1’s interface on H2’s link has been turned off.
R1 cannot reach H2
The same three devices: H1 at the top, R1 in the middle, H2 at the bottom. The cable between H1 and R1 is drawn whole, with a note that H1 and R1 still reach each other. The cable from R1’s Et0/1 down to H2 is drawn the same way, with a cross beside it partway down and the notes “Et0/1 turned off” and “nothing reaches H2”.
Symptom
R1’s test packets to H2 get no reply.
R1#ping 10.0.2.20Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 10.0.2.20, timeout is 2 seconds:.....1Success rate is 0 percent (0/5)
0/5, where the same test read5/5while the network worked.
Command
List R1’s interfaces again with
show ip interface brief.Output
R1#show ip interface brief1Interface Ethernet0/0IP-Address 10.0.1.1OK? YESMethod TFTPStatus upProtocol up2Interface Ethernet0/1IP-Address 10.0.2.1OK? YESMethod TFTPStatus administratively downProtocol downInterface Ethernet0/2IP-Address unassignedOK? YESMethod unsetStatus administratively downProtocol downInterface Ethernet0/3IP-Address unassignedOK? YESMethod unsetStatus administratively downProtocol down- Ethernet0/0, the interface on H1’s link, is still
upandup. - Key line
administratively downsays that Ethernet0/1, the interface on H2’s link, is turned off on R1.
Full output · 5 lines
R1#show ip interface briefInterface IP-Address OK? Method Status ProtocolEthernet0/0 10.0.1.1 YES TFTP up up Ethernet0/1 10.0.2.1 YES TFTP administratively down down Ethernet0/2 unassigned YES unset administratively down down Ethernet0/3 unassigned YES unset administratively down down
Scroll sideways to see the whole output
- Ethernet0/0, the interface on H1’s link, is still
How far it reaches
Does the fault reach beyond H2’s link? With Ethernet0/1 still off, R1 tests H1, whose link ends at Ethernet0/0.
A test of H1 crosses only H1’s link, so it does not need Ethernet0/1.
R1#ping 10.0.1.10Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 10.0.1.10, timeout is 2 seconds:1!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
- R1 still reached H1, with a reply for every test packet while Ethernet0/1 was off.
What it means
- Ethernet0/1 is turned off, so no packet can leave R1 toward H2, and none can come back.
- H1’s link still works, so H1’s packets for H2 reach R1, but they stop there, because the only way to H2 is out through Ethernet0/1.
Fix
Someone allowed to change R1’s settings turns Ethernet0/1 on again.
R1#show ip interface briefInterface Ethernet0/0IP-Address 10.0.1.1OK? YESMethod TFTPStatus upProtocol up1Interface Ethernet0/1IP-Address 10.0.2.1OK? YESMethod TFTPStatus upProtocol upInterface Ethernet0/2IP-Address unassignedOK? YESMethod unsetStatus administratively downProtocol downInterface Ethernet0/3IP-Address unassignedOK? YESMethod unsetStatus administratively downProtocol down- Ethernet0/1 is
upandupagain.
Full output · 5 lines
R1#show ip interface briefInterface IP-Address OK? Method Status ProtocolEthernet0/0 10.0.1.1 YES TFTP up up Ethernet0/1 10.0.2.1 YES TFTP up up Ethernet0/2 unassigned YES unset administratively down down Ethernet0/3 unassigned YES unset administratively down down
Scroll sideways to see the whole output
Right after the fix, R1 tests H2 again.
R1#ping 10.0.2.20Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 10.0.2.20, timeout is 2 seconds:1.!!!!Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/1 ms
- The first test packet got no reply (
.), and the next four did.
- Ethernet0/1 is
Proof
Packets reach H2 again, but one test packet got no reply, so a moment later R1 tests H2 once more.
All five test packets to H2 got a reply, so the fix worked.
R1#ping 10.0.2.20Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 10.0.2.20, timeout is 2 seconds:!!!!!1Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
5/5, where the first test after the fix read4/5.
A test that fails says something only about what it needed, the links on its way and the device at the far end. One failure is often reported as “the network is down”, so a single failed test sounds as if it covers everything. The failed test of H2 needed only H2’s link, and H1’s link went on working.
Key idea
When one interface is turned off, only the packets that need it stop.
Check
R1’s counts were cleared. Then H2 sent three test packets to H1, and H1 replied to each one.
Tap a line, or “Not in the output”, then submit.
In R1’s counts for Ethernet0/1, find the line that counts the packets that came in from H2.
R1#show interfaces Ethernet0/1… 14 more lines (see Full output)… 4 more lines (see Full output)… 6 more lines (see Full output)
Full output · 27 lines
R1#show interfaces Ethernet0/1Ethernet0/1 is up, line protocol is up Hardware is AmdP2, address is aabb.cc00.0310 (bia aabb.cc00.0310) Internet address is 10.0.2.1/24 MTU 1500 bytes, BW 10000 Kbit/sec, DLY 1000 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation ARPA, loopback not set Keepalive not set ARP type: ARPA, ARP Timeout 04:00:00 Last input 00:00:31, output 00:00:13, output hang never Last clearing of "show interface" counters 00:00:21 Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 Queueing strategy: fifo Output queue: 0/40 (size/max) 5 minute input rate 0 bits/sec, 0 packets/sec 5 minute output rate 0 bits/sec, 0 packets/sec 3 packets input, 294 bytes, 0 no buffer Received 0 broadcasts (0 IP multicasts) 0 runts, 0 giants, 0 throttles 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored 0 input packets with dribble condition detected 3 packets output, 294 bytes, 0 underruns Output 0 broadcasts (0 IP multicasts) 0 output errors, 0 collisions, 0 interface resets 0 unknown protocol drops 0 babbles, 0 late collision, 0 deferred 0 lost carrier, 0 no carrier 0 output buffer failures, 0 output buffers swapped out
Summary
H1 at the top, R1 in the middle and H2 at the bottom, joined by two cables, with each interface named beside its cable end: eth0 at H1, Et0/0 and Et0/1 at R1, eth0 at H2. Tags “reply · to H1” sit beside both cables, each with a short arrow beside the cable pointing up, from H2 to R1 and from R1 to H1; notes on the left of R1 read, from top to bottom, “out at Et0/0” (level with Et0/0) and “in at Et0/1”. The notes of the trip there are drawn dashed: “in at Et0/0” and “out at Et0/1” on the right of R1, and “H2 takes the data” beside H2.
- A network is devices joined by links. Hosts send and receive data, and each link has an interface at each end.
- Data travels in packets that carry where they come from and where they go.
- A packet crosses R1 in at one interface and out at another, and R1 counts it at both.
show ip interface brieflists R1’s interfaces and whether they work;pingshows whether test packets get a reply.- With one interface turned off, only the packets that need it stop.