Vlans y seguridad de puerto

13
PLANIFICACIÓN Y ADMINISTRACIÓN DE REDES STUCOM 07/02/2014 Eduard Angrill En esta práctica se configurará: diferentes VLANS, configuración de los puertos de los switches que forman la red, VTP, restricciones de seguridad, comunicación remota mediante el protocolo SSH, redes WAN PPP con el protocolo EIGRP. VLAN Y VTP

description

Ver más en http://www.francescperez.net/templates/original/html/redes/articulos/art_75_vlan_seg.html

Transcript of Vlans y seguridad de puerto

Page 1: Vlans y seguridad de puerto

P L A N I F I C A C I Ó N Y A D M I N I S T R A C I Ó N D E

R E D E S

S T U C O M

0 7 / 0 2 / 2 0 1 4

Eduard Angrill En esta práctica se configurará : di ferentes VLANS, configuración de los puertos de los switches que forman la red, VTP, restricciones de seguridad, comunicación remota mediante el protocolo SSH , redes WAN PPP con el protocolo EIGRP.

VLAN Y VTP

Page 2: Vlans y seguridad de puerto

Eduard Angri l l ASIXII

2

1. Escenario de simulac ión: En este escenario que se muestra a continuación, se puede ver un esquema de cómo se configurará la red. En este esquema se describe con color verde los equipos que formarán parte de la VLAN 1 y en color naranja los equipos que formarán parte de la VLAN 2. Los equipos en rojo serán usados a modo de intrusos . Concretamente en el apartado donde se detal la la seguridad de los puertos. Para interconectar las redes LAN, se usarán routers que se interconectarán con enlaces WAN configurados con los protocolos PPP y EIGRP, estos permitirán la comunicación entre todos los dispositivos de la red:

2. Calculo del d irecc ionamiento de capa 3, (2 VLANS y 3 WAN) red "172.16.0.0/16": o Router1:

VLAN1: 30 PCs VLAN2: 40 PCs

o Router2: VLAN1: 100 PCs VLAN2: 107 PCs

o Router3: VLAN1: 200 PCs VLAN2: 197 PCs

o WAN: 3 IPS

Page 3: Vlans y seguridad de puerto

Eduard Angri l l ASIXII

3

VLSM: 172.16.0.0/16 172.16.0.0/24 >>>> Asignada a VLAN (200 Hosts). 172.16.1.0/24 >>>> Asignada a VLAN (197 Hosts). 172.16.2.0/24 172.16.2.0/25 >>>> Asignada a VLAN (107 Hosts). 172.16.2.128/25 >>>> Asignada a VLAN (100 Hosts). 172.16.3.0/25 172.16.3.0/26 >>>> Asignada a VLAN (40 Hosts). 172.16.3.64/ 26 172.16.3.64/27 >>>> Asignada a VLAN (30 Hosts). 172.16.3.96/27 172.16.3.96/ 30 >>>> Asignada a WAN . 172.16.3.100/30 >>>> Asignada a WAN . 172.16.3.104/30 >>>> Asignada a WAN . 172.16.3.108/30 *Una vez realizado se as ignan a cada equipo con su respect iva máscara.

3. Configuración de las VLAN. Configuración en Switch: Crear la s VLAN y levantar la VLAN por defecto "Vlan 1": Switch>enable Switch#vlan database Switch(vlan)#vlan 2 Switch(vlan)#exit Switch#configure terminal Switch(conf ig)# interface vlan1 Switch(conf ig-if )#no shutdown Configuraciones en la s interfaces por donde pasa má s de una VLAN "modo trunk": Switch>enable Switch#configure terminal Switch(conf ig)# interface fa0/1 Switch(conf ig-if )#switchport mode trunk Switch(conf ig-if )#switchport trunk a llowed vlan a ll Configuraciones en la s interfaces por donde solo pasa una VLAN "modo acc eso": Switch>enable Switch#configure terminal Switch(conf ig)# interface fa0/2 Switch(conf ig-if )#switchport mode access Switch(conf ig-if )#switchport access vlan 1 Switch(conf ig-if )#exit Switch(conf ig)# interface fa0/4 Switch(conf ig-if )#switchport mode access Switch(conf ig-if )#switchport access vlan 2 Switch(conf ig-if )#end Switch#wr

Page 4: Vlans y seguridad de puerto

Eduard Angri l l ASIXII

4

Ahora para comprobar que las VLANs están activas accedemos a un swi tch y ejecutam os el s iguiente comando "show vlan" Vlan1 comprobar en "show running-config": Las interfaces configuradas en m odo "trunk" no se muestran, para mostrarlas se tiene que ejecutar el s iguiente comando "show interface trunk" este comando también muestra las VLANs permitidas y las que se encuentran activas : Una vez real izadas estas configuraciones los equi pos de una misma LAN ubicados en la misma VLAN podrán hacerse ping, pero no podrán al canzar los equipos de la otra VLAN. E jemplo de "Tracert" entre las mismas y diferentes VLANS:

Page 5: Vlans y seguridad de puerto

Eduard Angri l l ASIXII

5

Configuración de los Routers: En esta configuración se "div ide" la misma interfaz f ís ica en di ferentes interfaces lógicas (Vlans), para que el router pueda hacer de gateway de las dos Vlans a la vez haciendo uso de una IP de gateway por interfaz logica , por lo tanto cada interfaz del router dispondrá de dos IPs , exceptuando las interfaces WAN que se configurarán más adelante: Router 1: Vlan1 Router>enable Router#configure terminal Enter conf igurat ion commands, one per l ine. End with CNTL/Z. Router(conf ig)# interface fa0/0.1 Router(conf ig-subif )#encapsulation dot1Q 1 Router(conf ig-subif )# ip address 172.16.3.65 255.255.255.224 Router(conf ig-subif )#end Vlan2 Router#configure terminal Router(conf ig)# interface fa 0/0.2 Router(conf ig-subif )#encapsulation dot1Q 2 Router(conf ig-subif )# ip address 172.16.3.1 255.255.255.192 Router(conf ig-subif )#end Router#wr Router2: Vlan1 Router>enable Router#configure terminal Router(conf ig)# interface fa0/0.1 Router(conf ig-subif )#encapsulation dot1Q 1 Router(conf ig-subif )# ip address 172.16.2.129 255.255.255.128 Router(conf ig-subif )#end Vlan2 Router#configure terminal Router(conf ig)# interface fa0/0.2 Router(conf ig-subif )#encapsulation dot1Q 2 Router(conf ig-subif )# ip address 172.16.2.1 255.255.255.128 Router(conf ig-subif )#end Router#wr Router3: Vlan1 Router>enable Router#configure terminal Router(conf ig)# interface fa 0/0.1 Router(conf ig-subif )#encapsulation dot1Q 1 Router(conf ig-subif )# ip address 172.16.0.1 255.255.255.0 Router(conf ig-subif )#end

Page 6: Vlans y seguridad de puerto

Eduard Angri l l ASIXII

6

Vlan2 Router#configure terminal Router(conf ig)# interface fa 0/0.2 Router(conf ig-subif )#encapsulation dot1Q 2 Router(conf ig-subif )# ip address 172.16.1.1 255.255.255.0 Router(conf ig-subif )#end Router#wr Ahora se puede real izar la misma prueba que en el caso anterior, haciendo un "tracert" entre dos IPs de la misma VLAN y dos IPs de diferentes VLANS: En el caso de las Vlans di ferentes se puede observar cómo el "tra cert " pasa por el router y luego se envía a la interfaz indicada. Al contrario que con las IPs de l a misma Vlan, que acceden directamente al puerto del switch pertinente.

4. Configuración de VTP: Este tipo de configuración se suele usar en grandes redes con muchos switches, donde uno de el los es el "S ervidor" desde el que se pueden crear , el iminar y modif icar las VLAN. Cuando se real icen cambios en el switch servidor , es tos se enviarán al resto de switches "Cl ientes" y switches "Transparentes". Los switches "Clientes" reciben las actual izaciones VTP de los "Servidores" y las apl ican, en el los no se puede crear ni modif icar VLANS, solo sincronizan las actual izaciones enviadas desde los switch servidores . Los swi tches "Transparentes" transmiten la información de los switches Servidores a los s iwtches Clientes pero no apl ican la configuración que transmiten, por lo tanto este tipo de swi tches tienen que estar gestionados localmente y no a través de las actual izaciones de un swi tch Serv idor .

Page 7: Vlans y seguridad de puerto

Eduard Angri l l ASIXII

7

Ejemplo de configuración de cada modo: Configurar switch en modo "Server": Swi tch>enable Swi tch#configure terminal Swi tch(conf ig)#vtp domain asix Swi tch(conf ig)#vtp mode server Swi tch(conf ig)#vtp version 2 Swi tch(conf ig)#vtp password cisco Swi tch(conf ig)#end Swi tch#wr Configurar switch en modo "Transparente": Swi tch>enable Swi tch#configure terminal Swi tch(conf ig)#vtp domain asix Swi tch(conf ig)#vtp mode transparent Swi tch(conf ig)#vtp version 2 Swi tch(conf ig)#vtp password cisco Swi tch(conf ig)#end Swi tch#wr Configurar switch en modo "Cliente": Swi tch>enable Swi tch#configure terminal Swi tch(conf ig)#vtp domain asix Swi tch(conf ig)#vtp mode cl ient Swi tch(conf ig)#vtp version 2 Swi tch(conf ig)#vtp password cisco Swi tch(conf ig)#end Swi tch#wr

5. Configuración de Seguridad de puertos:

Restr icc ión de puerto por Numero de Conexiones: Se configurará la inter faz "FA 0/1" del "Switch2" para que solo acepte un máxim o de 3 equipos conectados a esa interfaz:

Switch2: Swi tch# configure terminal Swi tch(conf ig)# interface fa 0/1 Swi tch(conf ig- if )#switchport mode access Swi tch(conf ig- if )#switchport port-security Swi tch(conf ig- if )#switchport port-security maximum 3 Swi tch(conf ig- if )#switchport port-security mac-address sticky Swi tch(conf ig- if )#switchport port-security violation shutdown Swi tch(conf ig- if )#end Swi tch#wr El primer paso consiste en acceder a la interfaz , a continuación se coloca el puerto en modo acceso, se selecciona el máx imo de conexiones aceptadas . Con el comando " .. . mac-address sticky" el switch g uardará un registro de todas las Mac que se conecten y con el comando " . .. violation shutdown", cuando vea que en su registro hay más de 3 direcciones MAC conectadas a esa interfaz , desconectará la interfaz.

Page 8: Vlans y seguridad de puerto

Eduard Angri l l ASIXII

8

Para que almacene las MAC se tiene que generar trá fico desde cada PC. Ejemplo al conectar un cuarto PC: Restr icc ión de puerto por MAC: En el s iguiente caso, se configurará la inter faz "FA 0/1" del "Switch6" para que solo acepte a un equipo determinado por la dirección MAC del mismo: Switch6: Swi tch#configure terminal Swi tch(conf ig)# interface FastEthernet 0/1 Swi tch(conf ig- if )#switchport mode access Swi tch(conf ig- if )#switch port-security Swi tch(conf ig- if )#switch port-security mac-address 0090.2B73.5766 Swi tch(conf ig- if )#switch port-security violation shutdown Swi tch(conf ig- if )#end Swi tch#wr El comando es muy simi lar al anterior, se di ferencia por el comando " .. .mac-address [mac_del_PC]" donde se especi f ica que equipo se podrá conectar a esa interfaz y con el comando " .. . violation shutdown" en caso de que un PC que no corresponda con la MAC definida se conecte en dicha interfaz , la inter faz será desconectada automáticamente: Deshabilita r Puertos Inact ivos: Para deshabi l i tar los puertos de un switch y incrementar su seguridad, se puede usar el comando " intererface range fastEthernet [ int_ inic ial]-[ int_f inal]" que deshabi l i tará el rango de puertos especi f icado (Tienen que ser consecutivos) : swi tch#configure terminal swi tch(conf ig)# intererface range fastEthernet 0/5-24 swi tch(conf ig- if -range)#shutdown

Page 9: Vlans y seguridad de puerto

Eduard Angri l l ASIXII

9

6. Configuración de las interfaces WAN: Configuración de Bandwidth y Protocolo PPP:

Router>enable Router#configure terminal Router(conf ig)# interface Serial 0/0/0 Router(conf ig- if )#encapsulation ppp Router(conf ig- if )#bandwidth 2000 Router(conf ig- if )#exit Router(conf ig)# interface Serial 0/1/0 Router(conf ig- if )#encapsulation ppp Router(conf ig- if )#bandwidth 4000 Router(conf ig- if )#end Configuración EIGRP:

Router1 EIGRP: Router#configure terminal Router(conf ig)#router eigrp 1 Router(conf ig-router)#no auto-summary Router(conf ig-router)#network 172.16.3.96 0.0.0.3 Router(conf ig-router)#network 172.16.3.104 0.0.0.3 Router(conf ig-router)#network 172.16.3.64 0.0.0.31 Router(conf ig-router)#network 172.16.3.0 0.0.0.63 Router(conf ig-router)#passive-interface FastEthernet 0/0 Router(conf ig-router)#end Router#wr

Router2 EIGRP: Router>enable Router#configure terminal Router(conf ig)#router eigrp 1 Router(conf ig-router)#no auto-summary Router(conf ig-router)#network 172.16.3.96 0.0.0.3 Router(conf ig-router)#network 172.16.3.100 0.0.0.3 Router(conf ig-router)#network 172.16.2.128 0.0.0.127 Router(conf ig-router)#network 172.16.2.0 0.0.0.127 Router(conf ig-router)#passive-interface FastEthernet 0/0 Router(conf ig-router)#end Router#wr

Router3 EIGRP: Router>enable Router#configure terminal Router(conf ig)#router eigrp 1 Router(conf ig-router)#no auto-summary Router(conf ig-router)#network 172.16.3.104 0.0.0.3 Router(conf ig-router)#network 172.16.3.100 0.0.0.3 Router(conf ig-router)#network 172.16.0.0 0.0.0.255 Router(conf ig-router)#network 172.16.1.0 0.0.0.255 Router(conf ig-router)#passive-interface FastEthernet 0/0 Router(conf ig-router)#end Router#wr

ATENCIÓN: Muy importante usar el comando "no auto-su mary" antes de configurar las redes EIGRP, o estas no se publ icarán , ya que por defecto les pondrá una máscara de red "/16".

Page 10: Vlans y seguridad de puerto

Eduard Angri l l ASIXII

10

Una vez real izadas las configuraciones anteri ores, ya se tendrá conectividad entre las di ferentes redes LAN, para comprobarlo se real iza un ping entre PCs de di ferentes VLANs (1 y 2) y de di ferentes redes LAN: También se puede observar cómo el protocolo EIGRP usa el mayor ancho de banda (entre otras cosas) en lugar de el numero de saltos:

LAN 1

LAN 2

WAN

Page 11: Vlans y seguridad de puerto

Eduard Angri l l ASIXII

11

7. Configuración de la administrac ión remota de los switches con SSH: Esta configuración resulta muy út i l para el administrador ya que no tiene que ir con e l portáti l y e l cable de consola y conectarse directamente al switch para conf igurarlo, con la administración remota se le asigna una IP al switch y se le informa de cuál es su "gateway" para que pueda ser administrado de forma remota y segura usando SSH, a continuación se detal la e l proceso de configuración en un switch de cada LAN: Switch 1: Swi tch>enable Swi tch#configure terminal Swi tch(conf ig)#username cisco password cisco Swi tch(conf ig)# interface vlan 1 Swi tch(conf ig- if )# ip address 172.16.3.70 255.255.255.224 Swi tch(conf ig- if )#no shutdown Swi tch(conf ig- if )#exit Swi tch(conf ig)# ip default-gateway 172.16.3.65 Swi tch(conf ig)#hostname switch1 swi tch1(conf ig)#enable password cisco swi tch1(conf ig)# ip domain-name angri ll . local swi tch1(conf ig)#crypto key generate rsa The name for the keys wi l l be: swi tch1.angri l l . local Choose the size of the key modulus in the range of 360 to 2048 for your General Purpose Keys. Choosing a key modulus greater than 512 may take a few minutes. How many bi ts in the modulus [512] : 1024 % Generat ing 1024 bi t RSA keys, keys wi l l be non-exportable. . . [OK] swi tch1(conf ig)# l ine vty 0 15 swi tch1(conf ig- l ine)#password cisco swi tch1(conf ig- l ine)# login swi tch1(conf ig- l ine)#transport input ssh swi tch1(conf ig)# ip ssh time-out 30 swi tch1(conf ig)# ip ssh authentication-retries 3 swi tch1(conf ig)# ip ssh version 2 swi tch1(conf ig- l ine)#end swi tch1#wr Switch 7: Swi tch>enable Swi tch#configure terminal Swi tch(conf ig)#username cisco password cisco Swi tch(conf ig)# interface vlan 1 Swi tch(conf ig- if )# ip address 172.16.0.6 255.255.255.0 Swi tch(conf ig- if )#no shutdown Swi tch(conf ig- if )#exit Swi tch(conf ig)# ip default-gateway 172.16.0.1 Swi tch(conf ig)#hostname switch7 swi tch7(conf ig)#enable password cisco swi tch7(conf ig)# ip domain-name angri ll . local swi tch7(conf ig)#crypto key generate rsa The name for the keys wi l l be: swi tch7.angri l l . local Choose the size of the key modulus in the range of 360 to 2048 for your General Purpose Keys. Choosing a key modulus greater than 512 may take a few minutes.

Page 12: Vlans y seguridad de puerto

Eduard Angri l l ASIXII

12

How many bi ts in the modulus [512] : 1024 % Generat ing 1024 bi t RSA keys, keys wi l l be non-exportable. . . [OK] swi tch7(conf ig)# l ine vty 0 15 swi tch7(conf ig- l ine)#password cisco swi tch7(conf ig- l ine)# login swi tch7(conf ig- l ine)#transport input ssh swi tch7(conf ig)# ip ssh time-out 30 swi tch7(conf ig)# ip ssh authentication-retries 3 swi tch7(conf ig)# ip ssh version 2 swi tch7(conf ig- l ine)#end swi tch7#wr Switch 4: Swi tch>enable Swi tch#configure terminal Swi tch(conf ig)#username cisco password cisco Swi tch(conf ig)# interface vlan 1 Swi tch(conf ig- if )# ip address 172.16.2.133 255.255.255.128 Swi tch(conf ig- if )#no shutdown Swi tch(conf ig- if )#exit Swi tch(conf ig)# ip default-gateway 172.16.2.129 Swi tch(conf ig)#hostname switch4 swi tch4(conf ig)#enable password cisco swi tch4(conf ig)# ip domain-name angri ll . local swi tch4(conf ig)#crypto key generate rsa The name for the keys wi l l be: swi tch4.angri l l . local Choose the size of the key modulus in the range of 360 to 2048 for your General Purpose Keys. Choosing a key modulus greater than 512 may take a few minutes. How many bi ts in the modulus [512] : 1024 % Generat ing 1024 bi t RSA keys, keys wi l l be non-exportable. . . [OK] swi tch4(conf ig)# l ine vty 0 15 swi tch4(conf ig- l ine)#password cisco swi tch4(conf ig- l ine)# login swi tch4(conf ig- l ine)#transport input ssh swi tch4(conf ig)# ip ssh time-out 30 swi tch4(conf ig)# ip ssh authentication-retries 3 swi tch4(conf ig)# ip ssh version 2 swi tch4(conf ig- l ine)#end swi tch4#wr Para real izar la conexión se usa la s iguiente orden desde un terminal de la red LAN: Comando "ssh -l c isco IP_switch ":

Page 13: Vlans y seguridad de puerto

Eduard Angri l l ASIXII

13