Title: CSCI-690 Computer Networks: Shrinking the globe one click at a time Lecture 4
1CSCI-690Computer NetworksShrinking the globe
one click at a timeLecture 4
2Major sources of the slides for this lecture
- Slides from Tanenbaums and William Stallings
website are used in this lecture - Interworking with TCP/IP, M9000-02, Global
knowledge, training manual, (http//am.globalknowl
edge.com) - Teach yourself TCP/IP in 24 hours, Joe Casad, Bob
Willsey, SAMS - The Internet and Its Protocol, Adrian Farrels
book.
3Reference Network For discussion purposes
4Ethernet frame
SFD Start of Frame Delimiter D Addr
Destination Address S Addr Source Address FCS
Frame Check Sequence
5Address Resolution Protocol (ARP) RFC 826
- Consider two machines A and B that connect to the
same physical network. Each has an assigned IP
address IA and IB and a physical address PA and
PB . The goal is to devise low-level software
that hides physical addresses and allows
higher-level programs to work only with internet
addresses. Ultimately, however, communication
must be carried out by physical networks using
whatever physical address scheme the underlying
network supplies. - The problem of mapping high-level addresses to
physical address is known as the address
resolution problem.
6Address Resolution Protocol (ARP)
- Imagine a router receives a packet. It looks up
the destination IP address carried by the packet
and determines the next hop to which to forward
the packet there is a chance that the
destination is attached to the router. This tells
the router out of which interface it should send
the packet to. - If the link from the router is point-to-point,
things will be simple as the router can simply
wrap the packet in a data-link layer protocol and
send it. - However, if the link is multihop link like
Ethernet (a link where multiple nodes are
attached). Hence, the router needs the data-link
layer address (such as MAC address) to forward
the packet to the proper node. - IPv4 address (4 octets) IS NOT EQUAL to MAC
address (6 octets) in length. This does not allow
the MAC address to be carried in the 4-octet IP
address field. - Moreover, in IP, at times it is desired to be
able to assign multiple addresses to a single
node.
7Address Resolution Protocol (ARP)
- need MAC address to send to LAN host
- manual
- included in network address
- use central directory
- use address resolution protocol
- ARP (RFC 826) provides dynamic IP to Ethernet
address mapping - Source broadcasts ARP request
- Destination replies with ARP response
8Address Resolution Protocol (ARP)
- Nodes announce their presence on a network and
also query MAC addresses based on given IP
addresses. - When nodes are plugged into an Ethernet it
announces its presence by advertising the IP
address of its attachment to the Ethernet
together with its MAC address in a process know
as gratuitous ARP. - Advertisement message is broadcast at Ethernet
using MAC address of 0xFFFFFFFFFFFF so that all
nodes on the network receive it and can add the
information to their mapping tables or ARP caches
9Address Resolution Protocol (ARP)
Operation Code Meaning
1 ARP request. Please supply the IP address corresponding to the requested target MAC address
2 ARP reply. Here is a mapping of target MAC address to target IP address
3 RARP request. Please supply my IP address given my MAC address
4 RARP reply. Here is your IP address given your MAC address
8 InARP request. Please supply the MAC address corresponding to the target IP address
9 InARP reply. Here is a mapping of target IP address to target MAC address
10Format of ARP Message encapsulated in Ethernet
11Addressing scheme in IP
- Three key 32-bit fields (areas of information)
within the IP software are integral to its
operation - IP Address A unique 32 bit address assigned to a
computer or more accurately to a node - Subnet Mask Field A 32 bit pattern of bits used
to tell IP how to determine which part of the IP
address is network portion and which part is the
host portion - Default gateway field An optional 32 bit address
that, if present, identifies the address of a
router. Datagrams destined to another network are
sent to this address to be routed appropriately
12IP Addressing
- IP address is divided into two parts
- Network ID
- Host ID
- Network ID can be synonymous to a street name
every house on the street uses the same street
name. Likewise every computer on a network uses
the same network ID. - Similar to every house on the street has a unique
street address, each computer on a network has a
different host ID.
13IP Addressing
- Some network administrator use parts of the local
bits (bits used for local host IDs) to create
more manageable pieces called subnets
(subnetworks). Therefore, there can be network,
subnet, and host fields of an IP address. Some
rules to the IP address and those fields - No field of an interfaces IP address may contain
all 1s or all 0s - All 1s in the host portion of a target IP address
signify an IP-level broadcast - All 0s in the host portion of an IP address
identify a subnet or a network - Subnet Breaking network address into multiple
addresses
14IPv4 Address Formats
15IP Addresses - Class A
N Net L Locally administered.
- Class A network contains 8 bit network ID and 24
bit host ID gt Class network can approximately
support 224 (16,777,216 computers). In reality
the number of computers is less than that number
(all 1s or all 0s eliminated). - Left most bit is always a 0
- all 0 reserved
- 01111111 (127) reserved for loopback or local
host - range 1.x.x.x to 126.x.x.x (usable range)
- Network administrators frequently separate the
network into smaller subnets. - Class A addresses are assigned to large
organizations such as Ford Motor Company, MIT
etc.
16IP Addresses - Class B
N Net L Locally administered.
- Class B addresses start with binary 10
- range 128.x.x.x to 191.x.x.x
- second octet also included in network address
- 214 16,384 class B addresses
- Without subnetting, 65,534 addresses can be used
within a flat network. - Class B networks are assigned to midsize
organizations such as colleges and universities.
17IP Addresses - Class C
N Net L Locally administered.
- start with binary 110
- range 192.x.x.x to 223.x.x.x
- second and third octet also part of network
address - 221 2,097,152 network addresses
- Class C networks typically do not need subnetting
for management, unless they contain smaller
workgroups in a diverse location - More often, organizations subnet Class C networks
to restrict access to specific resources.
18IP Addresses - Class D
M Multicast.
- Class D addresses have the first three bits set
to a 1 and fourth bit set to a 0. - Class D addresses are used to reach groups by
assigning the same multicast address to all
members of the group. These group members also
have their own individual Class A, B, or C host
IP address. There are millions of possible
multicast addresses - Class D addresses are designated for groups of
users and therefore do not have host portions for
assignment to individual interfaces. For that
reason, Class D networks are not subnetted.
19Subnets
- A campus network consisting of LANs for various
departments.
20Subnets and Subnet Masks
- allows arbitrary complexity of internetworked
LANs within organization - insulate overall internet from growth of network
numbers and routing complexity - site looks to rest of internet like single
network - each LAN assigned subnet number
- host portion of address partitioned into subnet
number and host number - local routers route within subnetted network
- subnet mask indicates which bits are subnet
number and which are host number
21Subnetting IP Networks
191.255.193.44 IP decimal 255.255.252.0 mask
decimal 10111111 11111111 11000001 00101100 IP
binary 11111111 11111111 11111100 00000000 ma
sk binary NNNNNNNN NNNNNNNN SSSSSS I I I I I I I
I I I mask meaning In the mask, binary 1s
indicate the position of the network and subnet
portion of the IP address, while 0s identify bits
that represent individual interfaces. N Net S
Subnet I Interface The natural mask is the
mask that represents the bits used by the network
number in Class A, B C networks A
255.0.0.0 B 255.255.0.0 C 255.255.255.0 Additi
onal bits in a mask in excess of the natural mask
for the network class indicates a subnetted
network Subnet mask shown above can also be
represented as 191.255.0.0/22 suggesting that
the class B network uses a mask that identifies
the first 22 bits of the 32-bit IP address as the
network and subnet fields. Since first 16 bits
identify the network, the remaining 6 bits set
the subnet field.
22Subnet Calculations
Example The number of subnets or hosts in a
subnet (2n) 2 (n the number of bits used in
the mask) With 4 bits in the host field of the
mask (24) 2 16 2 14 hosts With three
bits in the subnet field of the mask (23) 2 8
2 6 subnets The (-2) term comes from invalid
entries of all 1s or all 0s in the field.
- Questions to ask when subnetting is used
- How many subnets an organization need from its
network - What is the maximum number of interfaces that the
largest subnet needs to support - To answer these questions, limits of the class of
network plus the rules of IP addressing need to
be considered - No field (network, subnet or host) may contain
all 1s or all 0s (binary) - There cannot be a mask with a subnet field of 1
bit
23IP Routing Rules
- IP datagrams can travel over the network in two
ways - Local routing The datagram is sent directly to
a device on the same physical network as the
sending device - Indirect routing If the target device is on
another physical network, IP must send the
datagram to another device (a router) for help in
getting it to the target.
24IP Routing Rules
- IP decides if a device is on a local network by
evaluating the source and target IP addresses.
While the IP stack does a series of binary
manipulations to make the routing decision, a
simple set of rules clearly describes the result
of the process - If two address are in different classes, the
datagram is sent to the router for forwarding - If the two addresses are in the same class but in
different network, the datagram is sent to the
router for forwarding - If the two addresses are in the same class and
network, but in different subnets, the datagram
is sent to the router for forwarding - At this point, the source and target addresses
are in the same network and subnet so the
datagram is sent directly to the target computer
25IP Routing Are these addresses on the Same
Subnet?
- How do we determine if the source and the target
IP addresses are in the same subnet? The subnet
field in both addresses must have the same value. - How do we know if they have the same value?
- We know it by locating the subnet field and then
checking the values to see if they are the same
26IP Routing Are these addresses on the Same
Subnet? Example 1
- Determine if the addresses are in the same
subnet - Source 161.55.121.33
- Target 161. 55.131.49
- These are Class B addresses and are in the same
network the 161.55.0.0 network - To determine if they are in the same subnet, we
must also have the subnet mask. - Assume we are using the subnet mask 255.255.248.0
- Keep in mind that subnet field is locally
administered portion of the addresses and is
indicated by the 1 bits in the locally
administered portion of the mask.
27IP Routing Are these addresses on the Same
Subnet? Example 1 (continued)
First 5 bits are 1, telling us the we have
five-bit mask. Source AND Mask 01111 Target
AND Mask 10000 Hence not in the same subnet
Local portion of the source address is 121.33
(79.21 Hex). Local portion of the target address
is 131.49 (83.31 Hex) Local portion of the mask
is 248.0 (F8.0 Hex)
Binary value 128 64 32 16 8 4 2 1 128 64 32 16 8 4 2 1
Source 0 1 1 1 1 0 0 1 0 0 1 0 0 0 0 1
Mask 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0
Target 1 0 0 0 0 0 1 1 0 0 1 1 0 0 0 1
28IP Routing Are these addresses on the Same
Subnet? Example 2
- Determine if the addresses are in the same
subnet - Source 204.238.7.50
- Target 204.238.7.66
- Mask 255.255.255.240
- These are Class C addresses and are in the same
network the 204.238.7.0 network
29IP Routing Are these addresses on the Same
Subnet? Example 2 (continued)
First 4 bits are 1, telling us the we have
four-bit mask. Source AND Mask 0011 Target AND
Mask 0100 Hence not in the same subnet
Local portion of the source address is 50 (32
Hex). Local portion of the target address is 66
(42 Hex) Local portion of the mask is 240 (F0 Hex)
Binary value 128 64 32 16 8 4 2 1
Source 0 0 1 1 0 0 1 0
Mask 1 1 1 1 0 0 0 0
Target 0 1 0 0 0 0 1 0
30IP Routing Are these addresses on the Same
Subnet? Example 3
- Determine if the addresses are in the same
subnet - Source 200.1.1.69
- Target 200.1.1.135
- Mask 255.255.255.224
- These are Class C addresses and are in the same
network the 200.1.1.0 network
31IP Routing Are these addresses on the Same
Subnet? Example 3 (continued)
Local portion of the source address is 69 (45
Hex). Local portion of the target address is 135
(87 Hex) Local portion of the mask is 240 (F0 Hex)
First 4 bits are 1, telling us the we have
four-bit mask. Source AND Mask 0101 Target AND
Mask 1000 Hence not in the same subnet
Binary value 128 64 32 16 8 4 2 1
Source 0 1 0 0 0 1 0 1
Mask 1 1 1 1 0 0 0 0
Target 1 0 0 0 0 1 1 1
32Subnets
- A campus network consisting of LANs for various
departments.
33Network Layer Design Issues
- Store-and-Forward Packet Switching
- Services Provided to the Transport Layer
- Implementation of Connectionless Service
- Implementation of Connection-Oriented Service
- Comparison of Virtual-Circuit and Datagram
Subnets
34Store-and-Forward Packet Switching
- The environment of the network layer protocols.
35Implementation of Connectionless Service
- Routing within a diagram subnet.
36Routing Algorithms
- The Optimality Principle
- Shortest Path Routing
- Flooding
- Distance Vector Routing
- Link State Routing
- Hierarchical Routing
- Broadcast Routing
- Multicast Routing
- Routing for Mobile Hosts
- Routing in Ad Hoc Networks
37Routing
- Routing and forwarding is what the Internet is
all about - How can an IP packet from one host be delivered
to the destination host? - Within an individual router lies the answer
Routing Table - Routing table maps the destination address
carried in a datagram to the address of the next
hop along the path (next hop address) and the
interface through which the datagram should be
forwarded (the outgoing interface)
38Routing
- In simple networks, routing table can be manually
configured or learned from the configuration of
interfaces on the router. - In complex networks where there are many routers
arranged in a mesh with lots of links between
routers, each having different capabilities,
manual configuration becomes onerous/troublesome. - Even more important is when there are changes in
the network how do other routers are informed
of such changes and how they react to the change. - e.g. Link failure, routers added to the network
- Routing protocols are used to collate and
distribute information about the network
connectivity - Once the connectivity information has been
distributed the question of how to compute the
best path still remains. - Routing algorithms can be run against the view of
the network to determine the best path along
which to forward the datagram.
39Routing
- Routing Information Protocol (RIP) is simple and
ubiquitous. - Open Shortest Path First (OSPF) protocol is very
popular and has a close rival, Intermediate
System to Intermediate System (IS-IS), that
performs a similar function - Border Gateway Protocol (BGP) is important for
hooking together the many Service Provider
networks into a single Internet
40Classless Interdomain Routing (CIDR)
- IP addresses are grouped in classes
- Different nibbles/bytes split the address into
network portion and the host portion of the IP
address - Network mask indicates the length of the network
part of the address know as prefix length - Earlier networks routed traffic based on the
classes (A, B or C type) - Subnetting allows the networks to be divided into
smaller segments - Subnetting process defines range of addresses
assigned to a subnet according to prefix length - Routing using subnetwork addresses is not quite
simple as routing as using class addresses,
because knowledge of the network mask (prefix
length) is not encoded in the address itself - Routing table must consist of a list of
subnetwork addresses (i.e. addresses and prefix
length), each mapping to a route or path along
which packet for that subnet should be forwarded - Routing table will explode if all addresses have
to be included in the routing table. e.g., in
class A potentially there are 222 30-bit prefix
subnetworks - The solution within the Internet is to route at
an appropriate level of granularity through
address aggregation
41Route address aggregation
Subnetwork Subnetwork Mask Address Range
172.19.168.16/28 255.255.255.240 172.19.168.16 172.19.168.31
172.19.168.32/28 255.255.255.240 172.19.168.32 172.19.168.47
172.19.168.32/26 255.255.255.224 172.19.168.1 172.19.168.62
The subnet addresses can be combined/aggregated
as a single subnetwork 176.19.168.32/26
42Simple network showing a multi-access link, a
numbered point-to-point link and an un-numbered
link
Numbered link
Loop back address is known as a routable router
identifier because it is an IP address that can
be installed in the routing tables at other
routers
43Distance Vectors
44Routing Table at Router E. Initial routing
Distribution while the link between Routers A and
B Disabled
Destination Outgoing Interface Distance Next Hop
E 10.0.0.1 0 -
B 10.0.6.2 1 B
F 10.0.7.1 1 F
C 10.0.6.2 2 B
D 10.0.7.1 2 F
A 10.0.7.1 3 F
45Routing Table at Router E. After Full
Distribution
Destination Outgoing Interface Distance Next Hop
E 10.0.0.1 0 -
B 10.0.6.2 1 B
F 10.0.7.1 1 F
C 10.0.6.2 2 B
D 10.0.7.1 2 F
A 10.0.7.1 2 B
46Practice on Wireshark
- Use wireshark to capture two or more ARP packets
- Explain what each field means and why the
respective values are used.