Mobile Communications Fundamental Networkingmricardo/07_08/cmov-mieec/slides/fundamental... ·...

44
Networking 1 Mobile Communications Fundamental Networking Manuel P. Ricardo Faculdade de Engenharia da Universidade do Porto

Transcript of Mobile Communications Fundamental Networkingmricardo/07_08/cmov-mieec/slides/fundamental... ·...

Networking 1

Mobile Communications

Fundamental Networking

Manuel P. Ricardo

Faculdade de Engenharia da Universidade do Porto

Networking 2

♦ What networking concepts shall I have present from previous courses?

♦ What are the differences between L2 and L3 networks?

♦ What is a tunnel? What is a virtual network? Why are they relevant?

♦ What are the differences between IPv4 and IPv6?

Networking 3Switching: Circuits, Virtual Circuits, Datagram

Networking 4

Circuit Switching♦ Technologies: ISDN: Basic Rate Access, E1 � time slots for 64 kbit/s channels♦ Path defined during call establishment, based on the called number♦ Switching

» Exchange of time slots» In time and in space» Inputs required to be synchronised

Networking 5

Virtual Circuit Switching♦ Technologies: ATM, MPLS♦ Path

» defined during the virtual circuit establishment» Defined as a set of nodes, ports, labels

♦ Switching » Cells, packets» Exchange of labels

Tabela de translação deportas / canais virtuais

1

M

a

t

1

N

2

t

Entrada

M

abc

yzc

1N2

21N

khm

nng

Saída

1

Porta CV Porta CV

comutaçãoespacial

comutaçãode etiqueta

b c c

y c z y

controlo decomutação

controlo decomutação

g h

n

k kn

m

g

cabeçalho

dados

a, b, c, ... indicador de canal virtual

b a

Networking 6

Packet Switching♦ Technologies: Ethernet, IP

♦ Path defined by packet destination address

Networking 7

To Think About ♦ Suppose terminal a moves from port 1 to port 2

» What needs to be done so that terminal a can continue receiving packets?

Networking 8

L2 Networking – Frame Formats

Ethernet

PPP

7x 10101010 10101011

Bit stuffing – 5 1s seguidos ���� emissor introduz 0

Protocolo=IP

Networking 9

L2 Networking - Bridge♦ Interconnects

» 2 LAN technologies» 2 segments of the same technology

♦ Bridge builds forwarding tables automatically � Address learning

Source Address of received frame is associated to a bridge input port� station reachable trough that port

♦ Frame forwarding» When a frame is received, its Destination Address is analysed

– If address is associated to a port � frame forwarded to that port

– If not � frame transmitted through all but the input port

Networking 10L2 Networking - Single Tree Required

• Ethernet frame – No hop-count

– Could loop in a L2 mis-configured network

– Same for broadcast packet

• Layer 2 network – Tree topology– Single path between every pair of

stations

• Spanning Tree (ST) Protocol– Running in bridges– Helps building the spanning tree– Blocks ports

Networking 11

Ethernet SwitchThe computer attached to a port gets the illusion to have

» its own LAN segment

» its LAN segment bridged to all the other segments

Networking 12

Virtual LANs♦ One bridge/switch simulates multiple LANs / broadcast domains

♦ One LAN may be extended to other bridges

w

y

VLAN 100

VLAN 200B1

x

z

VLAN 100

VLAN 200B2

[da=w; sa=x; data]

[da=w; sa=x; vlanid=100; data]

[da=w; sa=x; data]

Networking 13

L3 Networking – Packet Formats

Version HLen TOS Length

Ident Flags Offset

TTL Protocol Checksum

SourceAddr

DestinationAddr

Options (variable)Pad

(variable)

0 4 8 16 19 31

Data

Version Traffic Class Flow Label

Payload Lengtht Next Header Hop Limit

SourceAddr (4 words)

DestinationAddr (4 words)

Options (variable number)

0 4 8 16 24 31

Data

IPv4 IPv6

Networking 14

L3 Networking – Router

3ª generation router

Networking 15

L3 Networking – Multiple Trees …♦ Every router

» finds the shortest path to the other routers and their attached networks

» Calculates its Shortest Path Tree (SPT)

♦ Routing protocol» Run in routers

» Helps routers build their SPT

» RIP, OSPF, BGP

Destination Cost NextHopA 1 AC 1 CD 2 CE 2 AF 2 AG 3 A

B’s routing view

D

G

A

F

E

B

C

Networking 16

TCP♦ Point to connection between a client and a server; port-to-port

♦ Reliable, flow control

♦ Congestion control

Sender

Data (SequenceNum)

Acknowledgment +AdvertisedWindow

Receiver

Networking 17

Multimedia Traffic - TaxonomyApplications

Elastic

Intolerant

Real time

Tolerant

Nonadaptive Adaptive

Delay adaptiveRate adaptive

(variation of the packet end-to-end delay)

(packet loss)

(application reaction to packet loss)

(type of reaction)

Networking 18

RTP+RTCP/UDP♦ Multimedia traffic

♦ Application-Level Framing

♦ Data Packets (RTP)» sequence number

» timestamp (app defines “tick”)

» transported as UDP packets

♦ Control Packets (RTCP)» sent periodically

» report loss rate (fraction of packets received since last report)

» report measured jitter

Networking 19Traditional TCP/IP Communications Stack

T1IPTCPAPP

T1 | T2 T2 | T3IP

T3 | T4IP

T5IPTCPAPP

host bridge router router host

T4 | T5

bridge

IEEE MAC addressbased

switching

IETF IP addressbased

switching

Networking 20

Tunnel IP-in-IP

T1IP

TCPAPP

T1 | T2 T2 | T3IPT3 | T4 T5

IPTCPAPP

H1 bridge R1 R2 Server

T4 | T5

bridge

IP IPIP

outer IP header inner IP header data

DA= 2nd IP address of R2SA= 2nd IP address of H1

TTLIP identification

IP-in-IP IP checksumflags fragment offset

lengthTOSver. IHL

DA= ServerSA=H1

TTLIP identification

lay. 4 prot. IP checksumflags fragment offset

lengthTOSver. IHL

TCP/UDP/ ... payload

Networking 21

Tunnel PPP over IP (E.g PPTP)

» GRE – virtual point-to-point link – encapsulates a variety of

network layer protocols– routers at remote points– over an IP network

» PPP adequate for – Authentication– Transporting IP packets

T1IP

TCPAPP

T1 | T2 T2 | T3

IPT3 | T4 T5

IPTCPAPP

H1 bridge R1 R2 Server

T4 | T5

bridge

IP IP

IP

PPPGREGRE

PPP

Networking 22

PPP over Ethernet

- In an ADSL router/modem the protocols of Host PC and ADSL modem are combined in a single network element

Networking 23

IPv6

Networking 24

A Necessidade de um Novo IP♦ IPv4

– Espaço de endereçamento pequeno

– Usado de forma descontínua

– Algumas soluções para resolver estes problemas

redes privadas (NAT), agregação de redes (CDIR)

♦ IETF desenvolve nova versão do IP: IPv6– Mesmos princípios arquitectónicos do IPv4

– Muitas melhorias

– Implica mudança do cabeçalho

♦ O IPv6 é relevante para as Comunicações Móveis– 1 endereço IP para cada dispositivo ….

Networking 25IPv6 – Melhorias Relativamente aoIPv4

» Endereços de 128 bits (16 octetos, 8 shorts ). Sem classes

» Suporte de QoS facilitado (descrição de fluxos de tempo real)

» Funções de segurança (autenticação das partes, encriptação dos dados)

» Autoconfiguração (Plug-n-play)

» Routing

» Multicast

Networking 26

♦ 8 x 16 bit, hexadecimal. Separados por :

47CD : 1234 : 3200 : 0000 : 0000 : 4325 : B792 : 0428

♦ Formato comprimido: FF01:0:0:0:0:0:0:43 ���� FF01::43

♦ Compatibilidade com IPv4: 0:0:0:0:0:0:13.1.68.3 ou ::13.1.68.3

♦ Endereço de loopback: ::1

♦ Prefixos de rede com notação de / , como no v4» FEDC:BA98:7600::/40 ���� prefixo de rede = 40 bits

Representação dos Endereços

Networking 27

Reserva de Endereços IPv6Allocation Prefix Fraction of

(binary) Address Space----------------------------------- -------- -------------Unassigned 0000 0000 1/256Unassigned 0000 0001 1/256Reserved for NSAP Allocation 0000 001 1/128Unassigned 0000 01 1/64Unassigned 0000 1 1/32Unassigned 0001 1/16Global Unicast 001 1/8 Unassigned 010 1/8Unassigned 011 1/8Unassigned 100 1/8Unassigned 101 1/8Unassigned 110 1/8Unassigned 1110 1/16Unassigned 1111 0 1/32Unassigned 1111 10 1/64Unassigned 1111 110 1/128Unassigned 1111 1110 0 1/512Link-Local Unicast Addresses 1111 1110 10 1/1024Site-Local Unicast Addresses 1111 1110 11 1/1024Multicast Addresses 1111 1111 1/256

Networking 28Link-Local, Site-Local, Global Unicast, Anycast

» Link-Local– Usado para comunicação entre nós na mesma ligação/LAN– Construído a partir do endereço MAC da carta– Routers não encaminham pacotes com endereços de destino Link-Local

» Site-Local– Usados dentro de um site/empresa para construção de redes privadas– Routers não encaminham pacotes com endereços de destino Site-Local para fora do Site– New implementations must use it as Global Unicast

» Global Unicast– Endereços globais– Endereço: prefixo de rede + identificador do computador– Prefixos estruturados

agregação de redes; menos entradas nas tabelas de encaminhamento

» Anycast– Endereço de grupo; pacote recebido por qualquer elemento do grupo

» Multicast– Endereço de grupo; pacote recebido por todos os elementos do grupo

Networking 29

Formato dos Endereços| n bits | m bits | 128-n-m bits | Global Unicast Address+------------------------+-----------+----------------------------+ (2000::/3)|001 global rout prefix | subnet ID | interface ID |+------------------------+-----------+----------------------------+

| 10 |

| bits | 54 bits | 64 bits | Link-Local Unicast address+----------+-------------------------+----------------------------+ (fe80::/10)|1111111010| 0 | interface ID | +----------+-------------------------+----------------------------+

| 10 |

| bits | 54 bits | 64 bits | Site-Local Unicast address+----------+-------------------------+----------------------------+ (fec0::/10) |1111111011| subnet ID | interface ID |+----------+-------------------------+----------------------------+

| n bits | 128-n bits | Anycast address+------------------------------------------------+----------------+| subnet prefix | 00000000000000 |+------------------------------------------------+----------------+

| 8 | 4 | 4 | 112 bits |+------ -+----+----+---------------------------------------------+|11111111|flgs|scop| group ID |+--------+----+----+---------------------------------------------+

Multicast addressgrupo permanente ou nãoScope – link, site, global, ...

(ff::/8)

Networking 30

Formato dos Pacotes IPv4 e IPv6

Version HLen TOS Length

Ident Flags Offset

TTL Protocol Checksum

SourceAddr

DestinationAddr

Options (variable)Pad

(variable)

0 4 8 16 19 31

Data

Version Traffic Class Flow Label

Payload Lengtht Next Header Hop Limit

SourceAddr (4 words)

DestinationAddr (4 words)

Options (variable number)

0 4 8 16 24 31

Data

IPv4 IPv6

Networking 31

Cabeçalho do Pacote IPv6♦ Flow label � identifica fluxo pacotes

» QoS, reserva de recursos

» pacotes com tratamento idêntico

♦ Payload length» não inclui cabeçalho

♦ Hop limit = TTL (v4)

♦ Next header» Identifica protocolo/extensão seguinte

♦ Options � cabeçalhos de extensão

Version Traffic Class Flow Label

Payload Lengtht Next Header Hop Limit

SourceAddr (4 words)

DestinationAddr (4 words)

Options (variable number)

0 4 8 16 24 31

Data

Networking 32

Cabeçalhos de Extensão

IPv6 HeaderNext Header = TCP

TCP header + data

Routing HeaderNext Header = TCP

TCP header + dataIPv6 HeaderNext Header = Routing

IPv6 HeaderNext Header = Routing

Routing HeaderNext Header = Fragment

Fragment HeaderNext Header = TCP

Fragment ofTCP header + data

IPv6 Hop-by-hop TCPDestination Routing Fragment Authenticate. ESP

Networking 33

Tipos de Cabeçalhos de Extensão» Hop-by-hop

informação adicional, examinada por todos os nós atravessados por pacote;

outros cabeçalhos examinados só no destino ou em nós pré-definidos

» Destination: Informação para o computador de destino

» Routing: Lista de nós a visitar pelo pacote

» Fragmentation: Feita pelo emissor do pacote, que deve descobrir o MTU

» Authentication: Autenticação (assinatura) do cabeçalho do pacote

» ESP: Informação sobre crifragem dados

Networking 34IPv6 – Diferenças em relação aoIPv4

» Não há checksum� erros detectados noutra camadaRecurso ao pseudo header no TCP ou UDP

» Cabeçalho de comprimento fixoDiminui tempo de processamento do pacote

» Não há informação de fragmentação/reassemblagem– Pacote de comprimento incorrecto é eliminado

– Mensagem enviada para emissor, pedindo para reduzir comprimento de pacote

» Emissor responsável pela descoberta do MTU

» Segmentação possível em cabeçalho de extensão

» Segurança suportada nativamente

Networking 35

Extensão de Routing» Sem este cabeçalho � encaminhamento igual a IPv4

» Extensão de routing– Contém lista de nós a visitar pelo pacote

– semelhante ao Source Routing, do v4

0 8 16 24 31

Next header Hd. Ext. Len 0 Segmnts left

1 – 24 addresses

Networking 36Pacote enviado de S para D, por I1, I2, I3As the packet travels from S to I1:

Source Address = S Hdr Ext Len = 6Destination Address = I1 Segments Left = 3

Address[1] = I2Address[2] = I3Address[3] = D

As the packet travels from I1 to I2:

Source Address = S Hdr Ext Len = 6Destination Address = I2 Segments Left = 2

Address[1] = I1Address[2] = I3Address[3] = D

As the packet travels from I2 to I3:

Source Address = S Hdr Ext Len = 6Destination Address = I3 Segments Left = 1

Address[1] = I1Address[2] = I2Address[3] = D

As the packet travels from I3 to D:

Source Address = S Hdr Ext Len = 6Destination Address = D Segments Left = 0

Address[1] = I1Address[2] = I2Address[3] = I3

Lista de nós

intermédiosvisitados

Networking 37

Exemplo – Rede no Lab de Redesquadro

porta

banc_3 banc_6 pc3---[HUB]---pc2----+ +----pc2---[HUB]---pc32000:0:0:3::/64 | | 2000:0:0:6::/64

| |banc_2 | | banc_5pc3---[HUB]---pc2--[HUB]-+ +-[HUB]--pc2---[HUB]---pc32000:0:0:2::/64 | | | | 2000:0:0:5::/64

| | | |banc_1 | | | | banc_4pc3---[HUB]---pc2----+ | | +----pc2---[HUB]---pc32000:0:0:1::/64 | | 2000:0:0:4::/64

| |2000:0:0:e::/64| |2000:0:0:d::/64

| |[routerv6]

quadroporta

banc_3 banc_6 pc3---[HUB]---pc2----+ +----pc2---[HUB]---pc32000:0:0:3::/64 | | 2000:0:0:6::/64

| |banc_2 | | banc_5pc3---[HUB]---pc2--[HUB]-+ +-[HUB]--pc2---[HUB]---pc32000:0:0:2::/64 | | | | 2000:0:0:5::/64

| | | |banc_1 | | | | banc_4pc3---[HUB]---pc2----+ | | +----pc2---[HUB]---pc32000:0:0:1::/64 | | 2000:0:0:4::/64

| |2000:0:0:e::/64| |2000:0:0:d::/64

| |[routerv6]

2000:0:0:1::12000:0:0:1::aa 2000:0:0:e::1

Networking 38Configuração da bancada 1, pc3 (tux13)tux13:~# /sbin/ifconfig eth0 inet6 add 2000:0:0:1::1/64tux13:~# ifconfig eth0eth0 Link encap:Ethernet HWaddr 00:C0:DF:08:D5:99

inet addr:172.16.1.13 Bcast:172.16.1.255 Mask:255.255.255.0inet6 addr: 2000:0:0:1::1/64 Scope:Globalinet6 addr: fe80::2c0:dfff:fe08:d599/10 Scope:LinkUP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1RX packets:81403 errors:0 dropped:0 overruns:0 frame:0TX packets:2429 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:100RX bytes:4981344 (4.7 MiB) TX bytes:260692 (254.5 KiB)Interrupt:5

tux13:~# /sbin/route -A inet6 add 2000::/3 gw 2000:0:0:1::aatux13:~# route -A inet6Kernel IPv6 routing tableDestination NextHop Flags Metric Ref Use Iface::1/128 :: U 0 0 0 lo2000:0:0:1::1/128 :: U 0 0 0 lo2000:0:0:1::/64 :: UA 256 0 0 eth02000::/3 2000:0:0:1::aa UG 1 0 0 eth0 fe80::2c0:dfff:fe08:d599/128 :: U 0 0 0 lofe80::/10 :: UA 256 0 0 eth0ff00::/8 :: UA 256 0 0 eth0::/0 :: UDA 256 0 0 eth0

tux13:~# /sbin/ifconfig eth0 inet6 add 2000:0:0:1::1/64tux13:~# ifconfig eth0eth0 Link encap:Ethernet HWaddr 00:C0:DF:08:D5:99

inet addr:172.16.1.13 Bcast:172.16.1.255 Mask:255.255.255.0inet6 addr: 2000:0:0:1::1/64 Scope:Globalinet6 addr: fe80::2c0:dfff:fe08:d599/10 Scope:LinkUP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1RX packets:81403 errors:0 dropped:0 overruns:0 frame:0TX packets:2429 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:100RX bytes:4981344 (4.7 MiB) TX bytes:260692 (254.5 KiB)Interrupt:5

tux13:~# /sbin/route -A inet6 add 2000::/3 gw 2000:0:0:1::aatux13:~# route -A inet6Kernel IPv6 routing tableDestination NextHop Flags Metric Ref Use Iface::1/128 :: U 0 0 0 lo2000:0:0:1::1/128 :: U 0 0 0 lo2000:0:0:1::/64 :: UA 256 0 0 eth02000::/3 2000:0:0:1::aa UG 1 0 0 eth0 fe80::2c0:dfff:fe08:d599/128 :: U 0 0 0 lofe80::/10 :: UA 256 0 0 eth0ff00::/8 :: UA 256 0 0 eth0::/0 :: UDA 256 0 0 eth0

Networking 39

Identificador IEEE EUI-64 Method to create a IEEE EUI-64 identifier from an IEEE 48bit MAC identifier. This is to insert two octets, with hexadecimal values of 0xFF and 0xFE, in the middle of the 48 bit MAC (between the company_id and vendor supplied id). For example, the 48 bit IEEE MAC with global scope:

|0 1|1 3|3 4||0 5|6 1|2 7|+----------------+----------------+----------------+ |cccccc0gcccccccc|ccccccccmmmmmmmm|mmmmmmmmmmmmmmmm|+----------------+----------------+----------------+ 00:C0:DF:08:D5:99

where "c" are the bits of the assigned company_id, "0" is the value of theuniversal/local bit to indicate global scope, "g" is individual/group bit, and "m" are the bits of the manufacturer-selected extension identifier. The interface identifier would be of the form:

|0 1|1 3|3 4|4 6||0 5|6 1|2 7|8 3|+----------------+----------------+----------------+----------------+|cccccc1gcccccccc|cccccccc11111111|11111110mmmmmmmm|mmmmmmmmmmmmmmmm|+----------------+----------------+----------------+----------------+

fe80::2c0:dfff:fe08:d599

Networking 40

Transição do v4 para o v6» Computador opera em dupla pilha de protocolos (RFC2893)

� Computador v6 funciona também em v4

� Versão indica pilha a usar

» Dois computadores v6 podem usar rede v4 (RFC2893)� Adição de 96 0s a um endereço v4 de 32-bit. Ex. ::10.0.0.1

� 2 computadores falam v6 entre si, mesmo que a rede seja toda v4

� túnel (v4 contendo v6) entre computadores

» Computador v6 consegue falar com computador v4� Usado endereço v6 mapeável em endereço v4

� Adição de 2 bytes de 1s ao endereço v4 + extensão de zeros

Ex ::ffff:10.0.0.1

� O pacote circula na rede em v4. É convertido para v6 internamente

Networking 41

Protocolo Neighbor Discovery (ND)♦ Nó IPv6 usa ND para

» Descobrir outros nós na mesma ligação/LAN

» Determinar endereço MAC desses nósND substitui ARP

» Descobrir os routers das suas redes

» Manter informação para sobre os vizinhos activos

♦ ND equivale em IPv4 a» ARP IPv4

» ICMP Router Discovery

» ICMP Redirect

Networking 42

Mensagens do ND» Mensagens ICMP (sobre IP)

» Utilização de endereços Link Local

» Neighbor Solicitation

Enviada por nó para obter endereço MAC de vizinho / verificar a sua presença

» Neighbor Advertisement: Resposta ao pedido

» Router Advertisement

Informação sobre prefixo de rede; periódica ou a pedido

Enviada por router para endereço IP Link Local multicast

» Router Solicitation: Interface activa � nó pede router para enviar Router Advertismen

» Redirect: Usado por router para informar um nó acerca de melhor caminho

Networking 43

Configuração de Endereços

Networking 44

Transmissão de Pacote