51
Snooping de DHCP. Se configura el switch donde esté el servidor DHCP. ip dhcp snooping. dhcp snooping dhcp snooping vlan X En la interface (numero de puerto) donde se conecta el linux interface Fa 0/Y ip dhcp snooping trusted y si hay más switches conectados a éste es importante ip dhcp relay information trusted A la interface VLAN donde esta el servidor DHCP, si no el pinche suichi no hara relay de los paquetes de DHCP. Si un dispositivo malicioso de un puerto no confiable intenta enviar un paquete de respuesta de DHCP a la red, el puerto se desactiva. Nov 22 2008 12:56PM GMT How to configure DHCP Snooping in a Cisco Catalyst Switches. Posted by: Yasir Irfan Networking , DHCP , Switches , Cisco , Switching , Routing and Switching , CCNP , Cisco IOS , Cisco 2960 , Cisco 2950 , HSRP , Cisco 6500 , Cisco Tips , Cisco 3560 , Cisco Learning , Server

Snooping de DHCP

Embed Size (px)

Citation preview

Page 1: Snooping de DHCP

Snooping de DHCP.

Se configura el switch donde esté el servidor DHCP.

ip dhcp snooping.

dhcp snoopingdhcp snooping vlan X

En la interface (numero de puerto) donde se conecta el linux

interface Fa 0/Yip dhcp snooping trusted

y si hay más switches conectados a éste es importante

ip dhcp relay information trusted

A la interface VLAN donde esta el servidor DHCP, si no el pinche suichi no hara relay de los paquetes de DHCP.

Si un dispositivo malicioso de un puerto no confiable intenta enviar un paquete de respuesta de DHCP a la red, el puerto se desactiva.

Nov 22 2008   12:56PM GMT

How to configure DHCP Snooping in a Cisco Catalyst Switches.

Posted by: Yasir Irfan Networking, DHCP, Switches, Cisco, Switching, Routing and Switching, CCNP,

Cisco IOS, Cisco 2960, Cisco 2950, HSRP, Cisco 6500, Cisco Tips, Cisco 3560, Cisco Learning, Server Security, Cisco 3750-E, Cisco 3560-E, IOS commands, Cisco Systems, Cisco 6500 Series Catalyst Switch, Cisco 6503, Cisco Catalyst 6503-E Switch, Cisco Catalyst 6506-E Switch, Cisco Catalyst 6509-V-E Switch, Cisco Catalyst 6509-E Switch, Cisco Catalyst 6513 Switch, DHCP Snooping, Configuring DHCP Snooping, 802.1 Q, Trunk Ports

 So here we go, with the configuration of DHCP snooping on a Cisco Switch. This feature protects the network by allowing the Cisco Switches to accept DHCP response message only from the authorized servers connected to the trusted interfaces in a Cisco Switch.

Page 2: Snooping de DHCP

All Switch to Switch connections are configured as 802.1 1Q Trunk ports.

IP Address and HSRP Details for the Core Switches

From the above scenario we have two Cisco 6513 Series Switches as a Core/ Distribution with three VLANS one for management of Switches VLAN 50,VLAN 100 for all the servers and VLAN 101 for clients. Two Cisco 3560 Series Switches as Server Farm Switches and a Cisco 3560 Series Switch as an Access Switch.There are two DHCP servers with an IP address 10.0.1.100 and 10.0.1.101 connected with Server Farm Switches with HP NIC teaming. We configure DHCP Snooping based on above scenario.

The first step to configure DHCP Snooping is to turn on DHCP snooping in all Cisco Switches using the “ip dhcp snooping” command.

All Cisco Switches (config)#ip dhcp snooping Second step is to configure the trusted interfaces, from the above scenario all trunk ports are configured as trusted ports as well as the interfaces G0/7,(ITKESF01 50.0.0.6), G0/17,(ITKESF02 50.0.0.7), G0/9

Page 3: Snooping de DHCP

ITKESF01 50.0.0.6) and G0/18 ITKESF02 50.0.0.7) connected to DHCP servers with IP 10.0.1.100 and 10.0.1.101. Lets configure all trunk ports in ITKEBB01

ITKEBB01(config)#interface range gigabitEthernet 3/21 - 23

ITKEBB01 (config-if)#ip dhcp snooping trust

Now let’s configure all trunk ports in ITKEBB02

ITKEBB02(config)#interface range gigabitEthernet 3/21 - 23 ITKEBB02 (config-if)#ip dhcp snooping trust

ITKEBB02 (config)#interface gigabitEthernet 3/16

ITKEBB02 (config-if)#ip dhcp snooping trust

Now let’s configure the trusted ports for the DHCP servers

ITKESF01(config)#interface gigabitEthernet 0/7

ITKESF01 (config-if)#ip dhcp snooping trust

ITKESF01(config)#interface gigabitEthernet 0/17 ITKESF01 (config-if)#ip dhcp snooping trust

ITKESF02(config)#interface gigabitEthernet 0/9

ITKESF02 (config-if)#ip dhcp snooping trust

ITKESF02(config)#interface gigabitEthernet 0/18 ITKESF02 (config-if)#ip dhcp snooping trust

Now let’s configure the trunk ports Access Switch ITKEAS01

ITKEAS01(config)#interface range gigabitEthernet 0/49 - 52

ITKEAS01 (config-if)#ip dhcp snooping trust

Finally we are going to configure VLANS for DHCP snooping DHCP snooping will used on all the VLANs (VLAN 100 & 101)except management VLAN 50 . Also we will limit the requests rate received in the Access Switch (ITKEAS01) ALL SWITCHES(config)# ip dhcp snooping VLAN 100,101

ITKEAS01(config)#interface range gigabitEthernet 0/1 - 48

ITKEAS01 (config-if)#ip dhcp snooping limit rate 20

Displaying the DHCP snooping

Page 6: Snooping de DHCP

o YahooBuzz

o FriendFeed

The latest Cisco Catalyst switches, including the 6500, 4500, and 3750, have some wonderful new features to keep your network safer and more secure. These multilayer switches are capable of inspecting ARP and layer 3/4 packets, which allows for very effective security features.

In this article we will describe and explain these new advances, referred to by Cisco as Catalyst Intelligent features. Using Smartports, the Catalyst switches can inspect, and keep track of DHCP (define) assignments. This means that if a client was assigned an IP address via DHCP, the switch can enforce that assignment by blocking any packets sent from the client's port claiming to be from a different IP addresses. This is accomplished by enabling DHCP snooping and IP source guard. Using the DHCP tables, the switch can also block forged ARP (define) packets, a feature called Dynamic ARP inspection.

DHCP Snooping

Related Stories Identify and Mitigate Windows DNS Threats FreeRADIUS and Linux Secure Your WLAN

The (Practically) Ultimate OpenSSH/Keychain Howto

More Related Stories »

-->

DHCP snooping is a security feature that filters untrusted DHCP messages, and can protect clients on the network from peering up with an unauthorized DHCP server. When enabled, it builds a table of MAC address, IP address, lease time, binding type, and interface information (the switch's interface).

There is also an important difference between trusted and untrusted interfaces when talking about DHCP snooping. Switch ports connected to the end-user should be configured as untrusted. Trusted interfaces are those connected to your DHCP server or another switch. When DHCP snooping on the entire switch is enabled, the switch acts like a firewall for your VLAN (define) . You'll also want to enable DHCP snooping on the VLAN, to allow the switch to act as a firewall for the entire VLAN domain.

Here's how it's done:

Using the features that leverage knowledge gained from DHCP

snooping can create a new level of local network security.

Combine that with port-level MAC security, and network

admins will no longer cringe at the thought of turning on a

network connection in a public area.

Page 7: Snooping de DHCP

!Turn on snooping for the entire switch: Switch(config)# ip dhcp snooping Switch(config)# ip dhcp snooping vlan [number or range]

!Our DCHP server: Switch(config)# interface GigabitEthernet 5/1 Switch(config-if)# ip dhcp snooping trust

!An untrusted client (not a required step): Switch(config-if)# interface FastEthernet 2/1 Switch(config-if)# ip dhcp snooping limit rate 10

A few notes on this:

First, and most importantly, you must realize that this will cause all DHCP requests to be dropped until a port is configured as trusted. Hence, this should be turned on with great care. Second, this isn't as cumbersome as it may seem. You can use the Interface Range command to specify all trusted ports at once. Here's how to enable trust on all trunk ports and ports that a dhcp server is connected to:

Switch(config)#interface range FastEthernet 2/0/1 - 8 , GigabitEthernet 1/0/1 - 3 Switch(config-if-range)# ip dhcp snooping trust

Interface range is a little-known command, introduced in IOS 12.1 that saves a tremendous amount of time.

The last caveat with DHCP snooping is that you must establish a trust relationship with downstream DHCP snoopers on a trunk port:

Switch(config-if)# ip dhcp relay information trusted

Now, you may be thinking "DHCP snooping sounds nice, but what happens when I reboot the switch and the snooper doesn't have a database of leases anymore? Won't it require clients to re-obtain their DHCP leases?"

Yes. Cisco thought of this, and created a mechanism by which the database can be saved. It is possible to configure the database to live on flash memory, but because of space limitations it's best to use a tftp server with the command:

Switch(config)# ip dhcp snooping database tftp://10.1.1.1/file

The database is updated constantly, and should survive a quick reboot. If some DHCP leases have expired by the time the switch comes alive again, those entries will be invalid, and the client won't have connectivity until it tries to peer up with DHCP again.

Page 8: Snooping de DHCP

IP Source Guard and Port Security

Using just DHCP snooping, you have stopped untrusted devices from acting as a DHCP server; which is important in an environment where people think it's a good idea to bring in their Linksys access point to better cover the office with wireless. Port Security can also help to stop more than one MAC from being seen on a port, making it impossible to connect hubs and other network-extending devices.

Now, to stop malicious people from using IP addresses that weren't assigned to them, we use IP source guard. Even better, we can also stop clients from forging their MAC address. MAC address filtering makes flooding the switch impossible. Flooding is a technique by which an attacker sends so many MAC addresses from their port that the switch's MAC table overflows. Then the switch has no choice but to flood all Ethernet frames out of every single port, since it doesn't know what MAC is connected where, allowing an attacker to see all the traffic across the switch. Some viruses have been known to do this as well.

Switch(config-if)# ip verify source vlan dhcp-snooping

But be careful! If the DHCP table doesn't have an association for this port, you've just stopped all IP traffic from it. It is recommended that DHCP snooping be turned on a day before enabling IP source guard to allow it to gather information.

To apply MAC address security, you must turn it on, then configure appropriate options:

!Set explicit access mode (dynamic or trunk ports can't have security) Switch(config-if)# switchport mode access

!Enable port-security Switch(config-if)# switchport port-security

!Specify how many MAC addresses can be used: Switch(config-if)# switchport port-security maximum 1

!Action to take when a violation happens: Switch(config-if)# switchport port-security violation {restrict | shutdown}

Violation Restrict will not disable the switch port, but instead cause the switch to increment a security violation counter, and send an SNMP trap. These options are quite configurable, you can even specify how long to shut down the port when a violation occurs. An alternative, less dynamic method, is to program the MAC address binding as static. This stops any other MAC from working on a port, ever.

Page 9: Snooping de DHCP

Dynamic ARP Inspection

ARP inspection allows the switch to discard ARP packets with invalid IP to MAC address bindings, effectively stopping common man-in-the-middle attacks. ARP poisoning is a tactic where an attacker injects false ARP packets into the subnet, normally by broadcasting ARP responses where the attacker claims to be someone else.

To curtail poisoning, Dynamic ARP Inspection (DAI) uses our friend, the DHCP snooping table. There are many options, and you must be careful enabling DAI if all network devices don't support it. The most basic configuration is:

Switch(config)# ip arp inspection vlan 1

Trunk ports need to be trusted:

Switch(config)# int range f1/1 - 4 , f2/24 Switch(config-if)# ip arp inspection trust

You can view the status with:

Switch# show ip arp inspection ?

Using the features that leverage knowledge gained from DHCP snooping can create a new level of local network security. Combine that with port-level MAC security, and network admins will no longer cringe at the thought of turning on a network connection in a public area. Testing these features in a production environment is, of course, not recommended: Many of them have wicked side effects if configured incorrectly or out of order.

Read more on "Secure Your Infrastructure" »

Page 10: Snooping de DHCP

March 3, 2010

My definition of DHCP-snoopingFiled under: Information Technology,Security — Tags: cisco, config, dhcp, snooping, trusted, untrusted — Tim Lefler @ 2:04 pm

Cisco’s Overview of DHCP Snooping

DHCP snooping is a DHCP security feature that provides security by filtering untrusted DHCP messages and by building and maintaining a DHCP snooping binding table. An untrusted message is a message that is received from outside the network or firewall and that can cause traffic attacks within your network.

The DHCP snooping binding table contains the MAC address, IP address, lease time, binding type, VLAN number, and interface information that corresponds to the local untrusted interfaces of a switch; it does not contain information regarding hosts interconnected with a trusted interface. An untrusted interface is an interface that is configured to receive messages from outside the network or firewall. A trusted interface is an interface that is configured to receive only messages from within the network.

DHCP snooping acts like a firewall between untrusted hosts and DHCP servers. It also gives you a way to differentiate between untrusted interfaces connected to the end-user and trusted interfaces connected to the DHCP server or another switch.

Well thanks for that extremely clear overview…….. what actually  is going on?  Lets say you have a switch.  You hook a DHCP server up to port #1 and designate this as a “trusted” interface and all of the rest of the ports that will have devices connected to them are setup as “untrusted”.  You would set this up using the commands:

*** Enable DHCP Snooping & ARP Inspection ***ip dhcp snooping vlan 100no ip dhcp snooping information optionip dhcp snooping database flash:/dhcpdb.datip dhcp snoopingip arp inspection vlan 100 *** Untrusted Access Interfaces for DHCP ****Int Range Fa1/0/2 - 48description Workstationswitchport access vlan 100switchport mode accessno mdix auto Int Range Fa2/0/1 - 48description Workstationswitchport access vlan 100switchport mode accessno mdix auto *** Trusted Access Interface for DHCP ***Int Fa1/0/1description DHCP Serverswitchport access vlan 100

Page 11: Snooping de DHCP

switchport mode accessno mdix autoip dhcp snooping trust

DHCP Client requests are forwarded regardless of the trust state of the port, but DHCP server responses are dropped if the port is untrusted.

So lets say on port #2 the switch sees a DHCP discovery packet float by from a DHCP client.  Because it is a broadcast message this gets flooded to all ports on the VLAN.  The DHCP server connected to port #1 sees the discovery packet and sends an uninicast  DHCPOFFER packet to the client.  Because this originated from a “trusted” port the offer is allowed to go through.  The client recieves the DHCPOFFER chooses an offer from all that it receives and responds with a DHCPREQUEST back to the DHCP server.  The server then responds with a DHCPACK and includes the configuration parameters and committed network address.  The switch records the client binding port, vlan, mac address, and ip, etc into its local snooping database.

So in a nutshell DHCP snooping offers some additional security to ensure only your DHCP servers are responding to DHCP client broadcasts and it also is a convenient way to keep track of what client IPs are connected to what port.

So now a real world example…..lets say my IPS detects malicious traffic from an IP address: 10.1.144.81

Below is the CLI for the switch to find a IP addressWe can get the MAC, IP address, amount left on the lease, vlan #, interface on the switch from the dhcp-snooping database:

switchXYZ#sh ip dhcp snooping binding | include 10.1.144.8100:1E:EC:1E:74:DA   10.1.144.81      15468045    dhcp-snooping   100  FastEthernet2/0/32

Below is a example displaying part of the dhcp snooping database.

switchXYZ#sh ip dhcp snooping bindingMacAddress IpAddress Lease(sec) Type VLAN Interface------------------ --------------- ---------- ------------- ---- --------------------00:16:D4:A5:89:22 10.1.144.64 14956850 dhcp-snooping 100 FastEthernet1/0/4200:1C:25:98:50:43 10.1.144.87 12637737 dhcp-snooping 100 FastEthernet1/0/4100:1E:EC:1E:74:C4 10.1.144.119 14519969 dhcp-snooping 100 FastEthernet2/0/3600:21:97:C4:27:17 10.1.144.85 15551889 dhcp-snooping 100 FastEthernet2/0/2800:1B:38:F1:F4:F8 10.1.144.95 6503907 dhcp-snooping 100 FastEthernet1/0/3500:1E:EC:1E:74:DA 10.1.144.81 15468308 dhcp-snooping 100 FastEthernet2/0/3200:1C:23:88:E9:01 10.1.144.71 11418033 dhcp-snooping 100 FastEthernet2/0/400:1B:38:7B:6C:7E 10.1.144.66 12013698 dhcp-snooping 100 FastEthernet1/0/1

Page 12: Snooping de DHCP

00:1F:6C:81:2F:8B 10.1.145.60 15542941 dhcp-snooping 100 FastEthernet2/0/3800:22:55:5E:62:CB 10.1.145.56 15542874 dhcp-snooping 100 FastEthernet1/0/3600:1E:13:8C:D8:82 10.1.145.132 15542955 dhcp-snooping 100 FastEthernet3/0/39 Total number of bindings: 204

Once we know what port the IP address is associated with we can quickly lookup information on the port….. and if you use meaningful descriptions you could get the workstation location.

switchXYZ#sh runTypein: /2/0/32 <------ The first slash gives you a find feature, the next number and slashes are the port infoInt Fa2/0/32 description Workstation Cube XYZ switchport access vlan 100 switchport mode access no mdix auto

References:

DHCP RFCCisco – Understanding and Configuring DHCP Snooping

Comments (1)

Page 13: Snooping de DHCP

3. DHCP snooping.

Los servidores DHCP no legítimos se dedican a contestar peticiones DHCP de los clientes. Estos servidores proporcionan información que indica que ellos mismos son la puerta de enlace o el DNS. De esta forma consiguen realizar un man-in-the-middle.Otros de los ataques consiste en agotar (DoS) el pool de direcciones que un servidor DHCP puede proporcionar a los clientes.El DHCP snooping permite especificar qué puertos pueden contestar a solicitudes DHCP. Los puertos que pueden contestar y enviar solicitudes DHCP son los puertos seguros. Los puertos inseguros sólo pueden enviar solicitudes DHCP. Por lo tanto, configuraremos como seguros los puertos que contengan servidores legítimos y como inseguros los puertos de usuario. En el momento en el que un puerto inseguro recibe una respuesta (DHCPOFFER, DHCPACK, DHCPNAK) a una solicitud DHCP este puerto se deshabilita automáticamente (shutdown).

Switch(config)#ip dhcp snoopingSwitch(config)#interface FastEthernet 0/1Switch(config-if)#ip dhcp snooping trustSwitch(config)#interface range FastEthernet 0/2 - 23Switch(config-if)#ip dhcp snooping limit rate 2

cita: http://hacktracking.blogspot.com/2008/10/32-mitigando-los-ataques-de-la-capa-2.html

lo otro puede ser esto: http://www.lesand.cl/foro/index.php?topic=924.0

Page 14: Snooping de DHCP

Introducción

El objetivo de este articulo es el de explicar los elementos básicos de la configuración y administración de routers Cisco. Para la lectura de este artículo es necesario conocer la función de un router y los protocolos de enrutamiento. Si aun no los conoces, puedes leer el articulo acerca de los routers.

Para la explicación de este articulo, el esquema con los dos PC representará a dos redes diferentes conectadas por un router (el programa PacketTracer ha sido utilizado para los test durante la redacción de este articulo).

Índice

Etapa 1: Implementación o Equipo necesario

o Esquema de pirámide

o Configuración IP de los PC

Etapa 2: Cableado de la red, uso del cable de consola

Etapa 3: Configuración del router con los comandos IOS

o IOS

o Los diferentes modos de usuarios

o Poner una contraseña al acceso Privilegiado

o Configuración de las interfaces Ethernet del router

o Configuración del acceso Telnet al router

Resumen de los comandos IOS básicos

o Paso entre los diferentes modos de usuarios

o Comandos de información

o Comandos de interfaz

Page 15: Snooping de DHCP

o Comandos para hacer una copia de seguridad de la configuración actual

o Comando de anulación

o Anulación de un comando en particular

o Cambiar el nombre del router

o Poner una contraseña al usuario privilegiado

Conclusión

Etapa 1: Implementación

Equipo necesario Un router Cisco Dos PC (representado las redes)

El cable de consola proporcionado con el router

Esquema de pirámide

Configuración IP de los PC

PC 1:

Dirección IP/Mascara: 192.168.1.254/24 Puerta de enlace: Será la dirección IP de la interfaz del router a la cual está conectada

el PC

Page 16: Snooping de DHCP

PC 2: Dirección IP/Mascara: 10.0.0.254/8 Puerta de enlace: Será la dirección IP de la interfaz del router a la cual está conectada

el PC

Etapa 2: Cableado de la red, uso del cable de consola

Las dos redes ya están conectadas al router. Sin embargo, no hay comunicación entre ellas. Comenzaremos por conectar el cable de consola (cable azul) entre el router y el PC que se va a utilizar para la configuración.

Inicialmente, utilizaremos HyperTerminal (de Microsoft) para efectuar las operaciones necesarias.

Etapa 3: Configuración del router con los comandos IOS

IOS

IOS es el acrónimo de “Internetworks Operating System", en español “Sistema operativo para la interconexión de redes”.

Este sistema puede ser administrado en línea de comandos, propios a los equipos de Cisco Systems.

Los diferentes modos de usuarios Modo usuario: Permite consultar toda la información relacionada al router sin poder

modificarla. El shell es el siguiente:

Router > Usuario privilegiado: Permite visualizar el estado del router e importar o exportar

imágenes de IOS. El shell es el siguiente:

Router # Modo de configuración global: Permite utilizar los comandos de configuración

generales del router. El shell es el siguiente:

Page 17: Snooping de DHCP

Router (config) # Modo de configuración de interfaces: Permite utilizar comandos de configuración de

interfaces (Direcciones IP, mascaras, etc.). El shell es el siguiente:

Router (config-if) # Modo de configuración de línea: Permite configurar una línea (ejemplo: acceso al

router por Telnet). El shell es el siguiente:

Router (config-line) # Modo espacial: RXBoot Modo de mantenimiento que puede servir, especialmente,

para reinicializar las contraseñas del router. El shell es el siguiente:

rommon >

Poner una contraseña al acceso Privilegiado

Esta parte explica como poner una contraseña al usuario privilegiado.

Lo primero que hay que hacer es conectarse en modo privilegiado, luego en modo de configuración global para efectuar esta manipulación:

Router > enable

Router # configure terminal

Router (config) #

Una vez en modo de configuración global, tan solo hay que ingresar un comando para poner una contraseña:

Router (config) # enable password contraseña

La próxima vez que un usuario intente conectarse en modo usuario privilegiado, le será solicitada una contraseña.

Hasta aquí, se recomienda guardar regularmente la configuración utilizando el siguiente comando (en modo privilegiado):

copy running-config startup-config

Page 18: Snooping de DHCP

Configuración de las interfaces Ethernet del router

Ahora, debemos hacer que se comuniquen las dos redes conectadas al router. Supongamos que el nombre de la interfaz conectada a PC1 es fa0/0 y el de la conectada a PC2 es fa0/1 y que estamos en modo de configuración global.

A continuación los comandos a ingresar:

Interfaz fa0/0:

Router (config) # interface fa0/0

Router (config-if) # ip address 192.168.1.1 255.255.255.0

Router (config-if) # no shutdown

Router (config-if) # exit Interfaz fa0/1:

Router (config) # interface fa0/1

Router (config-if) # ip address 10.0.0.1 255.0.0.0

Router (config-if) no shutdown

Router (config-if) exit

Esto es todo en relación a la configuración de las interfaces. Las dos redes deberían ahora comunicarse entre ellas. Podemos comprobarlo con un comando ping de un PC de una red hacia un PC de otra red.

No olvides guardar tu configuración actual utilizando el comando apropiado.

Configuración del acceso Telnet al router

Ya que la configuración con el cable de consola y HyperTerminal no es práctico, se puede permitir que los administradores se conecten al router vía una sesión Telnet desde cualquier PC de una de las dos redes.

Pasamos primero en modo de configuración global, luego en modo de configuración de línea VTY:

Router > enable

Password?:

Page 19: Snooping de DHCP

Router # configure terminal

Router (config) # line vty 0 4

configurará la posibilidad de 5 sesiones telnet simultáneas en este router.

Llegamos ahora al prompt de configuración de línea. Para activar Telnet, no hay más que poner una contraseña a la línea:

Router (config-line) # password contraseña

Router (config-line) # exit

Guardamos la configuración.

Hemos terminado con la configuración básica del router. Ahora vamos a hacer un resumen de los diferentes comandos utilizados y que pueden ser utilizados en el caso precedente.

Importante: antes de conectarnos vía una sesión Telnet debemos haber definido una contraseña para el modo privilegiado. Si no es así, el router rechazará la conexión.

Resumen de los comandos IOS básicos

NOTA: Si varios comandos aparecen uno después de otro para una misma función, esto significa que todos tienen la misma función y que cualquiera de ellos puede ser utilizado indistintamente.

Paso entre los diferentes modos de usuarios Usuario normal: Ningún comando a ejecutar, es en este modo que comienza una

sesión. Usuario privilegiado (a ejecutar desde el modo normal):

Router > enable

Router > en Modo de configuración global (a ejecutar desde el modo Privilegiado):

Router # configure Terminal

Router # conf t Modo de configuración de interfaz (a ejecutar desde el modo de configuración global):

Page 20: Snooping de DHCP

Router (config) # interface nombre_interfaz

Router (config) # int nombre_interfaz Modo de configuración de línea (a ejecutar desde el modo de configuración global):

Router (config) # line nombre_de_la_linea

Comandos de información

Los comandos de información permiten mostrar la información relativa al router. Todos comienzan con el prefijo show o sh. La mayoría deben ser ejecutados desde el modo privilegiado.

Mostrar el archivo de configuración actual del router:

show running-config

show run

sh run Mostrar información sobre la configuración de hardware del sistema y sobre el IOS:

show version

sh version Mostrar los procesos activos:

show processes Mostrar los protocolos configurados de la capa 3 del modelo OSI:

show protocols Mostrar las estadísticas de memoria del router:

show memory Mostrar información y estadísticas sobre una interfaz:

show interfaces nombre_interfaz

Page 21: Snooping de DHCP

sh interfaces nombre_interfaz

sh int nombre_interfaz

*Mostrar la tabla de enrutamiento IP:

<code>sh ip ruta

Comandos de interfaz

Estos comandos están ligados a la configuración de la interfaz del router. La mayoría deben ser ejecutados desde el modo de configuración de interfaz.

Asignación de una dirección IP a una interfaz:

ip address @IP mascara Activación de la interfaz:

no shutdown

Comandos para hacer una copia de seguridad de la configuración actual

Estos comandos permiten hacer una copia de seguridad de la configuración actual para restaurarla automáticamente en caso de reinicio del router. Estos se ejecutan en modo Privilegiado.

Copia de seguridad con solicitud de confirmación:

copy running-config startup-config

copy run start Copia de seguridad sin solicitud de confirmación:

write

Comando de anulación

Este comando permite regresar a la última configuración guardada, anulando todas las

Page 22: Snooping de DHCP

modificaciones que han sido hechas después a la configuración. Se ejecuta en modo Privilegiado.

copy startup-config running-config

copy start run

Anulación de un comando en particular

Para anular un comando en particular, utilizaremos el prefijo no delante del comando que se ejecuto anteriormente. Ejemplo: anular la configuración de una interfaz:

no ip address

Cambiar el nombre del router

El nombre del router puede ser modificado a fin de poder diferenciarlo en la red o redes. El comando será ejecutado en modo de configuración global.

host NuevoNombre

Un nombre diferente aparecerá en el prompt en sesiones HyperTerminal o Telnet.

Antes:

Router > Después:

NuevoNombre >

Poner una contraseña al usuario privilegiado

Estos comandos deben ser ejecutados en modo de configuración global:

Asignación normal:

enable password contraseña Asignación encriptada:

Page 23: Snooping de DHCP

enable secret contraseña

Page 24: Snooping de DHCP

El siguiente es un pequeño resumen sobre comandos para configurar un switch cisco y algunos de router, espero que les sea útil como lo es para mi.

Rip NewYork(config)#interface fastethernet0/0 NewYork(config-if)#ip address 192.168.50.129 255.255.255.192 NewYork(config-if)#ip rip send version 1 NewYork(config-if)#ip rip receive version 1 NewYork(config)#interface fastethernet0/1 NewYork(config-if)#ip address 172.25.150.193 255.255.255.240 NewYork(config-if)#ip rip send version 1 2

Show ip protocols show interface interface show ip interface interface show running-config Show ip rip database

OSPF

Router(config)#router ospf process-id Router(config-router)#network address wildcard-mask area area-id

Router(config)#interface lookback 0 Router(config-if)#ip address 192.168.3.33 255.255.255.255

Page 25: Snooping de DHCP

Rtr(config-if)# bandwidth 64 Rtr(config-if)# ip ospf cost 1562

Autenticación sin md5 Router(config-if)#ip ospf authentication-key password Router(config-router)#area area-number authentication

Autenticación con md5 Router(config-if)#ip ospf message-digest-key key-id encryption-type md5 key Router(config-router)#area area-id authentication message-digest

Router(config-if)#ip ospf hello-interval seconds Router(config-if)#ip ospf dead-interval seconds debug ip ospf events --aumentar la prioridad para elegir un router DR sw(config)#interface fasethernet 0/0 sw(config-if)#ip osfp priority 50 sw(config-if)#end

EIGRP

Router(config)#router eigrp as-id Router(config-router)#network 192.168.3.0 Router(config-router)#end Router# show ip eigrp topology

eigrp log-neighbor-changes resumen de rutas: router(config-router)#no auto-summary

Switch

Switch# dir flash: Switch#show flash Switch#show vlan

Switch#vlan database Switch(vlan)#vlan vlan_number Switch(vlan)#exit Switch(config)#interface fastethernet 0/9 Switch(config-if)#switchport access vlan vlan_number Switch#vlan database Switch(vlan)#no vlan 300 Switch(config)#interface fastethernet 0/9 Switch(config-if)#switchport access vlan vlan_number

Sw1#delete flash:vlan.dat Sw1#erase startup-config Sw1#reload

Interface web

Page 26: Snooping de DHCP

Sw1(config)#ip http port 80

Ver la tabla MAC: Switch#show mac-address-table (? Mas opciones) Switch#clear mac-address-table

Asignar una mac estatica

•Switch(config)#mac-address-table static interface FastEthernet vlan •Switch(config)#no mac-address-table static interface FastEthernet vlan Seguridad de Puerto

Sw1(config)#interface fastETehernet 0/2 Sw1(config-if)#switchport port-security ?(sale las opciones)

Limitar la cantidad de host por puerto 1900: Sw1(config)#interface fastETehernet 0/2 Sw1(config-if)#port secure mas-mac-count 1

2950: Sw1(config)#interface fastETehernet 0/2 Sw1(config-if)#switchport port-security maximum 1

Configuracion del Puerto que se desconecte cuando se produce una violacion de seguridad

Sw(config-if)#switchport port-security violation shutdown

2900xl: Sw(config-if)#port security action shutdown

Poner Ip a la Vlan1

Catalyst 2950 Sw(config)#interface Vlan1 Sw(config-if)#ip address 192.168.1.2 255.255.255.0 Sw(config-if)#no shutdown

Sw(config)# ip default-gateway 192.168.1.1

Catalyst 1900 Sw(config)#ip address 192.168.1.2 255.255.255.0

Sw(config)# ip default-gateway 192.168.1.1

Page 27: Snooping de DHCP

Archivos de configuracion

Sw# copy running-config startup-config

1900: Sw#copy nvram tftp://tftp server ip add/destination_filename

COnfiguracion de la velocidad

Switch(config)#interface fastethernet 0/9 Switch(config-if)#duplex full Switch(config-if)#speed 100

Crear el trunk del switch

Sw(config)#interface fastethernet 0/1 Sw(config-if)#swicthport mode trunk Sw(config-if)#end

2900: Sw(config)#interface fastethernet 0/1 Sw(config-if)#swicthport mode trunk Sw(config-if)#swicthport trunk encapsulation dot1q Sw(config-if)#end

1900: Sw(config)#interface fastethernet 0/1 Sw(config-if)#swicthport mode trunk Sw(config-if)#swicthport trunk encapsulation dot1q Sw(config-if)#end

Trunk en el router

Router(config)#interface fastethernet 0/0 Router(config-if)#no shutdown Router(config-if)#interface fastEthernet 0/0.1 Router(config-subif)#encapsulation dot1q vlan-number Router(config-subif)#ip address…….

router1#copy running-config tftp

Quitar un Puerto de una VLAN Switch(config)#interface fasethernet 0/9 Switch(config-if)#no switchport access vlan 300

Page 28: Snooping de DHCP

Eliminar una vlan

Switch#vlan database Switch(vlan)#no vlan 300

Spanning tree show spanning-tree

Configuracion de VTP switch#vlan database switch#vtp v2-mode

switch(vlan)#vtp domain password

switch#vtp {client | server | transparent}

Copiar el IOS a un server tftp

Sw#copy flash tftp

2900: sw#copy flash:nombre_del_archivo tftp

Copiar IOS desde un Server tftp Sw#copy TFTP flash

Sw# copy Start tftp

1900: sw#copy nvram tftp://numero-ip/name

Sw#copy tftp startup-config

1900: sw#copy tftp://numero-ip/name nvram

Recuperar el acceso al switch

1. Apagar el switch, Vuelva a encenderlo mientras presiona el boton MODE en la parte delantera del switch. Deje de presionar el boton MODE una vez que se apague el led de STAT 2. introducir los siguientes comandos: flash_init load_helper dir flash: 3. rename flash:config.text flash:config.old 4. reiniciar el sistema original: 4.1 despues de entrar al switch hacer: rename flash:config.old flash:config.text 4.2 sw#copy flash:config.text system:running-config 4.3 Cambiar los password

Page 29: Snooping de DHCP

Actualizar el firmware

Sw#show boot (muestra el archive de boteo)

Cambiar el nombre del archivo de la ios,con el commando #rename flash:nombre flash:Nuevo_nombre

Sw(config)#no ip http Server Sw# delete flash:html/*

Extraer la nueva version del IOS

Sw#archive tar /x tftp://192.168.1.3/nombre_del_archivo.tar flash: Sw(config)#ip http Server Sw(config)#boot system flash:nombre.bin

Spanning-Tree

#show spanning-tree brief Cambiar prioridad: ios 12.0 sw(config)#spanning-tree priority 1 sw(config)#exit

ios 12.1 sw(config)#spanning-tree vlan 1 priority 4096 sw(config)#exit

Configurar VLAN

Sw#vlan database Sw(vlan)#vlan 2 name Logistica Sw(vlan)#vlan 3 name Licitaciones Sw(vlan)#end

1900: Sw#config terminal Sw(config)#vlan 2 name VLAN2 Sw(config)#vlan 3 name VLAN3

Configurar puertos en las VLAN

Sw#conf term Sw(config)#interface fastethernet 0/2 Sw(config-if)#switchport mode access Sw(config-if)#switchport access vlan2 Sw(config-if)#end

Elminar el Puerto de la vlan Sw(config-if)#no switchport access vlan2 Sw(config-if)#end

Page 30: Snooping de DHCP

1900: Sw#conf term Sw(config)#interface fastethernet 0/2 Sw(config-if)#vlan static 2

Para eliminar un Puerto de la vlan Sw(config-if)#no vlan-membership 2

Sw#show vlan Sw#show vlan id 2

1900: Show vlan-membership Show vlan 2

Eliminar un vlan

Sw#valn database Sw(vlan)#no vlan 3 Sw(vlan)# exit

1900: sw(confgi)# interface ethernet 0/7 sw(confgi)#no vlan 3

enlacen troncal ISL

sw(Config.)#interafce fastethernet 0/1 sw(Config-if)#switchport mode trunk sw(Config-if)#switchport trunk encapsulation isl sw(Config-if)#end enlace troncal 802.1q

2950: por defecto dotiq sw(Config.)#interafce fastethernet 0/1 sw(Config-if)#switchport mode trunk

2900: sw(Config.)#interafce fastethernet 0/1 sw(Config-if)#switchport mode trunk sw(Config-if)#switchport trunk encapsulation dot1q

Vtp , servidor y cliente

Sw# Vlan database Sw(vlan)# vtp server Sw(vlan)# vtp domain group1 Sw(vlan)# exit

Page 31: Snooping de DHCP

Sw# Vlan database Sw(vlan)# vtp client Sw(vlan)# vtp domain group1 Sw(vlan)# exit

Ruteo entre VLAN

Poner el encapsulamiento en las subinterfaces del router

(config-if)#interface fastethernet 0/0.1 (config-subif)#encapsulation dot1q 1 (1 es la vlan a la que esta)

tambien les dejo un manual de configuracion.

http://asignaturas.diatel.upm.es/rrss1/documentacion_archivos/LABORATORIO%20ACTUAL/manual_rapido_cisco.pdf

Page 32: Snooping de DHCP

Siempre es util tener una lista de los comando de un router, hice este resumen de algunos comando s. Si hay gente que sepaalgunos puede agregarlos para ayuda de todos.

Router>

Router>enableRouter#

Router# configure terminalRouter(config)#

Historia de commandos#show history

RelojRouter#clock set 19:50:00 14 july 2003

Cambiar nombre del routerRouter(config)#hostname Expo Expo(config)#

Configurar una InterfazDCEExpo(config)#interface serial 0/0Expo(config-if)# ip address IP MASKExpo(config-if)#bandwidth 56Expo(config-if)#clock rate 64000Expo(config-if)#no shutdownExpo(config-if)#end

DTEExpo(config)#interface serial 0/0Expo(config-if)# ip address IP MASKExpo(config-if)#bandwidth 56Expo(config-if)#no shutdownExpo(config-if)#end

Expo(config)#interface fastethernet 0/0Expo(config-if)#ip address IP MASKExpo(config-if)#no shutdownExpo(config)#end

Copy

Page 33: Snooping de DHCP

Router# copy flash tftpRouter#copy running-config tftpRouter#copy tftp running-config

Configuración de Rutas EstáticasExpo(config)#ip route RED MASK GATEWAY

Poner Password al RouterExpo(config)#line console 0Expo(config-line)#password *******Expo(config-line)#login

Expo(config)#line vty 0 4Expo(config-line)#password *******Expo(config-line)#login

Expo(config)#enable password ******

Encriptar PasswordExpo(config)#service password-encriptionExpo(config)#enable secret *******

Hostname Expo(config)#ip host NOMBRE IP

Uso de protocolo cdpExpo(config)#cdp run Expo(config)#no cdp runExpo#show cdp neighborsExpo#show cdp neighbors detail

Booteo del routerExpo(config)#boot system flash IOS_filenameExpo(config)#boot system tftp IOS_filename tftp_addresExpo(config)#boot system rom

Copiar el IOS desde un Tftp desde la ROMmonRommon1>set (llevar los valores pedidos del servidor tftp)Rommon2>tftpdnlp

Archivos de configuraciónExpo(config)#config-register 0x2142 (para no cargar archivos de configuración de la nvram)Expo(config)#config-register 0x2102 (para cargar archivos de configuración de la nvram)

0xnnn0 = usar el modo de monitoreo rom

Page 34: Snooping de DHCP

0xnnn1= carga la primera imagen de la flashDe 0xnnn2 a 0xnnnf = carga el archivo de la nvram

Configuración de las Rutas por defectoExpo(config)#ip route 0.0.0.0 0.0.0.0 [direcciòn del siguiente salto] [interface de salidad]

Enrutamiento RIPExpo(config)#router rip Expo(config-router)#network direccion de la RED(red conectada al router)

Debug ip rip

Enurutamiento IGRPExpo(config)#router igrp 101(sistema autónomo)Expo(config)#network direccion de la RED(red conectada al router)

Recuperar un router con password Arrancar el router con el hyperterminal conectado.Antes de que pase 60 segundos mandar una secuencia BREAK alpuerto serie, desde el hyperterminal se corresponde con las teclas Crtl+Pausa.Se entrara en modo ROMMON.El promtp será: rommon 1>Teclear el comando confreg 0x2142El promt será ahora rommon 2>Teclear reset. El router se reinicia.Después de arrancar saltarse las preguntas que hace el router para la configuración inicial con Ctrl+C .Teclear enable, (ahora no hay passwords).Y desde el promt en # teclear:write erasereload para reiniciar de nuevo.

Activar interfaz WEBip http Server

Recuperación Del Rommon

se puede entrar ctrl.-break rommon

rommon1> IP_ADDRESS = dirección de la interfaz LANrommon2>IP_SUBNET_MASK= Mascara de subred para la interfaz LANrommon3>DEFAULT_GATEWAY= gateway predeterminado para la interfaz LAN

Page 35: Snooping de DHCP

rommon4>TFTP_SERVER= direccion ip del server tftprommon5>TFTP_FILE= Nombre de archivo del software cisco

rommon6> set IP_ADDRESS = dirección de la interfaz LANNET_MASK= Mascara de subred para la interfaz LANDEFAULT_GATEWAY= gateway predeterminado para la interfaz LANTFTP_SERVER= direccion ip del server tftpTFTP_FILE= Nombre de archivo del software cisco

Rommon7>tftpdnld

Rommon8>dir flash: (para verificar el archivo)

Rommon9>reset

Copiar el IOS desde un server tftp

router# copy tftp flash pregunta sobre la ip? Ip address del Server tftpnombre del archivo ios? Nombre del archivo

Mensaje del dia MOTDConfigure Terminal banner motd # Escriba aquí el mensaje del día #. copy running-config startup-config

Access list

EstándarRouter#Access-list #(access-list) ip wildmask

interfaceRouter(config-if)#ip access-group 1 inRouter(config-if)#ip access-group 1 out

Access-list extendida

access-list [100-199] [permit/deny][protocolo] [ip origen] [ip destino] [tipo de servicio]ip access-group [100-199] [in/out]

ejm. Denegar un host access-list 1 deny 192.168.500.5 0.0.0.0access-list 1 permit 0.0.0.0 255.255.255.255interface>>>>>>>ip access-group 1 out

Page 36: Snooping de DHCP

Access-list nombradaRouter(config)#Ip access-list [standard/extended] [nombre]

Router(config-std-nacl)#[permit/deny] [ip origen]

Router(config-ext-nacl)#[permit/deny] [protocolo][ip origen] [ip destino] [tipo de servicio]

Ejm. Denegar el telnet a una subredAccess-list 101 deny tcp 172.16.4.0 0.0.0.255 any eq 23Access-list 101 permit ip any any

Interface>> access-group 101 out

Acces-list en terminales virtualesRouter(config)#Ip access-list 10 permit 192.168.100.15Router(config)#line vty 0 4 Router(config-line)#access-class 10 in

VisualizadoresShow access-list (#) Muetsra todas la access list o una em particularShow ip access-list Muetsra la acl ip Show ip interface muestra los puertos que tienen activada aclShow running-config muestra las listas de acceso y donde estan aplicadas

Puertosftp 21 tcptelnet 23 tcp smtp 25 tcpdns 53 udpdhcp 67 udptftp 69 udphttp 80 tcppop3 110 irc 164snmp 161

vizualisadoresshow flashshow version

Page 37: Snooping de DHCP

Show interfaces Show controllers serial (muestra la información sobre la sincronía)Show clockShow hostsShow usersShow historyShow flashShow versionShow startup-configurationShow running-configurationShow cdp neighbors Show cdp interfaceShow ip protocols

AdministracionRouter#Traceroute [ip de destino]

Descripcion de una interfaceRouter(config)#interface xxxxxRouter(config-if)#description xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

HostRouter(config)# ip host [nombre] [direccion ip]

Telnet router>telnet denxdenx>exitdenx>ctrl shift 6 xrouter>

Horizontre dividoip split-horizon no ip split-horizon

Poison Reverse(envenenamiento de rutas)IGRP router(config)# router igrp 109 router(config-router)# default-metric 1000 100 250 100 1500 (bandwidth = 1000 (1Mbps), delay = 100 (1 sec), reliability = 250 (near 100% reliable), loading = 100 (100% bandwidth), and MTU = 1500 (bytes). )

RIP (poison reverse tiene precedencia sobre split horizon, si también está habilitado split horizon)

Page 38: Snooping de DHCP

El comando es set rip poisonreverse enable

Page 39: Snooping de DHCP

CAMBIO ENTRE MODOS

router>router> enable (pasa al Modo Exec Privilegiado)router#router# exit (vuelve a al Modo Exec Usuario)router> enablerouter#router# config terminal (pasa al Modo Configuración Global)router(config)#router(config)# exit ó CTRL+z (vuelve al Modo Exec Privilegiado)router#

NOMBRAR AL ROUTER

router> enablerouter# configure terminal router(config)# hostname RouterA (nombra al router como)RouterA(config)#

CONFIGURAR CONTRASEÑAS “ENABLE SECRET” Y “ENABLE PASSWORD”

RouterA> enableRouterA# configure terminal RouterA(config)# enable secret contraseña (configura contraseña Enable Secret)RouterA(config)# enable password contraseña * (configura contraseña Enable Password)RouterA(config)#

* Es recomendable configurar Enable Password ya que genera una clave global cifrada en el router.

CONFIGURAR CONTRASEÑA DE CONSOLA

RouterA> enableRouterA# config terminalRouterA(config)# line con 0 (ingresa a la Consola)RouterA(config-line)# password contraseña (configura contraseña)RouterA(config-line)# login (habilita la contraseña)RouterA(config-line)# exitRouterA(config)#

CONFIGURAR CONTRASEÑA VTY (TELNET)

RouterA> enableRouterA# config terminal

Page 40: Snooping de DHCP

RouterA(config)# line vty 0 4 (crea las 5 líneas VTY, pero podría ser una sola. Ej: line vty 0)RouterA(config-line)# password contraseña (contraseña para las 5 líneas en este caso)RouterA(config-line)# login (habilita la contraseña)RouterA(config-line)# exitRouterA(config)#

CONFIGURAR INTERFACES ETHERNET Ó FAST ETHERNET

RouterA> enableRouterA# config terminalRouterA(config)# interface fastethernet 0/0 * (ingresa al Submodo de Configuración de Interfaz)RouterA(config-if)# ip address 192.168.0.1 255.255.255.0 (configura la IP en la interfaz)RouterA(config-if)# no shutdown (levanta la interfaz)RouterA(config-if)# description lan (asigna un nombre a la interfaz)RouterA(config-if)# exitRouterA(config)#

* Tener en cuenta que la interfaz puede ser Ethernet o Fast Ethernet y que el número de interfaz puede ser 0, 1, 0/0, 0/1, etc. Esto varía según el router.

CONFIGURAR INTERFACES SERIAL COMO DTE

RouterA> enableRouterA# config terminalRouterA(config)# interface serial 0/0 * (ingresa al Submodo de Configuración de Interfaz)RouterA(config-if)# ip address 10.0.0.1 255.0.0.0 (configura la IP en la interfaz)RouterA(config-if)# no shutdown (levanta la interfaz)RouterA(config-if)# description red (asigna un nombre a la interfaz)RouterA(config-if)# exitRouterA(config)#

* Tener en cuenta que el número de interfaz puede ser 0, 1, 0/0, 0/1, etc. Esto varía según el router.

CONFIGURAR INTERFACES SERIAL COMO DCE

RouterB> enableRouterB# config terminalRouterB(config)# interface serial 0/1 * (ingresa al Submodo de Configuración de Interfaz)RouterB(config-if)# ip address 10.0.0.2 255.0.0.0 (configura la IP en la interfaz)RouterB(config-if)# clock rate 56000 (configura la sincronización entre los enlaces)RouterB(config-if)# no shutdown (levanta la interfaz)RouterB(config-if)# description red (asigna un nombre a la interfaz)RouterB(config-if)# exit

Page 41: Snooping de DHCP

RouterB(config)#

* Tener en cuenta que el número de interfaz puede ser 0, 1, 0/0, 0/1, etc. Esto varía según el router.

Page 42: Snooping de DHCP

http://www.networking.com.py/?p=62