internet protocol addressing and routingjamhour/download/pub/english semester... · rede física...
Post on 17-Dec-2018
216 Views
Preview:
TRANSCRIPT
Edgard Jamhour
Internet Topology
• Internet - WAN
LAN
Physical Network
(LAN) LAN
LAN
internet
Gateway or router
Edgard Jamhour
Dotted Decimal Notation
10000000 00001010 00000010 00011110
2726252423222120 2726252423222120 2726252423222120 2726252423222120
27=128 23+21=10 21=2 24+23+22+21=30
128.10.2.30
Dotted decimal
notation
Binary
notation
Edgard Jamhour
IP Addresses
• IP Address: Network ID (Prefix) + Host ID
Net ID
32-bit Address
LAN
internet
Rede física Rede Física
Rede física
hosts com o
mesmo identificador de
rede.
hosts com
identificadores de rede
distintos.
host
Host ID
Edgard Jamhour
Classful IP Addressing
Class Octets Prefixes Addresses per
Prefix
Address Range
A (0) R H H H 128 16.777.216 1.0.0.0
127.255.255.255
B (10) R R H H 16.384 65.536 128.0.0.0
191.255.255.255
C (110) R R R H 2.097.152 256 192.0.0.0 to
223.255.255.255
D (1110) ---- 268.435.456 224.0.0.0 to
239.255.255.255
Res. (1111) reserved reserved 240.0.0.0 to
255.255.255.254
Edgard Jamhour
Prefix Size Interpretation
A
B
C
16M
65K
255
...
10.x.x.x
...
172.68.x.x
...
200.134.51.x
Edgard Jamhour
router
200.0.0. 2
Router has one address assigned to
each interface
NET ID HOST ID
200.0.0. 3 200.0.0. 4 200.0.0. 5
200.0.0. 1
200.0.1. 1
200.0.1. 2 200.0.1. 3 200.0.1. 4 200.0.1. 5
Address Assignment
sub-net
200.0.0
sub-net
200.0.1
Edgard Jamhour
Limitations of the Classful Address Model
...
2000 hosts
Organization A
...
200 hosts
Organization B
Edgard Jamhour
Number of Prefixes and Network Topology
253 computadores
Universidade A
253 computadores
8 Class-C Prefixes
2024 addresses
...
2000 computadores
Universidade A
1 Class-B Prefix
65536 addresses
...
...
Edgard Jamhour
Classless IP Addressing
• Classless Inter-Domain Routing (CIDR)
– Introduced in 1993, CIDR has modified how the size of the network prefix
is determined.
• CIDR introduces the subnet masks, which permits to define prefixes of
any size.
– VLSM (Variable Length Subnet Masking)
IP (32 bits)
Subnet Mask(32 bits)
Edgard Jamhour
Subnet Mask
• Default Masks:
– class A: 255.0.0.0 or /8 or
• 11111111.00000000. 00000000. 00000000.
– class B: 255.255.0.0 or /16 or
• 11111111. 11111111. 00000000. 00000000.
– class C: 255.255.255.0 or /24 or
• 11111111. 11111111. 11111111. 00000000.
0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
IP Address:
10.0.0.1
Subnet Mask:
255.0.0.0
“1” bit in the mask indicates that the corresponding IP bit is a prefix
Prefix: 10. or 10.0.0.0/8
Edgard Jamhour
Subnetting
200.0.0.0
(256 IPs)
200.0.0.255
200.0.0.0/24 200.0.0.0
(128 IPs)
200.0.0.127
200.0.0.128
(128 IPs)
200.0.0.255
200.0.0.0
(64 IPs)
200.0.0.63
200.0.0.64
(64 IPs)
200.0.0.127
200.0.0.0/26
/24 = 255.255.255.0
/25 = 255.255.255.128
/26 = 255.255.255.192
/27 =255.255.255.224
200.0.0.0
(32 IPs)
200.0.0.31
200.0.0.32
(32 IPs)
200.0.0.63 200.0.0.64/26
200.0.0.0/25
200.0.0.128/25
200.0.0.0/27
200.0.0.32/27
Edgard Jamhour
Supernetting
200.0.0.0
(1024 IPs)
200.0.4.255
200.0.0.0
(512 IPs)
200.0.1.255
200.0.0.0/23
/24 = 255.255.255.0
/23 = 255.255.254.0
/22 = 255.255.252.0
200.0.0.0
(256 IPs)
200.0.0.255
200.0.1.0
(256 IPs)
200.0.1.255
200.0.0.0/22
200.0.0.0/24
200.0.1.0/24
200.0.2.0
(512 IPs)
200.0.3.255
200.0.2.0/23 200.0.2.0
(256 IPs)
200.0.2.255
200.0.3.0
(256 IPs)
200.0.3.255
200.0.2.0/24
200.0.3.0/24
Edgard Jamhour
Masks in Decimal Dotted Notation
• A class C mask defines a block of 256 addresses:
– 255.255.255.0.
– 11111111. 11111111. 11111111. 00000000.
• To divide into 2 blocks of 128 addresses, the mask is:
– 255.255.255.128
– 11111111. 11111111. 11111111. 10000000.
• To divide into 4 blocks of 64 addresses, the mask is:
– 255.255.255.192
– 11111111. 11111111. 11111111. 11000000.
• To divide into 8 blocks of 32 addresses, the mask is:
– 255.255.255.224
– 11111111. 11111111. 11111111. 11100000.
• To divide into 16 blocks of 16 addresses, the mask is:
– 255.255.255.240
– 11111111. 11111111. 11111111. 11110000.
Edgard Jamhour
Exercise of Subnet Assignment
How to divide the block
200.1.1.0/24?
r
2
50 computadores
...
Subnet 2
100 computadores
...
Subnet 1
r
3
...
50 computadores
Subnet 3
r
1
Edgard Jamhour
r2
...
...
Solution
r3
...
Subnet 3
200.1.1.128/26
r1
200.1.1.0/24
200.1.1.129
200.1.1.130 200.1.1.179
Subnet 2
200.1.1.192/26
200.1.1.193
200.1.1.194 200.1.1.243
Subnet 1
200.1.1.0/25
200.1.1.2 200.1.1.101 200.1.1.1
Edgard Jamhour
Special IP Addresses
• Can´t be used as unicast addresses:
– First address in a subnet (all host bits = 0)
• Identifies the network
– Last address in the subnet (all host bits = 1)
• Broadcast to the subnet
– 127.0.0.0/8:
• Loopback addresses
– 0.0.0.0:
• Indicates that the host has no address yet (DHCP)
– 255.255.255.255:
• Universal broadcast
Edgard Jamhour
Loopback = Local Communication
• IP packets with destination loopback address are not sent to lower
layers of the TCP / IP stack, but handled locally by the station itself.
• Recommendation of the IETF: 127.0.0.0/8 is reserved for loopback
Transport
Network
Data Link
Physical
process
A
process
B
Port A Port B
127.0.0.1
Edgard Jamhour
Address Resolution
• A network device with a single NIC is called “single-homed”
– NIC = Network Interface Card.
• A network device with multiple NICs is called “multi-homed”
– A router is always multi-homed.
• Every NIC is assigned to two addresses:
– A physical address (MAC) and an IP address.
MAC (00-60-08-16-85-B3)
IP (200.0.0.1) NIC
48-bit address
(6 bytes)
Edgard Jamhour
MAC Address
• The IEEE 802 standard defines two types of MAC
addresses:
– locally administered addresses
• Defined locally by the administrator.
– universal addresses (globally unique)
• Defined by the manufacturer.
1 2 3 4 5 6
OUI
(Organization Unique
Identifier)
Serial
Number
Edgard Jamhour
NIC Address Filtering
MAC
Data Link
Network
IP
MACD = NIC MAC
MACD = BROADCAST (FF.FF.FF.FF.FF.FF)
MACD MACO PAYLOAD CRC
interruption
IPD IPO
Edgard Jamhour
IP and MAC Addresses
Host A
NIC MACA
IPA
Host B
IPB
MACB
MAC B MAC A IP A IP B Payload
packet
Frame
NIC
O.S. O.S.
Edgard Jamhour
Address Resolution Protocol - ARP
• The ARP is a protocol that permits to find the MAC address
corresponding to an IP address.
– Messages are transmitted by the network layer with only the destination IP
address specified.
– The ARP protocol must determine the MAC address of the destination IP
address for the data link layer.
Type
Destination
MAC
Source
MAC
Payload
CRC
Source IP Destination IP Payload Netwok
Layer
Data Link
Layer
Edgard Jamhour
ARP Messages
A B C
ARP
REQUEST
ARP
REPLY
Which is the MAC of IP 200.0.0.2 ? The MAC of the IP 200.0.0.2 is C
200.0.0.3 200.0.0.4 200.0.0.2
Host B ignores the
question ...
Edgard Jamhour
ARP Cache
• Before sending a ARP request message, the ARP protocol searches
the requested IP in the ARP Cache.
– If found, the MAC address is copied from the cache.
– If not, an ARP Request message is sent in broadcast to the subnet.
• Because it is based on a broadcast message, It is only possible to find
the MAC address of a hosts in the same LAN.
ARP Cache
IP address MAC address type
200.0.0.1 00-60-08-16-85-B3 dynamic
200.0.0.3 00-60-08-16-85-ca dynamic
Edgard Jamhour
Duplicated IP Address Detection
A B C
ARP
REQUEST
ARP
REPLY
Which is the MAC of 200.0.0.2 ? The MAC of 200.0.0.2 is C!!!
200.0.0.2 200.0.0.4 200.0.0.2
Edgard Jamhour
Intranet and Internet Communication
LAN
internet
Intra-net communcation
Inter-net communication
LAN
LAN
LAN
Edgard Jamhour
Frame Format
• Intranet communication
– The physical destination address of the frame matches the physical
address of the target computer.
• Internet Communication
– The physical destination address of the frame matches the physical
address of the target computer.
IP SRC
HOST
IP DST
HOST
PAYLOAD
MAC SRC
HOST
MAC DST
HOST
IP SRC
HOST
IP DST
HOST
PAYLOAD
MAC SRC
HOST
MAC
ROUTER
Intranet
Internet
Edgard Jamhour
Internet Communication
• The source and destination IP addresses remain the same when a
packet traverse multiple routers.
• The MAC addresses, however, are modified to mach the elements
participating of each hop.
Source Destination
200.0.0.2/24 210.1.2.3/24 Router1 Router 2
MAC1 MAC2 MAC3 MAC4 MAC5 MAC6
Edgard Jamhour
ARP in Internet Communication
IPA IPD
IPB IPC
A
B
D
B A
C
IPA IPD D C IPA IPD
ARP Request
Who has IPB ?
ARP Request
Who has IPD ?
Edgard Jamhour
Example
source
router router net 10.0.0.0 net 20.0.0.0
destination
net 30.0.0.0
IP: 10.0.0.2 MAC: A
IP: 10.0.0.3 MAC: B
IP: 20.0.0.2 MAC: C
IP: 20.0.0.3 MAC: D
IP: 30.0.0.3 MAC: E IP: 30.0.0.2
MAC: F
frame
First hop: Source: 10.0.0.2 Destination: 30.0.0.2 Source physical address: A
Destination physical address: B
Second hop: Source: 10.0.0.2 Destination: 30.0.0.2 Source physical address: C
Destination physical address: D
Third hop: Source: 10.0.0.2 Destination: 30.0.0.2 Source physical address: E
Destination physical address: F
frame
frame
Edgard Jamhour
Routing Table
200.1.2.0
200.1.2.255
Base Address
Property
Performing an AND operation
between any address in the subnet
range and the netmask results in
the base address.
200.1.2.0/24
Destination
Network
Gateway or
Next Hop
Interface Cost or
Metric
e.g.,
200.1.2.0 255.255.255.0
or 200.1.2.0/24
e.g.,
200.1.2.1
e.g.,
eth0, Fa0/0 or 200.1.2.1
e.g. ,
1 or 1/1
Edgard Jamhour
Destination Network
• Defined as a base address followed by a netmask:
Destinatin Network Range of Addresses
200.134.51.0 (MASK
255.255.255.0)
200.134.51.0 to 200.134.51.255
200.134.0.0 (MASK 255.255.0.0) 200.134.0.0 to 200.134.255.255
200.134.51.6 (MASK
255.255.255.255)
200.134.51.6
0.0.0.0 (MASK 0.0.0.0): DEFAULT
ROUTE OR INTERNET
0.0.0.0 to 255.255.255.255
Edgard Jamhour
Routing Table Example
Router
1
Router
2
INTERNET
Subnet 200.134.51.0/24
Subnet 200.17.98.0/24
200.17.98.1
200.134.51.1
10.0.0.1/30 10.0.0.2/30
200.134.51.25
A
B
Edgard Jamhour
Routing Table of Host B
Destination Address Gateway Interface Cost
200.134.51.0/24 none eth0 or 200.134.51.25 1
200.17.98.0/24 200.134.51.1 eth0 or 200.134.51.25 1
0.0.0.0/0 200.134.51.1 eth0 or 200.134.51.25 1
router
1
200.134.51.25 B
200.134.51.1
eth0
200.134.51.0/24
Edgard Jamhour
How routes tables are tested
• One destination address may match more than one routing table
entry.
• The routing table entries are testes in a specific order, and the first
match decides the destination of the packet:
• 1) Longest prefix match (Maximum prefix length match)
– e.g., /24 is tested before /16, and /16 before /8.
– i.e., prefixes corresponding to smaller block of addresses are tested first
• 2) Lowest cost match
– This criteria is used only when two or more routing tables entries with the
same prefix size match the destination address
Edgard Jamhour
Routing Table of Router 1
Destination Network Gateway Interface Cost
200.134.51.0/24 none 200.134.51.1 0
200.17.98.0/24 none 200.17.98.1 0
0.0.0.0/0 10.0.0.2 10.0.0.1 1
Router
1
Router
2
200.134.51.0/24
200.17.98.0/24
200.17.98.1
200.134.51.1
10.0.0.1/30 10.0.0.2/30
0.0.0.0/0
Edgard Jamhour
Routing Table of Router 2
Destination Network Gateway Interface Cost
200.134.51.0/24 10.0.0.1 10.0.0.2 1
200.17.98.0/24 10.0.0.1 10.0.0.2 1
0.0.0.0/0 10.0.0.6 10.0.0.5 1
router
1
router
2
200.134.51.0/24
200.17.98.0/24
200.17.98.1
200.134.51.1
10.0.0.1/30
10.0.0.2/30
INTERNET
10.0.0.5/30 10.0.0.6/30
Edgard Jamhour
Default Gateway and Default Route
router
1
200.134.51.25 B
200.134.51.1
Destination Address Gateway Interface Cost
200.134.51.0/24 não tem eth0 or 200.134.51.25 1
200.17.98.0/24 200.134.51.1 eth0 or 200.134.51.25 1
0.0.0.0/0 200.134.51.1 eth0 or 200.134.51.25 1
eth0
200.134.51.0/24
The router 1 is the default gateway for
hosts in the subnet 200.134.51.1
because it is the first hop to all other
networks
Edgard Jamhour
Multiple Routes and Cost
R1 R2
INTERNET
200.134.51.0/24
200.17.98.0/24
10.0.0.1/30
10.0.0.2/30
R3
10 Mbps
100 Mbps 100 Mbps
10.0.0.5/30 10.0.0.6/30
Destination Network Gateway Interface Cost
0.0.0.0/0 10.0.0.6 10.0.0.5 1 (10)
0.0.0.0/0 10.0.0.2 10.0.0.1 2 (2)
200.134.51.0/24 10.0.0.6 10.0.0.5 2 (11)
200.134.51.0/24 10.0.0.2 10.0.0.1 1 (1)
200.17.98.0/24 Não tem 200.17.98.1 0
Edgard Jamhour
Route Aggregation
router
1
router
2
200.1.2.128/25
200.1.2.0/25
200.1.2.1
200.1.2.129
10.0.0.1/30
10.0.0.2/30
200.1.2.130
A
B
200.1.2.2
INTERNET
10.0.0.5/30 10.0.0.6/30
Edgard Jamhour
Routing Tables with Route Aggregation
Destination Network Gateway Interface Cost
200.1.2.0/25 none 200.1.2.2 0
0.0.0.0/0 200.1.2.1 200.1.2.2 1
Destination Network Gateway Interface Cost
200.1.2.0/25 none 200.1.2.1 0
200.1.2.128/25 none 200.1.2.129 0
0.0.0.0/0 10.0.0.2 10.0.0.1 1
Destination Network Gateway Interface Cost
200.1.2.0/24 10.0.0.1 10.0.0.2 1
0.0.0.0/0 10.0.0.6 10.0.0.5 1
Computer A
Router 1
Router 2
top related