Professional Documents
Culture Documents
net
Primera sessió
Llorenç Cerdà-Alabern
8 d’octubre de 2016
Índex
1 Introducció a les xarxes de computadors i Internet 1
1.1 Qué és una xarxa de computadors? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Història d’Internet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Transmissió d’informació, bits per segon (bps) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Xarxa de paquets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.5 Organismes d’estandardització . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.6 Model de referència OSI de ISO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.7 Arquitectura d’Internet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.8 Organització d’Internet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.9 Encapsulament . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.10 Paradigma client-servidor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.11 Nivell de transport: UDP/TCP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.12 Exemple pràctic: servidors i sockets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2 IPv4 5
2.1 Protocol IP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Servei IP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3 Capçalera IPv4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.4 Adreces IPv4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.5 Assignació adreces IPv4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.6 Màscara . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.7 Adreces IPv4 especials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.8 Adreces IPv4 privades . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.9 Network Address Translation NAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.10 Internet Control Message Protocol, ICMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.11 Taula de missatges ICMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.12 Exemple pràctic: sniffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.13 Taula d’encaminament . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.14 Algorisme de lliurament de datagrames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.15 Exemple pràctic: openwrt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.16 Exemple pràctic: comandes bàsiques en UNIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.17 Address Resolution Protocol, ARP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.18 Domain Name System DNS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.19 Dynamic Host Configuration Protocol, DHCP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.20 Exemple pràctic: routing static . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1
• 1951: Primer computador comercial
• 960s: ARPANET
• 1972: Primera xarxa internacional comercial de commutació de paquets X.25 Red UNO
http://malonemediagroup.com/history- of- the- internet- timeline- an- ever- evolving- digital- world
• prefixes:
– k, kilo: 103
– M, Mega: 106
– G, Giga: 109
– T, Tera: 1012
– P, Peta: 1015
2
1.5 Organismes d’estandardització
• International Telecommunication Union, ITU: WAN standards. http://www.itu.int
• International Organization for Standardization, ISO: Industrial standards. http://www.iso.org/.
• Institute of Electrical and Electronics Engineers, IEEE: LAN standards. http://www.ieee.org/.
• European Telecommunications Standards Institute, ETSI: Mobile phone standards (GSM). http://www.etsi.
org/.
• Telecommunications Industry Association, TIA: Cabling standards. http://www.tiaonline.org.
• World Wide Web Consortium (W3C). http://www.w3.org
Internet:
• Internet Engineering Task Force, IETF. http://www.ietf.org.
– Request For Comments, RFCs: http://www.rfc-editor.org
3
1.8 Organització d’Internet
1.9 Encapsulament
Encapsulament
Paradigma client-servidor
4
1.11 Nivell de transport: UDP/TCP
• UDP (User Datagram Protocol): No orientat a la connexió, no fiable.
• TCP (Transmission Control Protocol): Orientat a la conneixó, fiable.
TCP
2 IPv4
2.1 Protocol IP
• On s’executa en protocol IP? Hosts i Routers
RFC791
2.2 Servei IP
• No orientat a la connexió
• Sense estat
• Best effort
5
Arquitectura d’un router
RFC791
• RIR assigna adresses als ISPs, i els ISPs als seus abonats.
6
2.6 Màscara
• Indica quants bits té el netid
• Notació en bits: 147.84.22.3 /24
• Notació en punts: /24 = 255.255.255.0
147.84.22.3/24
147.84.22.3 10010011 01010100 00010110 00000011
255.255.255.0 11111111 11111111 11111111 00000000
RFC1918
10.0.0.0/8
172.16.0.0/16 ~ 172.31.0.0/16
192.168.0.0/24 ~ 192.168.255.0/24
7
2.9 Network Address Translation NAT
NAT
RFC792
RFC792
8
2.13 Taula d’encaminament
• Enacaminament directe: a una xarxa directament connectada
• Enacaminament indirecte: a través d’un gateway
• Ruta per defecte 0.0.0.0/0
• Imatge http://dsg.ac.upc.edu/~llorenc/openwrt.ova
En virtualbox:
fitxer -> preferències -> xarxa -> afegir xarxa NAT
paràmetres VM -> adaptador -> xarxa NAT
botar la màquina i veure la IP
fitxer -> preferències -> xarxa NAT -> editar -> reenviament de ports ->
127.0.0.0:8080 -> IP de openwrt:22
i desactivar el firewall en la consola d’openwrt:
/etc/init.d/firewall stop
9
2.17 Address Resolution Protocol, ARP
RFC826
• Exemple pràctic
– Captura dels missatges ARP
– Taula ARP (comanda arp)
• Exemple pràctic
– Fitxer /etc/resolv.conf
– Captura d’una ressolució DNS
RFC2131
10