html5-img
1 / 79

Stage Sistemista Linux A.A. 2004-2005

Stage Sistemista Linux A.A. 2004-2005. Protocolli di rete (dal layer 3 in su) Laboratorio. Massimo Pistoni Laboratori Nazionali di Frascati settembre 2005. Argomenti. Indirizzamento IP Struttura dell’indirizzo, range, classfull e classless, host, network e subnet, netmask, broadcast

brick
Télécharger la présentation

Stage Sistemista Linux A.A. 2004-2005

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Stage Sistemista LinuxA.A. 2004-2005 Protocolli di rete (dal layer 3 in su) Laboratorio Massimo Pistoni Laboratori Nazionali di Frascati settembre 2005

  2. Argomenti • Indirizzamento IP • Struttura dell’indirizzo, range, classfull e classless, host, network e subnet, netmask, broadcast • Esercizi • Architettura dei router Cisco • Livelli di memoria, modalita’ di accesso, comandi di stato, accesso alla configurazione, Sistema Operativo • Comandi di configurazione dei router Cisco (IOS) • Generalita’ e configurazione di base, configurazione delle interfacce e dei parametri di network, impostazionie delle password, definizione delle route statiche, verifica della connettivita’ e del routing • Esercizi Massimo Pistoni

  3. Argomenti Configurazione dell’ IOS • Configurazione dei servizi DHCP e NAT • Esercizi • Configurazione delle Access Control List • Esercizio • Configurazione del protocollo di routing RIP • Esercizio • Configurazione del protocollo di routing OSPF • Esercizio • Diagnostica e debug con IOS • Packet sniffing su Ethernet Massimo Pistoni

  4. Classi di indirizzamento 5 classi di indirizzamento: Massimo Pistoni

  5. Indirizzi IP riservati Massimo Pistoni

  6. Indirizzi IP privati Massimo Pistoni

  7. Esempio di indirizzi IP • Address: 193.206.84.103 • Netmask: 255.255.248.0 (21 bit) Altro tipo di notazione: • Address/Netmask: 193.206.84.103/21 Determinazione della Network e del Broadcast: • Addr: 11000001.11001110.01010100.01100111 • Mask: 11111111.11111111.11111000.00000000 • Netw: 11000001.11001110.01010000.00000000 (AND) • Broa: 11000001.11001110.01010111.11111111 •  Network: 193.206.80.0 , Broadcast: 193.206.87.255 Massimo Pistoni

  8. Esercizio 1: indirizzamento 50 hosts Network composta da: • 50 Server farm • 254 Ethernet user segment • 2 serial link • 400 computer lab Network a disposizione • 192.168.4.0 – 192.168.7.255 Ovvero • 192.168.4.0/22 • oltre 1000 indirizzi 400 hosts 254 hosts 1 4 2 3 router1 2 hosts (link) 1 router2 Massimo Pistoni

  9. Esercizio 1 • Gli indirizzi IP sono composti da 32 bit • Occorre determinare il numero dei bit da destinare alla network e il numero dei bit da destinare agli hosts. • Router 1 - interfaccia 1 ( 50 hosts) 2^5 – 2 = 30 < 50 2^6 – 2 = 62 > 50 • 6 bit per gli host e • 32 – 6 = 26 bit per la netmask 8bit + 8bit + 8bit + 2bit 11111111.11111111.11111111.11000000 255.255.255.192 La prima network e’ 192.168.4.0 netmask 255.255.255.192 o anche 192.168.4.0/26 (range192.168.4.0 – 192.168.4.63) Massimo Pistoni

  10. Esercizio 1 • Router 1 - interfaccia 2 ( 254 hosts) 2^7 – 2 = 126 < 254 2^8 – 2 = 254 = 254 • 8 bit per gli host e • 32 – 8 = 24 bit per la netmask 8bit + 8bit + 8bit + 0bit 11111111.11111111.11111111.00000000 255.255.255.0 La seconda network e’ 192.168.5.0 255.255.255.0 o anche 192.168.5.0/24 (range192.168.5.0 – 192.168.5.255) Massimo Pistoni

  11. Esercizio 1 • Router 1 - interfaccia 3 ( 2 hosts) 2^1 – 2 = 0 < 2 2^2 – 2 = 2 = 2 • 2 bit per gli host e • 32 – 2 = 30 bit per la netmask 8bit + 8bit + 8bit + 6bit 11111111.11111111.11111111.11111100 255.255.255.252 La terza network e’ 192.168.4.64 255.255.255.252 o anche 192.168.4.64/30 (range192.168.4.64 – 192.168.4.67) Massimo Pistoni

  12. Esercizio 1 • Router 1 - interfaccia 4 ( 400 hosts) 2^8 – 2 = 254 < 400 2^9 – 2 = 510 > 400 • 9 bit per gli host e • 32 – 9 = 23 bit per la netmask 8bit + 8bit + 7bit + 0bit 11111111.11111111.11111110.00000000 255.255.254.0 La quarta network e’ 192.168.6.0 255.255.254.0 o anche 192.168.6.0/23 (range192.168.6.0 – 192.168.7.255) Massimo Pistoni

  13. Esercizio 1 • Router 2 - interfaccia 1 ( 2 hosts) 2^1 – 2 = 0 < 2 2^2 – 2 = 2 = 2 • 2 bit per gli host e • 32 – 2 = 30 bit per la netmask 8bit + 8bit + 8bit + 6bit 11111111.11111111.11111111.11111100 255.255.255.252 La terza network e’ 192.168.4.64 255.255.255.252 o anche 192.168.4.64/30 (range192.168.4.64 – 192.168.4.67) Massimo Pistoni

  14. Esercizio 1 192.168.4.0 – 192.168.4.63 IP Addresses: Router1/Interf1: 192.168.4.1/26 Router1/Interf2: 192.168.5.1/24 Router1/Interf3: 192.168.4.65/30 Router1/Interf4: 192.168.6.1/23 Router2/Interf1: 192.168.4.66/30 192.168.6.0 – 192.168.7.255 192.168.5.0 – 192.168.5.255 1 4 2 3 192.168.4.65 router1 192.168.4.66 1 router2 Massimo Pistoni

  15. Esercizio 2: indirizzamento 10 hosts Network composta da: • 10 Application servers • 60 Server farm • 500 Ethernet user segment • 250 computer lab • 2 serial link Network a disposizione • 192.168.8.0 – 192.168.11.255 Ovvero • 192.168.8.0/22 • oltre 1000 indirizzi 60 hosts 2 hosts (link) 1 1 5 2 4 3 router2 router1 250 hosts 500 hosts Massimo Pistoni

  16. Esercizio 2 • Router 1 - interfaccia 1 ( 10 hosts) 2^3 – 2 = 6 < 10 2^4 – 2 = 14 > 10 • 4 bit per gli host e • 32 – 4 = 28 bit per la netmask 8bit + 8bit + 8bit + 4bit 11111111.11111111.11111111.11110000 255.255.255.240 La prima network e’ 192.168.8.0 255.255.255.240 o anche 192.168.8.0/28 (range192.168.8.0 – 192.168.8.15) Massimo Pistoni

  17. 192.168.8.16 255.255.255.192 192.168.8.16/26 ERRORE ! E’ in sovrapposizione con la precedente Esercizio 2 • Router 1 - interfaccia 2 ( 60 hosts) 2^5 – 2 = 30 < 60 2^6 – 2 = 62 > 60 • 6 bit per gli host e • 32 – 6 = 26 bit per la netmask 8bit + 8bit + 8bit + 2bit 11111111.11111111.11111111.11000000 255.255.255.192 La seconda network e’ o anche 192.168.8.16 255.255.255.192 192.168.8.16/26 Massimo Pistoni

  18. Esercizio 2 • Infatti dalla presunta Network 192.168.8.16/26  Netw: 11000000.10101000.00001000.00010000 Mask: 11111111.11111111.11111111.11000000 AND: 11000000.10101000.00001000.00000000 • 192.168.8.0/26 (in overlap con la prima) • Guardando l’ultimo byte le uniche variazioni significative ai fini della network (dopo l’AND con la netmask) sono: 00000000 = 0  192.168.8.0/26 01000000 = 64  192.168.8.64/26 10000000 = 128  192.168.8.128/26 11000000 = 192  192.168.8.192/26 La seconda network e’ 192.168.8.64 255.255.255.192 Massimo Pistoni

  19. 192.168.9.0 255.255.254.0 192.168.9.0/23 ERRORE ! Anche questa e’ in sovrapposizione Esercizio 2 • Router 1 - interfaccia 3 ( 500 hosts) 2^8 – 2 = 254 < 500 2^9 – 2 = 510 > 500 • 9 bit per gli host e • 32 – 9 = 23 bit per la netmask 8bit + 8bit + 7bit + 0bit 11111111.11111111.11111110.00000000 255.255.254.0 La terza network e’ o anche 192.168.9.0 255.255.254.0 192.168.9.0/23 Massimo Pistoni

  20. Esercizio 2 • Infatti dalla presunta Network 192.168.9.0/23  Netw: 11000000.10101000.00001001.00000000 Mask: 11111111.11111111.11111110.00000000 AND: 11000000.10101000.00001000.00000000 • 192.168.8.0/23 (in overlap con la prima) • Guardando il terzo byte le uniche variazioni non significative ai fini della network sono: 00001000  00001000  192.168.8.0/23 00001001 00001000  192.168.8.0/23 La prima network non in sovrapposizione e’ quella per cui nel terzo byte varia il secondo bit (da destra): 00001010 La terza network e’ 192.168.10.0 255.255.254.0 o anche 192.168.10.0/23 (range 192.168.10.0 - 192.168.11.255) Massimo Pistoni

  21. Esercizio 2 • Router 1 - interfaccia 4 ( 250 hosts) 2^7 – 2 = 126 < 250 2^8 – 2 = 254 > 250 • 8 bit per gli host e • 32 – 8 = 24 bit per la netmask 8bit + 8bit + 8bit + 0bit 11111111.11111111.11111111.00000000 255.255.255.0 La quarta network e’ 192.168.9.0 255.255.255.0 o anche 192.168.9.0/24 (range192.168.9.0 – 192.168.9.255) Massimo Pistoni

  22. Esercizio 2 • Router 1 - interfaccia 5 ( 2 hosts) 2^1 – 2 = 0 < 2 2^2 – 2 = 2 = 2 • 2 bit per gli host e • 32 – 2 = 30 bit per la netmask 8bit + 8bit + 8bit + 6bit 11111111.11111111.11111111.11111100 255.255.255.252 La quinta network e’ 192.168.8.16 255.255.255.252 o anche 192.168.8.16/30 (range192.168.8.16 – 192.168.8.19) Massimo Pistoni

  23. Esercizio 2 • Router 2 - interfaccia 1 ( 2 hosts) 2^1 – 2 = 0 < 2 2^2 – 2 = 2 = 2 • 2 bit per gli host e • 32 – 2 = 30 bit per la netmask 8bit + 8bit + 8bit + 6bit 11111111.11111111.11111111.11111100 255.255.255.252 La quinta network e’ 192.168.8.16 255.255.255.252 o anche 192.168.8.16/30 (range192.168.8.16 – 192.168.8.19) Massimo Pistoni

  24. Esercizio 2 • Un trucco per ovviare agli errori di sovrapposi- zione e’ quello di ordinare le network in ordine decrescente di ampiezza di range di indirizzamento: • Ad esempio: • Router1/Interf3: 500  192.168.8.0/23 • Router1/Interf4: 250  192.168.10.0/24 • Router1/Interf2: 60  192.168.11.0/26 • Router1/Interf1: 10  192.168.11.64/28 • Router1/Interf5: 2  192.168.11.80/30 • Router2/Interf1: 2  192.168.11.80/30 Massimo Pistoni

  25. Esercizio 2 192.168.11.0 ……………………… 192.168.11.63 192.168.11.64 ……………………… 192.168.11.79 192.168.11.80 ……………………… 192.168.11.83 192.168.11.84 ……………………… 192.168.11.255 192.168.8.0 ……………………… 192.168.8.255 192.168.9.0 ……………………… 192.168.9.255 192.168.10.0 ……………………… 192.168.10.255 192.168.11.0 ……………………… 192.168.11.255 62 hosts 510 hosts 14 hosts 2 hosts 254 hosts Potenziali 4 + 8 + 32 + 128 = 172 Massimo Pistoni

  26. Esercizio 2 IP Addresses: Router1/Interf1: 192.168.11.65/28 Router1/Interf2: 192.168.11.1/26 Router1/Interf3: 192.168.8.1/23 Router1/Interf4: 192.168.10.1/24 Router1/Interf5: 192.168.11.81/30 Router2/Interf1: 192.168.11.82/30 192.168.11.64 –192.168.11.79 192.168.11.0 – 192.168.11.63 192.168.11.81 1 5 1 2 router2 4 3 router1 192.168.11.82 192.168.10.0 – 192.168.10.255 192.168.8.0 – 192.168.9.255 Massimo Pistoni

  27. Livelli di memoria dei router Cisco R O M • La RAM è la memoria di lavoro e contiene le informazioni di configurazione dinamica • L’NVRAM è la RAM non volatile e contiene una copia di backup della configurazione • La FLASH è una erasable programmable read-only memory. Questa memoria contiene una copia del Cisco Internetwork Operating System (Cisco IOS) • ROM contiene il programma di inizializzazione e bootstrap RAM NVRAM Flash Massimo Pistoni Angelo Veloce

  28. Cisco Internetwork Operating System • Nei router il sistema operativo è l’IOS attualmente si è arrivati alla release 12.2 • Negli switch il sistema operativo è il CAT OS attualmente si è arrivati alla release 5.5 • Negli switch che svolgono anche funzionalità layer 3, Cisco ha introdotto un nuovo sistema operativo che è l’IOS nativo Massimo Pistoni Angelo Veloce

  29. Modalità di accesso • User EXEC Mode • È il primo livello di accesso che si presenta quando si effettua il “login” sul router. • Permette una serie di comandi non distruttivi per esaminare performance ed informazioni di sistema Router> • Privileged EXEC Mode • È il secondo livello di accesso che permette, oltre a tutti i comandi precedenti, anche comandi di configurazione e di debug Router>enable Router# Massimo Pistoni Angelo Veloce

  30. Comandi di stato (IOS) Router#show version Router#show running-config NVRAM RAM FLASH Internetwork Operating System Backup Configuration File Operating System Dynamic Configuration Information Tables And Buffers Programs Interfaces Router#show processes CPU Router#show protocols Router#show mem Router#show ip route Massimo Pistoni Angelo Veloce

  31. Comandi di stato (IOS) Router#show flash NVRAM RAM FLASH Internetwork Operating System Backup Configuration File Operating System Dynamic Configuration Information Tables And Buffers Programs Interfaces Router#show startup-config Router#show interface Massimo Pistoni Angelo Veloce

  32. Comandi di stato (IOS) Router#show version NVRAM RAM FLASH Internetwork Operating System Backup Configuration File Operating System Dynamic Configuration Information Tables And Buffers Programs Interfaces Router#show proc cpu Router#show proc mem Massimo Pistoni Angelo Veloce

  33. Configurare la RAM quando si lavora con IOS Console or terminal Configure terminal Show running-config Copy startup-config running-config RAM NVRAM Copy running-config startup-config (write memory) Copy tftp startup-config Copy startup-config tftp Copy tftp running-config Copy running-config tftp (write network) TFTP Server Massimo Pistoni Angelo Veloce

  34. Salvare la configurazione Router#copy running-config startup-config NVRAM RAM Router#copy running-config tftp TFTP Server RAM Massimo Pistoni Angelo Veloce

  35. Configurazione IOS • La prima volta che si accende un router: • Il sistema operativo IOS viene caricato dalla flash (e decompresso) e eseguito in RAM • Il sistema legge la configurazione H/W del router (il numero e il tipo di interfacce) • Sulla console, viene presentata al sistemista la possibilita’ di eseguire un setup interattivo guidato, che eventualmente puo’ essere richiamato con il comando Router#setup eseguito in Privileged EXEC Mode Massimo Pistoni

  36. Configurazione IOS • Durante l’inserimento dei comandi di IOS: • il router accetta il tasto <tab> per l’autocompletamento dei comandi (stile unix) • il carattere “?” per ottenere un help • La sequenza di escape e’ data dalla digitazione contemporanea dei tasti <Control> ^ • Per negare un comando occorre scrivere il comando stesso anticipato da no Massimo Pistoni

  37. Configurazione iniziale • In fase preliminare e’ consigliabile impostare la data e l’ora (riferimento meridiano di Greenwich GMT o UTC) Router#clock set 10:05:20 5 december 2002 • In generale, per configurare un router occorre entrare in Configuration Mode Router#configure terminal Router(config)# Massimo Pistoni

  38. Impostazioni di base • Definizione del nome del router Router(config)#hostname Master1 Master1(config)# • Definizione del dominio IP e dei DNS (config)#ip domain-name lnf.infn.it (config)#ip name-server 193.206.84.12 (config)#ip name-server 193.206.84.112 Massimo Pistoni

  39. Configurazione interfacce • Per listare le interfacce del router Master1>show interfaces Master1>show controllers • Configurazione FastEthernet Master1#configure terminal Master1(config)#interface FastEthernet 0/1 Master1(config-if)#ip address 192.168.8.1 255.255.254.0 Master1(config-if)#no shutdown Master1(config-if)#end oppure ^Z • Il “control z” esce dal Configuration Mode e torna al Priviliged EXEC Mode Massimo Pistoni

  40. Test IP delle interfacce • Per testare la connettivita’ IP dell’interfaccia Master1>ping 192.168.8.1 Master1>ping 192.168.8.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.8.2, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms Master1>show interface FastEthernet 0/1 …………………… Massimo Pistoni

  41. Impostazione delle password • Per impostare la password per l’accesso ai comandi privilegiati (Privileged EXEC Mode): Master1(config)#enable password Master1IT Master1(config)#^Z • Da questo momento sara’ necessaria per l’accesso privilegiato al router sia da console che da telnet: Master1#show running-configuration • Per impostare la password per l’accesso non privilegiato (User EXEC Mode) via telnet: Master1(config)#line vty 0 4 Master1(config-line)#password master Master1(config-line)#^Z Massimo Pistoni

  42. Crittografazione delle password • Per impostare il servizio di crittografazione delle password: Master1(config)#service password-encryption Master1(config)#^Z • Da questo momento le password impostate non saranno piu’ visibili nella configurazione del router: Master1#show running-configuration • Nota: nelle future impostazioni delle password, queste dovranno essere sempre inserite in chiaro, ma saranno ugualmente mostrate crittografate nella configurazione del router Massimo Pistoni

  43. Configurazione interfacce seriali • Configurazione interfaccia seriale Master1#configure terminal Master1(config)#interface Serial 0/0 Master1(config-if)#ip address 192.168.11.249 255.255.255.252 Master1(config-if)#no shutdown Master1(config-if)#^Z • Per verificare lo stato e testare la connettivita’ IP dell’interfaccia Master1>show interface Serial 0/0 Master1>ping 192.168.11.249 Master1>ping 192.168.11.250 Massimo Pistoni

  44. Definizione delle route statiche • Configurazione delle route statiche Master1#configure terminal Master1(config)#ip route <route> <prefix mask> <gateway|interface> <metric> • Configurazione della default route statiche Master1(config)#ip route 0.0.0.0 0.0.0.0 192.168.11.254 1 Master1(config)#ip route 0.0.0.0 0.0.0.0 Serial0/0 1 • Configurazione di route statiche Router0(config)#ip route 192.168.8.0 255.255.248.0 192.168.11.253 1 Massimo Pistoni

  45. Test del routing • Per testare l’instradamento IP sui router: Master1>traceroute 192.168.11.254 Master1>traceroute 193.206.80.11 1 192.168.11.253 1 msec 2 msec 3 msec 2 193.206.80.11 1 msec 2 msec 4 msec Master1> • Per vedere la tabella di route: Master1>show ip route ……… C 192.168.11.252/30 is directly connected, Serial 0/0 C 192.168.8.0/23 is directly connected, FastEthernet 0/0 S 0.0.0.0/0 via 192.168.11.254 Massimo Pistoni

  46. 192.168.8.0/21 192.168.11.254/30 default 192.168.11.253/30 192.168.8.1/23 Esercizio 3 Internet 192.168.160.0/24 193.206.80.0/21 router0 IP Address Router0: Router0-Interf: 192.168.11.254/30 Networks Master1: Router1-FE0/0: 192.168.11.252/30 Router1-FE0/1: 192.168.8.0/23 Master1 FE0/0 2 FE0/1 192.168.8.0/23 Massimo Pistoni

  47. Esercizio 3 • Configurazione del router Router0 Router0#Configure terminal interface FastEthernet 6/47 ?? ip address 192.168.11.254 255.255.255.252 no shutdownip route 192.168.8.0 255.255.248.0 192.168.11.253 • Configurazione del router Master1 Master1#configure terminalinterface FastEthernet 0/0 ip address 192.168.11.253 255.255.255.252 no shutdowninterface FastEthernet 0/1 ip address 192.168.8.1 255.255.254.0 no shutdown ip route 0.0.0.0 0.0.0.0 192.168.11.254 Massimo Pistoni

  48. 192.168.8.0/21 192.168.11.254/30 default 192.168.10.0/23 192.168.11.253/30 default 192.168.11.1/26 192.168.8.1/23 192.168.11.249/30 192.168.11.250/30 192.168.10.1/24 Esercizio 4 Internet IP Addresses: Router0-Interf: 192.168.11.254/30 Master1-FE0/0: 192.168.11.253/30 Master1-FE0/1: 192.168.8.1/23 Networks Master2: Master1-Ser0/1: 192.168.11.248/30 Master2-Ser0/1: 192.168.11.248/30 Master2-FE0/0: 192.168.10.0/24 Master2-FE0/1: 192.168.11.0/26 192.168.160.0/24 193.206.80.0/21 router0 Master2 FE0/0 FE0/1 Serial 0/0 2 Master1 FE0/1 192.168.11.0/26 FE0/0 192.168.10.0/24 192.168.8.0/23 Massimo Pistoni

  49. Esercizio 4 • Configurazione del router Master1 Master1#Configure terminal interface Serial 0/0 clock rate 4000000 ip address 192.168.11.249 255.255.255.252 no shutdownip route 192.168.10.0 255.255.254.0 192.168.11.250 • Configurazione del router Master2 Master2#configure terminalinterface FastEthernet 0/0 ip address 192.168.10.1 255.255.255.0 no shutdowninterface FastEthernet 0/1 ip address 192.168.11.1 255.255.255.192 no shutdown ip route 0.0.0.0 0.0.0.0 192.168.11.249 Massimo Pistoni

  50. DHCP con IOS • Configurare un address pool: Master1#Configure terminal Master1(config)#ip dhcp pool <name> Master1(config-dhcp)# • Assegnazione dinamica (in un network range), definizione dei parametri di network (netmask, GW, DNS, etc) Master1(config-dhcp)#network <network> <mask> Master1(config-dhcp)#domain-name <domain> Master1(config-dhcp)#dns-server <addr1> <addr2> <…> Master1(config-dhcp)#default-router <addr1> <addr2> <…> Master1(config-dhcp)#lease {<giorni> [<ore> <minuti>] | infinite} Massimo Pistoni

More Related