Internetworking

Anuncio
Internetworking
Teoría de las Comunicaciones
18 de Abril de 2012
• Simple Internetworking (IP)
–
–
–
–
IP Internet
IP addresses
Datagram forwarding in IP
ARP
• Global Internet
– Subnetting
– Classless routing (CIDR)
– NAT
• Ejercicios
1
Internetworking
Important problems that must be addressed when
connecting networks
• Heterogeneity
– Users on one type of network want to be able to communicate with
users on other type of networks.
– Establishing connectivity between hosts on two different networks
may require traversing several other networks in between, each of
which may be of yet another type.
• Scale
– Routing: How can you find an efficient path through a network
with millions, or perhaps billions, of nodes?
– Addressing: The task of providing suitable identifiers for all those
nodes.
2
IP Internet.
Internet Protocol
3
Acceso a un servidor Web
4
IP datagram encapsulation
5
Internetworking IP
Outline
Best effort service model
Global addressing scheme
6
Service model
• Connectionless (datagram-based)
• Best-effort delivery (unreliable
service)
– packets are lost.
– packets are delivered out of order.
– duplicate copies of a packet are
delivered.
– packets can be delayed for a long time.
7
Datagram switching
• No connection setup phase.
• Each packet forwarded independently .
• Sometimes called connectionless model.
Host D
• Analogy: postal
system.
• Each switch
maintains a
forwarding
(routing) table.
0
3
Host C
2
Host E
Switch 1
1
Host F
3
2 Switch 2
1
0
Host A
0 Switch 3
Host G
1
Host B
3
2
Host H
8
Datagram model
• There is no round trip delay waiting for
connection setup; a host can send data as soon as it
is ready.
• Source host has no way of knowing if the network
is capable of delivering a packet or if the
destination host is even up.
• Since packets are treated independently, it is
possible to route around link and node failures.
• Since every packet must carry the full address of
the destination, the overhead per packet is higher
than for the connection-oriented model.
9
IP Internet. Enlaces
a) PPP - HDLC - etc. (sliding window).
b) Ethernet (802.3) - Token Rings (802.5, FDDI) Wireless (802.11) - etc. (shared-media networks).
10
IP Internet
Network 1 (Ethernet)
• Concatenation of Networks
H1
H7
H3
H2
R3
H8
Network 4
(point-to-point)
Network 2 (Ethernet)
R1
R2
H4
Network 3 (FDDI)
• Protocol Stack
H6
H5
H1
H8
TCP
R1
IP
ETH
R2
IP
ETH
R3
IP
FDDI
FDDI
IP
PPP
PPP
TCP
IP
ETH
ETH
11
IP header
0
4
Version
8
HLen
16
TOS
31
Length
Ident
TTL
19
Flags
Protocol
Offset
Checksum
SourceAddr
DestinationAddr
Options (variable)
Pad
(variable)
Data
•
•
•
•
•
•
•
•
VERSION: Versión de protocolo IP (4).
HLEN: Longitud del header (medida en palabras de 32 bits).
TOS: Tipo de Servicio. Mecanismo de prioridad. En ppio. es ignorado por la mayoría de los routers.
Length: Longitud total del datagrama (en bytes). Max. size = 65.536 bytes.
Ident., Flags, Offset: Son campos usados en la fragmentación de datagramas.
TTL: Time To Live.
Protocol: Identifica el protocolo de capa 4 (TCP, UDP, etc).
Checksum: Verifica la integridad del encabezado.
12
Fragmentation and reassembly
• Each network has some MTU.
• Design decisions
–
–
–
–
–
–
fragment when necessary (MTU < Datagram).
try to avoid fragmentation at source host.
re-fragmentation is possible.
fragments are self-contained datagrams.
delay reassembly until destination host.
do not recover from lost fragments.
13
Fragmentation and reassembly
Start of header
Ident = x
0 Offset = 0
Rest of header
(a)
H1
R1
R2
R3
R1
R2
R3
1400 data bytes
Start of header
H8
Ident = x
1 Offset = 0
Rest of header
512 data bytes
(b)
ETH IP (1400)
FDDI IP (1400)
PPP IP (512)
ETH IP (512)
PPP IP (512)
ETH IP (512)
PPP IP (376)
ETH IP (376)
Start of header
Ident = x
1 Offset = 64
Rest of header
512 data bytes
Start of header
Ident = x
0 Offset = 128
Rest of header
376 data bytes
14
IP addresses
15
The Internet is an interconnected
collection of many networks
16
Global addresses
• Properties
– globally unique
– hierarchical: network + host
• Dot notation
– 10.3.2.4
– 128.96.33.81
– 192.12.69.77
17
IP address formats
18
Special IP addresses
19
Private IP addresses
Three ranges of IP addresses have been declared as
private. Companies may use them internally as they
wish. The only rule is that no packets containing these
addresses may appear on the Internet itself. The three
reserved ranges are:
10.0.0.0 – 10.255.255.255/8 (16.777.216 hosts)
172.16.0.0 – 172.31.255.255/12 (1.048.576 hosts)
192.168.0.0 – 192.168.255.255/16 (65.536 hosts)
RFC 1918: Address Allocation for Private Internets
20
¿Preguntas?
21
Datagram forwarding in IP
22
The main points to bear in mind as we discuss the
forwarding of IP datagrams are the following:
• Every IP datagram contains the IP address of the
destination host.
• The “network part” of an IP address uniquely identifies a
single physical network that is part of the larger Internet.
• All hosts and routers that share the same network part of
their address are connected to the same physical network
and can thus communicate with each other by sending
frames over that network.
• Every physical network that is part of the Internet has at
least one router that, by definition, is also connected to at
least one other physical network; this router can exchange
packets with hosts or routers on either network.
23
Datagram forwarding
• Strategy
– every datagram contains destination’s address.
– if connected to destination network, then forward
to host.
– if not directly connected, then forward to some
router.
– forwarding table maps network number into next
hop.
– each host has a default router.
– each router maintains a forwarding table.
24
Example forwarding table for router R2
Network 1 (Ethernet)
H1
H7
H3
H2
R3
H8
Network 4
(point-to-point)
Network 2 (Ethernet)
R1
R2
H4
Network 3 (FDDI)
H5
H6
25
Complete forwarding table for router R2
Network 1 (Ethernet)
H1
H7
H3
H2
R3
H8
Network 4
(point-to-point)
Network 2 (Ethernet)
R1
R2
H4
Network 3 (FDDI)
H5
H6
26
We can describe the datagram forwarding
algorithm in the following way
if (NetworkNum of destination = NetworkNum of one of my interfaces) then
deliver packet to destination over that interface
else
if (NetworkNum of destination is in my forwarding table) then
deliver packet to NextHop router
else
deliver packet to default router
• For a host with only one interface and only a default router in its forwarding
table, this simplifies to
if (NetworkNum of destination = my NetworkNum) then
deliver packet to destination directly
else
deliver packet to default router
27
ARP
Address Resolution Protocol
28
Why address resolution is necessary
29
Dynamic address resolution
30
Address translation
• Map IP addresses into physical addresses
• destination host.
• next hop router.
• ARP
• table of IP to physical address bindings.
• broadcast request if IP address not in table.
• target machine responds with its physical
address.
• table entries are discarded if not refreshed.
31
Arp table: example
32
Arp table: example
33
Address Resolution Protocol (ARP) transaction process
34
Address Resolution Protocol (ARP)
Message format
35
ARP details
• Request Format
–
–
–
–
–
Hardware Type: type of physical network (e.g., Ethernet).
Protocol Type: type of higher layer protocol (e.g., IP).
HLEN & PLEN: length of physical and protocol addresses.
Operation: request or response.
Source/Target-Physical/Protocol addresses.
• Notes
–
–
–
–
table entries timeout in about 10 minutes.
update table with source when you are the target.
update table if already have an entry.
do not refresh table entries upon reference.
36
¿Preguntas?
37
Subnetting
38
Subnet addressing
• network + subnet number and host.
• The subnet mask can be written as 255.255.255.0
• An alternative notation is /24 to indicate that the subnet mask is 24 bits
long.
39
An example of subnetting
40
An example of subnetting
http://jodies.de/ipcalc
• Netmask: 255.255.255.128 = 25 11111111.11111111.11111111.1 0000000
• Network:
Broadcast:
HostMin:
HostMax:
Hosts/Net:
128.96.34.0/25
128.96.34.127
128.96.34.1
128.96.34.126
126
10000000.01100000.00100010.0 0000000
10000000.01100000.00100010.0 1111111
10000000.01100000.00100010.0 0000001
10000000.01100000.00100010.0 1111110
• Network:
Broadcast:
HostMin:
HostMax:
Hosts/Net:
128.96.34.128/25 10000000.01100000.00100010.1 0000000
128.96.34.255 10000000.01100000.00100010.1 1111111
128.96.34.129 10000000.01100000.00100010.1 0000001
128.96.34.254 10000000.01100000.00100010.1 1111110
126
41
An example of subnetting
•
•
•
If H1 is sending to H2, then H1 ANDs its subnet mask (255.255.255.128) with
the address for H2 (128.96.34.139) to obtain 128.96.34.128.
This does not match the subnet number for H1 (128.96.34.0) so H1 knows that
H2 is on a different subnet.
Since H1 cannot deliver the packet to H2 directly over the subnet, it sends the
packet to its default router R1.
42
An example of subnetting
• R1would AND H2’s address (128.96.34.139) with the subnet mask of
the first entry(255.255.255.128) and compare the result
(128.96.34.128) with the network number for that entry (128.96.34.0).
• Since this is not a match, it proceeds to the next entry.
• This time a match does occur, so R1 delivers the datagram to H2 using
interface 1,which is the interface connected to the same network as H2.
43
We can now describe the datagram
forwarding algorithm in the following way:
D=destination IP address
for each forwarding table entry SubnetNumber,
SubnetMask, NextHop
D1=SubnetMask & D
if D1 =SubnetNumber
if NextHop is an interface
deliver datagram directly to destination
else
deliver datagram to NextHop (a router)
44
Classless Routing (CIDR)
Classless InterDomain Routing
45
Today’s multibackbone Internet
46
Route aggregation with CIDR
47
IP forwarding revisited
• CIDR means that prefixes may be of any length, from 2 to 32
bits.
• It is possible to have prefixes in the forwarding table that
“overlap,” in the sense that some addresses may match more
than one prefix.
• For example, we might find both 171.69 (a 16-bit prefix) and
171.69.10 (a 24-bit prefix) in the forwarding table of a single
router.
• In this case, a packet destined to, say, 171.69.10.5 clearly
matches both prefixes. The rule in this case is based on the
principle of “longest match”; that is, the packet matches the
longest prefix, which would be 171.69.10 in this example.
• The task of efficiently finding the longest match between an IP
address and the variable-length prefixes in a forwarding table
has been a fruitful field of research in recent years.
48
Routing table: example
49
Routing table: example
50
http://www.subnet-calculator.com/
51
¿Preguntas?
52
NAT
Network Address Translation
53
NAT
• Developed by Cisco, Network Address
Translation is used by a device
(firewall, router or computer) that sits
between an internal network and the
rest of the world.
• NAT has many forms and can work in
several ways:
54
Static NAT
• Mapping an unregistered IP address to a registered IP
address on a one-to-one basis. Particularly useful when a
device needs to be accessible from outside the network.
• In static NAT, the computer with the IP address of
192.168.32.10 will always translate to 213.18.123.110.
55
Dynamic NAT
• Maps an unregistered IP address to a registered IP address
from a group of registered IP addresses.
• In dynamic NAT, the computer with the IP address
192.168.32.10 will translate to the first available address in
the range from 213.18.123.100 to 213.18.123.150.
56
NAT: example
57
¿Preguntas?
58
Ejercicios
59
Ejercicio 1
Mostrar las tablas de forwarding de los routers para la interconexión de
todos los puntos de la red
172.18.3.0/24
200.10.161.0/24
60
Ejercicio 1: resolución
R1
R2
R3
Network
Next hop
Network
Next hop
172.18.3.0/24
IF 0/1
172.18.3.0/24
10.4.2.1
10.4.2.0/27
IF 0/0
10.4.2.0/27
IF 0/0
10.4.2.0/27
200.3.113.62
200.3.113.60/30 10.4.2.2
200.3.113.60/30
IF 0/1
200.3.113.60/30
IF 0/0
200.10.161.0/24 10.4.2.2
200.10.161.0/24 200.3.113.61
200.10.161.0/24
IF 0/1
200.41.68.44/30 10.4.2.2
200.41.68.44/30
IF 1/1
200.41.68.44/30 200.3.113.62
Default
200.41.68.45
Default
10.4.2.2
Network
Next hop
172.18.3.0/24 200.3.113.62
Default
200.3.113.62
61
Ejercicio 2
Una empresa tiene su sede central en Buenos Aires y una sucursal mas
pequeña en la ciudad de La Plata. Cada una de ellas tendrá una red
local, la de BA de 100 equipos entre computadoras personales y
servidores, y la de La Plata de 45 PCs. Se deben conectar las dos sedes
mediante un enlace WAN punto a punto. Además, la sede de BA
tendrá otra LAN con 30 servidores para una Intranet que no requerirá
acceso a Internet. El enlace a Internet de toda la red será contratado a
un proveedor de servicios en BA. Se requiere además reservar una
subred de 20 direcciones públicas para uso futuro. El proveedor le ha
asignado a la empresa la red IP 200.10.161.0/24 para ser utilizada.
Se pide:
Diseñe el diagrama lógico de la red, incluyendo el equipamiento
necesario de nivel IP.
Diseñe el plan de numeración para la red realizando el subnetting
que considere necesario.
62
Ejercicio 2: resolución
¿Cuántas direcciones IP
necesito para cada subred ?
1.1.
2.2.
3.3.
4.4.
BABA-100
100equipos
equiposentre
entrecomputadoras
computadoraspersonales
personalesyyservidores.
servidores.
La
Plata
45
PCs.
La Plata - 45 PCs.
Enlace
EnlaceWAN
WANpunto
puntoaapunto
puntoentre
entreellas
ellas
BA
otra
LAN
con
30
servidores
para
BA - otra LAN con 30 servidores parauna
unaIntranet
Intranetque
queno
no
requerirá
acceso
a
Internet.
requerirá acceso a Internet.
5.5. Reservar
Reservaruna
unasubred
subredde
de20
20direcciones
direccionespúblicas
públicaspara
parauso
usofuturo.
futuro.
6.6. Enlace
a
Internet
de
toda
la
red
será
contratado
a
un
ISP
en
Enlace a Internet de toda la red será contratado a un ISP enBA.
BA.
ISP
101
46
WAN BA-LP
LAN BA
LAN LP
2
ROUTER BA
LAN BA PRIVADA
ROUTER LP
20 reservadas
31
63
0
128
200.10.161.0/25
(128)
101
INTERNET
ISP
192
224
228
255
ElElproveedor
proveedorleleha
haasignado
asignadoaa 200.10.161.128/26
lalaempresa
(64)
empresalalared
red
200.10.161.0/24
200.10.161.0/24
46
Hay
que
Hay quesubnetearla
subnetearlayyasignar
asignar
las
lassubredes.
subredes.
200.10.161.224/30
(4)
2
WAN BA-LP
LAN BA
ROUTER BA
LAN LP
ROUTER LP
LAN BA PRIVADA
31
192.168.5.0/24
(256)
20 reservadas
200.10.161.192/27
(32)
64
¿Preguntas?
65
Descargar