Você está na página 1de 55

Network Layer

Computer Networks Exercises 7

The IP Routing Process


The IP routing process is fairly simple and doesnt change,
regardless of the size of your network
Example: User on Host_A pings Host_Bs IP address.

Computer Networks 2014

The IP Routing Process (packet creation)


Internet Control Message Protocol (ICMP) creates an
echo request payload
ICMP hands that payload to Internet Protocol (IP), which
then creates a packet.

At a minimum, this packet contains an

IP source address,
IP destination address,
Protocol field with 01h.

All of that tells the receiving host whom it should hand the
payload to when the destination is reachedin this example,
ICMP.

Computer Networks 2014

The IP Routing Process (IP packet sending)


Once the packet is created, IP determines whether the
destination IP address is on the local network or a
remote one.
Since IP determines that this is a remote request, the
packet needs to be sent to the default gateway so the
packet can be routed to the remote network.

The Registry in Windows is parsed to find the configured


default gateway.

Computer Networks 2014

The IP Routing Process (resolve interface)


The default gateway of host 172.16.10.2 (Host_A) is configured
to 172.16.10.1.

For this packet to be sent to the default gateway, the hardware


address of the routers interface Ethernet 0 (configured with the IP
address of 172.16.10.1) must be known.
So the packet can be handed down to the Data Link layer, framed, and
sent to the routers interface thats connected to the 172.16.10.0
network.
Because hosts only communicate via hardware addresses on the local
LAN, its important to recognize that for Host_A to communicate to
Host_B, it has to send packets to the Media Access Control (MAC)
address of the default gateway on the local network.

Note: MAC addresses are always local on the LAN and


never go through and past a router.

Computer Networks 2014

The IP Routing Process (ARP in action)


Next, the Address Resolution Protocol (ARP) cache of
the host is checked to see if the IP address of the default
gateway has already been resolved to a hardware address

If it has, the packet is then free to be handed to the Data Link


layer for framing
If the hardware address isnt already in the ARP cache of the
host
an ARP broadcast is sent out onto the local network to search
for the hardware address of 172.16.10.1
The router responds to the request and provides the hardware
address of Ethernet 0, and the host caches this address.

Computer Networks 2014

The IP Routing Process (Frame creation)


Once the packet and destination hardware address are handed
to the Data Link layer, the LAN driver is used to provide
media access via the type of LAN being used (in this example,
Ethernet).

A frame is then generated, encapsulating the packet with control


information.

Within that frame are the hardware destination and source addresses
plus, in this case, an Ether-Type field that describes the Network layer
protocol that handed the packet to the Data Link layerin this instance,
IP. At the end of the frame is something called a Frame Check Sequence
(FCS) field that houses the result of the cyclic redundancy check (CRC).
It contains Host_As hardware (MAC) address and the destination
hardware address of the default gateway.
It does not include the remote hosts MAC addressremember that!

Computer Networks 2014

The IP Routing Process (Frame receiving)


Once the frame is completed, its handed down to the Physical
layer to be put on the physical medium one bit at a time.
Every device in the collision domain receives these bits and
builds the frame.

They each run a CRC and check the answer in the FCS field. If the
answers dont match, the frame is discarded

If the CRC matches, then the hardware destination address is checked to


see if it matches too

If its a match, then the Ether-Type field is checked to find the protocol
used at the Network layer

The packet is pulled from the frame, and what is left of the
frame is discarded

The packet is handed to the protocol listed in the Ether-Type field


its given to IP.
Computer Networks 2014

The IP Routing Process


IP receives the packet and checks the IP destination address.

Since the packets destination address doesnt match any of the


addresses configured on the receiving router itself, the router will
look up the destination IP network address in its routing table.

The routing table must have an entry for the network


172.16.20.0 or the packet will be discarded immediately and an
ICMP message will be sent back to the originating device with
a destination network unreachable message
If the router does find an entry for the destination network in
its table, the packet is switched to the exit interfacein this
example, interface Ethernet 1.
The router packet-switches the packet to the Ethernet 1
buffer

Computer Networks 2014

The IP Routing Process (ARP resolving )

The Ethernet 1 buffer needs to know the hardware


address of the destination host and first checks the ARP
cache
If the hardware address of Host_B has already been
resolved and is in the routers ARP cache, then the packet
and the hardware address are handed down to the Data
Link layer to be framed.
If the hardware address has not already been resolved, the
router sends an ARP request out E1 looking for the
hardware address of 172.16.20.2. Host_B responds with
its hardware address, and the packet and destination
hardware address are both sent to the Data Link layer for
framing.
10

Computer Networks 2014

The IP Routing Process (DLL communication)

The Data Link layer creates a frame with the destination


and source hardware address, Ether-Type field, and FCS
field at the end. The frame is handed to the Physical layer
to be sent out on the physical medium one bit at a time.
Host_B receives the frame and immediately runs a CRC.
If the result matches whats in the FCS field, the hardware
destination address is then checked. If the host finds a
match, the Ether-Type field is then checked to determine
the protocol that the packet should be handed to at the
Network layerIP in this example

11

Computer Networks 2014

The IP Routing Process

At the Network layer, IP receives the packet and checks


the IP destination address. Since theres finally a match
made, the Protocol field is checked to find out whom the
payload should be given to.
The payload is handed to ICMP, which understands that
this is an echo request. ICMP responds to this by
immediately discarding the packet and generating a new
payload as an echo reply
A packet is then created including the source and
destination addresses, Protocol field, and payload. The
destination device is now Host_A.
12

Computer Networks 2014

The IP Routing Process (packet sending)

IP then checks to see whether the destination IP address


is a device on the local LAN or on a remote network.
Since the destination device is on a remote network, the
packet needs to be sent to the default gateway
The default gateway IP address is found in the Registry of
the Windows device, and the ARP cache is checked to see
if the hardware address has already been resolved from
an IP address.
Once the hardware address of the default gateway is
found, the packet and destination hardware addresses are
handed down to the Data Link layer for framing.
13

Computer Networks 2014

The IP Routing Process (Frame sending)

The Data Link layer frames the packet of information and includes
the following in the header:

The destination and source hardware addresses


The Ether-Type field with 0x0800 (IP) in it
The FCS field with the CRC result in tow

The frame is now handed down to the Physical layer to be sent out
over the network medium one bit at a time
The routers Ethernet 1 interface receives the bits and builds a
frame. The CRC is run, and the FCS field is checked to make sure
the answers match
Once the CRC is found to be okay, the hardware destination
address is checked. Since the routers interface is a match, the packet
is pulled from the frame and the Ether-Type field is checked to see
what protocol at the Network layer the packet should be delivered
to.

14

Computer Networks 2014

The IP Routing Process (packet routing)

The protocol is determined to be IP, so it gets the packet.


IP runs a CRC check on the IP header first and then
checks the destination IP address.
NOTE: IP does not run a complete CRC as the Data Link
layer doesit only checks the header for errors.
In this case, the router does know how to get to network
172.16.10.0the exit interface is Ethernet 0so the
packet is switched to interface Ethernet 0
The router checks the ARP cache to determine whether
the hardware address for 172.16.10.2 has already been
resolved.
15

Computer Networks 2014

The IP Routing Process (frame sending)

Since the hardware address to 172.16.10.2 is already


cached from the originating trip to Host_B, the hardware
address and packet are handed to the Data Link layer.
The Data Link layer builds a frame with the destination
hardware address and source hardware address and then
puts IP in the Ether-Type field. A CRC is run on the
frame and the result is placed in the FCS field.
The frame is then handed to the Physical layer to be sent
out onto the local network one bit at a time
The destination host receives the frame, runs a CRC,
checks the destination hardware address, and looks in the
Ether-Type field to find out whom to hand the packet to.
16

Computer Networks 2014

The IP Routing Process (Receive ICMP response)

IP is the designated receiver, and after the packet is


handed to IP at the Network layer, it checks the protocol
field for further direction. IP finds instructions to give the
payload to ICMP, and ICMP determines the packet to be
an ICMP echo reply.
ICMP acknowledges that it has received the reply by
sending an exclamation point (!) to the user interface.
ICMP then attempts to send four more echo requests to
the destination host.

17

Computer Networks 2014

IP routing example 1

HostA sends data to the HTTP server:

18

The destination address of a frame, from HostA, will be the MAC


address of the F0/0 interface of the RouterA router.
The destination address of a packet will be the IP address of the
network interface card (NIC) of the HTTP server.
The destination port number in the segment header will have a value of
80.

Computer Networks 2014

IP routing example 2
HostA sends data to
the HTTPS server:

19

The destination address of a frame, from HostA, will be the MAC


address of the F0/0 interface of the RouterA router.
The destination address of a packet will be the IP address of the
network interface card (NIC) of the HTTPS server.
The destination port number in the segment header will have a value of
443.
Switches arent used as either a default gateway or another destination,
because they have nothing to do with routing.
Computer Networks 2014

Host 4 communicates with the Sales server.


Host 4 sends ARP request. Which devices receive this message, and
what is send as response?
Host 4 receives ARP reply, then creates package and frame. What
does the package header contains?
The router Lab_A receives the package and forwards it through the
interface F0/0 towards the server. Which is the destination MAC
address in the sent frame header?

20

Computer Networks 2014

Network Layer
Computer Networks Exercises 7

Subnetting

Allows you to take one larger network and break it into a


bunch of smaller networks.
To create subnetworks, take bits from the host portion of the
IP address and reserve them for the subnet address.
A subnet mask is a 32-bit value which distinguish the network
ID portion of the IP address from the host ID portion of the
IP address.
Five simple questions

22

How many subnets does the chosen subnet mask produce?


How many valid hosts per subnet are available?
What are the valid subnets?
Whats the broadcast address of each subnet?
What are the valid hosts in each subnet?
Computer Networks 2014

Subnetting Class C Addresses

There are many different ways to subnet a network.

We cant use a /31 or /32 because we have to have at


least 2 host bits
23

Computer Networks 2014

Example #1 C: 255.255.255.128 (/25)

192.168.10.0 = Network address


255.255.255.128 = Subnet mask
How many subnets? Since 128 is 1 bit on (10000000), the answer would be
21 = 2.
How many hosts per subnet? We have 7 host bits off (10000000), so the
equation would be 27 2 = 126 hosts.
What are the valid subnets? 256 128 = 128.We start at zero and count in
our block size, so our subnets are 0, 128.
Whats the broadcast address for each subnet? The number right before
the value of the next subnet is all host bits turned on and equals the
broadcast address. For the zero subnet, the next subnet is 128, so the
broadcast of the 0 subnet is 127.
What are the valid hosts? These are the numbers between the subnet and
broadcast address.
24

Computer Networks 2014

Example #1 C: 255.255.255.128 (/25)

25

Computer Networks 2014

Example #2 C: 255.255.255.192 (/26)

192.168.10.0 = Network address


255.255.255.192 = Subnet mask
How many subnets? Since 192 is 2 bits on (11000000), the answer would be
22 = 4 subnets.
How many hosts per subnet? We have 6 host bits off (11000000), so the
equation would be 26 2 = 62 hosts.
What are the valid subnets? 256 192 = 64.We start at zero and count in
our block size, so our subnets are 0, 64, 128, and 192.
Whats the broadcast address for each subnet? The number right before
the value of the next subnet is all host bits turned on and equals the
broadcast address. For the zero subnet, the next subnet is 64, so the
broadcast address for the zero subnet is 63.
What are the valid hosts? These are the numbers between the subnet and
broadcast address.
26

Computer Networks 2014

Example #2 C: 255.255.255.192 (/26)

27

Computer Networks 2014

Subnetting Class B Addresses

More possible subnet masks than with Class C


addresses

28

Computer Networks 2014

Example #3 B: 255.255.254.0 (/23)

172.16.0.0 = Network address


255.255.254.0 = Subnet mask

Subnets? 27 = 128.
Hosts? 29 2 = 510.
Valid subnets? 256 254 = 0, 2, 4, 6, 8, etc., up to 254.
Broadcast address for each subnet?
Valid hosts?

29

Computer Networks 2014

Subnetting Class A Addresses

Class A subnetting is not different than Classes B and C, but there are 24
bits to play with instead of the 16 in a Class B address and the 8 in a Class
C address.

30

Computer Networks 2014

Example #4 A: 255.255.240.0 (/20)

255.255.240.0 gives 12 bits of subnetting and leaves


12 bits for host addressing.

31

Subnets? 212 = 4096.


Hosts? 212 2 = 4094.
Valid subnets? What is your interesting octet? 256 240 = 16. The
subnets in the second octet are a block size of 1 and the subnets in
the third octet are 0, 16, 32, etc.
Broadcast address for each subnet?
Valid hosts?

Computer Networks 2014

Typical classful network

192.168.10.0 = Network
255.255.255.240 (/28) = Mask
16 subnets
14 hosts per subnet
One LAN doesnt even have
enough addresses needed
for all the hosts!
The point-to-point WAN link
has 14 valid hosts available!
If we want this network to be more efficient, we need to add different
subnet masks to each router interface.

32

Computer Networks 2014

Classless network design

Variable Length Subnet Masks (VLSMs)

The benefit of this type of network is that we save a bunch of


IP address space with it.
33

Computer Networks 2014

Address block sizes

To create VLSMs quickly and efficiently, you need to


understand how block sizes and charts work together to
create the VLSM masks.

34

Computer Networks 2014

VLSM network example 1

Create a VLSM using a Class C network address 192.168.10.0


for the following network:

35

Computer Networks 2014

VLSM network example 1

We still have plenty of room for


growth with this VLSM network
design

36

Computer Networks 2014

VLSM network example 2

37

Computer Networks 2014

VLSM network example 2

38

Computer Networks 2014

VLSM network example 3

39

Computer Networks 2014

Solution to VLSM network example 3

40

Computer Networks 2014

VLSM network example 4

Start with the largest block size


and move to the smallest
41

Computer Networks 2014

Troubleshooting IP Addressing

Packet InterNet Groper (ping) Uses ICMP echo request and replies to
test if a node IP stack is initialized and alive on the network.

42

Computer Networks 2014

Problem 1 (homework)
What is the maximum number of IP addresses that
can be assigned to hosts on a local subnet that uses
the 255.255.255.224 subnet mask?
A. 14
B. 15
255.255.255.11100000
C. 16
25=32
D. 30
32-2=30
E. 31
F. 62

43

Computer Networks 2014

Problem 2 (homework)
You have a network that needs 29 subnets while
maximizing the number of host addresses available on
each subnet. How many bits must you borrow from
the host field to provide the correct subnet mask?
A. 2
B. 3
2N >29
C. 4
Nmin = 5
D. 5
E. 6
F. 7
min

44

Computer Networks 2014

Problem 3 (homework)
What is the subnetwork address for a host with
the IP address 200.10.5.68/28?
A. 200.10.5.56
B. 200.10.5.32
C. 200.10.5.64
D. 200.10.5.0

200. 10. 5.01000100


and 255.255.255.11110000
200. 10. 5.01000000
200. 10. 5.
64
45

Computer Networks 2014

Problem 4 (homework)
The network address of 172.16.0.0/19 provides how
many subnets and hosts?
A. 7 subnets, 30 (25-2) hosts each
B. 7 subnets, 2046 (212-2) hosts each
C. 7 subnets, 8190 (213-2) hosts each
D. 8 subnets, 30 (25-2) hosts each
E. 8 subnets, 2046 (212-2) hosts each
F. 8 subnets, 8190 (213-2) hosts each
10101100.00010000.00000000.00000000
11111111.11111111.11100000.00000000
46

Computer Networks 2014

Problem 5 (homework)
Which two statements describe the IP address
10.16.3.65/23? (Choose two.)
A. The subnet address is 10.16.3.0 255.255.254.0.
B. The lowest host address in the subnet is
10.16.2.1 255.255.254.0.
C. The last valid host address in the subnet is
10.16.2.254 255.255.254.0.
D. The broadcast address of the subnet is
10.16.3.255 255.255.254.0.
E. The network is not subnetted.
47

Computer Networks 2014

Problem 6 (homework)
If a host on a network has the address
172.16.45.14/30, what is the subnetwork of this host?
A. 172.16.45.0
B. 172.16.45.4
C. 172.16.45.8
D. 172.16.45.12
E. 172.16.45.16
172.16.45.00001110
172.16.45.11111100
172.16.45.
12
48

Computer Networks 2014

Problem 7 (homework)
On a VLSM network, which mask should you use on
point-to-point WAN links in order to reduce the
waste of IP addresses?
A. /27
B. /28
2=22-2
C. /29
D. /30
E. /31

49

Computer Networks 2014

Problem 8 (homework)
You need to configure a server that is on the subnet
192.168.19.24/29. The router has the first available
host address. Which of the following should you
assign to the server?
A. 192.168.19.0 255.255.255.0
B. 192.168.19.33 255.255.255.240
25,26,
C. 192.168.19.26 255.255.255.248
D. 192.168.19.31 255.255.255.248
E. 192.168.19.34 255.255.255.240

50

Computer Networks 2014

Problem 9 (homework)
You have an interface on a router with the IP address
of 192.168.192.10/29. What is the broadcast address
the hosts will use on this LAN?
A. 192.168.192.15
B. 192.168.192.31
C. 192.168.192.63
D. 192.168.192.127
E. 192.168.192.255
192.168.192.00001010
192.168.192.11111000
51

Computer Networks 2014

Problem 10 (homework)
You need to subnet a network that has 5
subnets, each with at least 16 hosts. Which
classful subnet mask would you use?
A. 255.255.255.192
B. 255.255.255.224
Nmin>5
2
C. 255.255.255.240
Nmin = 3
D. 255.255.255.248

52

Computer Networks 2014

Problem 11 (homework)
Your router has the following IP address on
Ethernet0: 172.16.2.1/23. Which of the following can
be valid host IDs on the LAN interface attached to
the router? (Choose two.)
A. 172.16.0.5
B. 172.16.1.100
C. 172.16.1.198
D. 172.16.2.255
E. 172.16.3.0
F. 172.16.3.255
53

Computer Networks 2014

Problem 12 (homework)
To test the IP stack on your local host, which IP
address would you ping?
A. 127.0.0.0
B. 1.0.0.127
C. 127.0.0.1
D. 127.0.0.255
E. 255.255.255.255

54

Computer Networks 2014

Problem 13 (homework)
A network administrator is connecting hosts A and B directly
through their Ethernet interfaces, as shown in the illustration.
Ping attempts between the hosts are unsuccessful. What can be
done to provide connectivity between the hosts? (Choose two.)

55

A.
B.
C.
D.
E.

crossover
rollover
255.255.255.192.
Default gateway .
255.255.255.0.
Computer Networks 2014

Você também pode gostar