ASA and NAT

ASA NAT order of operation

#####Previo 8.3
 With source NAT:
  1. Routing
  2. Inbound ACL
  3. NAT

With destination NAT:
  1 .ACL
  2. UN-NAT (destination NAT)
  3. Routing

#####Post 8.3
With source NAT:
  1. Routing
  2. Inbound ACL
  3.NAT

With destination NAT:
  1. UN-NAT (destination NAT)
  2. ACL
  3. Routing




Paso a paso: cómo configurar Switch Catalyst Cisco

SDM (Switching Database Manager)

  switch(config)#sdm prefer {access | extended-match | routing | vlan}
  switch# show sdm prefer


Detección de  Errores en los puertos

  switch(config)# errdisable detect cause [all | name]
 switch(config)# errdisable recovery cause [all name]
 switch(config)# errdisable recovery interval seconds


Dynamic Trunking Protocol (DTP)

Para que funcione tenemos que tener los dos switches con el mismo VTP domain o que no haya ningún VTP domain definido.

switchport mode:
  - trunk: Pon el puerto en trunking permanente, DTP todavía envia paquetes.
  - dynamic desirable (default): Activo
  - dynamic auto: Pasivo


Para desactivarlo totalmente haremos lo siguiente:

  switch(config-if)# switchport mode trunk

  switch(config-if)# switchport nonegotiate

Voice QoS

  switch(config)# mls qos
  switch(config)# interface type mod/num
  switch(config-if)# mls qos trust {cos | ip-precedence | dscp}
  switch(config-if)# mls qos device cisco-phone 
Sobreescribe o no el tag cos proveniente del puerto PC:   
  switch(config-if)# switchport priority extended {cos value | trust}
Switch Uplink port:  
  switch(config-if)# mls qos trus cos

Auto-QoS:
   - Habilita QoS
   - Mapping CoS-to-DSCP para los paquetes QoS marcados.
   - Tuning colas de entrada y salida.
   - Strict priority queues para el tráfico de voz saliente.
   - Establece la interface como QoS trust boundary.

  switch(config)# interface type mod/num
  switch(config-if)# auto qos voip {cisco-phone | cisco-softphone | trust}
Nota: El teléfono es detectado por CPD


Port Security
  switch(config)# interface fastethernet 0/1
  switch(config-if)# switchport access vlan VLAN
  switch(config-if)# switchport mode access
  switch(config-if)# switchport port-security maximum max-addr
Para configurar entradas MACs de forma estática:
  switch(config-if)# switchport port-security mac-address mac-addr
  switch(config-if)# switchport port-security violation {shutdown | restrict | protect}

  • Shutdown: Pone el puerto en estado Errdisable.
  • Restrict: El puerto esta Up y denega todo el tráfico de la @MAC que viola la seguridad. Además envia traps y syslogs.
  • Protect: El puerto esta Up y denega todo el tráfico de la @MAC que viola la seguridad.

Port-Based Authentication (802.1X)


  switch(config)# aaa new-model
  switch(config)# radius-server host ip-addres [key string]
  switch(config)# aaa authentication dot1x default group radius
  switch(config)# dot1x system-auth-control
  switch(config)# interface type mod/num
  switch(config-if)# dot1x port-control {force-authorize | force-unauthorize | auto}
  • force-authorize: No es necesaria la autenticación.
  • force-unauthorize: El puerto siempre denega el acceso.
  • auto: El puerto usa 802.1X para decidir el estado authorize o unauthorize.

EVITAR SPOOFING ATTACKS

DHCP Snooping

  switch(config)# ip dhcp snooping
  switch(config)# ip dhcp snooping vlan vlan-id
Por defecto todas las interfaces estan en "untrusted", así que asignamos "trust" en la interface que tengamos conectado el servidor DHCP
  switch(config)# interface type mod/num
  switch(config-if)# ip dhcp snoooping trust
En las interfaces "untrusted" podemos limitar el número de paquetes DHCP request que aceptaremos en dicho puerto
  switch(config)# interface type mod/num
  switch(config-if)# ip dhcp snoooping limit rate rate
Habilitamos la opción-82. Está habilitada por defecto
  switch(config)# ip dhcp snooping information option


IP Source Guard

Básicamente comprueva que todos los paquetes que llegan en un puerto:
- Su @IP de origen se encuentra en la database DHCP  snooping o que han sido introducidos de forma manual.
- Su @MAC de origen se encuentra en la database DHCP snooping y es idéntica a la aprendida por el puerto del switch.
Para los host que no utilizan DHCP, los introducimos de forma manual:
  switch(config)# ip source binding mac-address vlan vlan-id ip-address interface type mod/num
Lo habilitamos en las interfaces:
Por defecto solo analiza la @IP de origen, pero con el comando port-security también analizará li @MAC de origen.
  switch(config)# interface type mod/num
  switch(config-if)# ip verify source [port-security]


Dynamic ARP Inspection (DAI)

Corresponde al ataque ARP poisoning o ARP spoofing.
El switch inspecciona todos los paquetes ARP que llegan en un puerto untrusted, cuándo un ARP reply llega en un puerto "untrusted" el switch comprueba que la @MAC y la @IP del paquete pertenecen en la database DCHP Snooping o han sido introducidos de froma estática.
Habilitamos DAI:
  switch(config)# ip arp inspection vlan vlan-range
Por defecto todos los puertos son considerados untrusted y inspeccionados.
  switch(config)# interface type mod/num
  switch(config-if)# ip arp inspection trust
Si tenemos hosts con direcciones IPs estáticas, hemos de definir un access-list MAC-IPs que seran permitidas:
  switch(config)# arp access-list acl-name
  switch(config-acl)# permit ip host sender-ip mac host sender-mac [log]
...
Aplicamos el ACL. El siguiente comando indica que primer ha de comprobar el ACL y en caso de no encontrar nada comprueba el DHCP binding database.
  switch(config)# arp inspection filter staticARP-acl vlan vlan-range  [static]
Para más validaciones podemos comprovar que el paquete ARP reply provenga realmente del propio interface:
 - src-mac: @MAC origen Ethernet Header == sender@ MAC en ARP reply
 - dst-mac: @MAC destino Ethernet Header == @MAC destino en ARP reply
 - ip: @IP emisor todas peticiones ARP == @ IP destino en todos los ARP replies
  switch(config)# ip arp inspection validate {[src-mac] [dst-mac] [ip]}


SEGURIDAD EN VLANS

VLAN Access Lists

  switch(config)# vlan access-map map-name [seq-number]
  switch(config-map)# match ip address {acl-number | acl-name}
  switch(config-map)# match ipx address {acl-number | acl-name}
  switch(config-map)# match mac address acl-name
  switch(config-map)# action {drop | forward [capture] | redirect type mod/num }
  switch(config)# valn filter map-name vlan-list vlan-list


Private VLANs

Escenarios a solventar:
1. La VLAN de servidors ha de ser capaz de comunicarse con el gateway, pero cada servidor no tiene porque escuchar el tráfico broadcast que genera el otro.
2. Cada servidor tiener que estar aislado el uno con el otro pero todos ellos han de ser capaces de comunicarse con el gateway para alcanzar los clientes en otra VLAN.
3. Service Provider: Cada cliente necesita ser capaz de comunicarse con el gateway, pero no han de poder interactuar con los otros clientes.

En Private VLAN tenemos dos VLANs: primary y secondary.
Hosts que estan en una VLAN secundaria pueden comunicarse con la VLAN primaria, pero nunca con otra VLAN secundaria.
Tipos VLANs secundarias:
  - Isolated: Un host asociado NO se puede comunicar con otro de la misma VLAN, pero puede alcanzar la VLAN primaria
  - Community: Un host asociado se puede comunicar con otro host de la misma VLAN y con la VLAN primaria.

Port mode:
  - Promiscuous (VLAN Primary): Se puede comunicar con cualquiera conectado en la VLAN primaria o secundaria.
  - Host (VLAN Secundary): El host se puede puede ser isolated o community. 


Configurar VLAN secundaria (hosts):
  switch(config)# vlan vlan-id
  switch(config-vlan)# private-vlan {isolated | community}
Configurar VLAN primaria (router):
  switch(config)# vlan vlan-id
  switch(config-vlan)# private-vlan primary
  switch(config-vlan)# private-vlan association [add | remove] secondary-vlan-list
Asociamos los puertos con las vlans:
  Puerto Host (server):
  switch(config-if)# switchport mode private-vlan host
  switch(config-if)# switchport private-vlan host-association primary-vlan-id secondary-vlan-id
  Puerto promiscuous (router):
  switch(config-if)# switchport mode private-vlan promiscuous
  switch(config-if)# switchport private-vlan mapping primary-vlan-id [add | remove] secondary-vlan-list
  Si la vlan primaria es SVI:
  switch(config)# vlan vlan-id
  switch(config-vlan)# private-vlan primary
  switch(config-vlan)# private-vlan association secondary-vlan-list
  switch(config)# interface vlan vlan-id
  switch(config-if)# private-vlan mapping sencondary-vlan-list
Nota: No hemos de configurar la VLAN estática





Understanding 802.11 Frame Types


General frame concepts

The 802.11 standard defines various frame types that stations (NICs and access points) use for communications, as well as managing and controlling the wireless link. Every frame has a control field that depicts the 802.11 protocol version, frame type, and various indicators, such as whether WEP is on, power management is active, and so on. In addition all frames contain MAC addresses of the source and destination station (and access point), a frame sequence number, frame body and frame check sequence (for error detection).

802.11 data frames carry protocols and data from higher layers within the frame body. A data frame, for example, could be carrying the HTML code from a Web page (complete with TCP/IP headers) that the user is viewing. Other frames that stations use for management and control carry specific information regarding the wireless link in the frame body. For example, a beacon's frame body contains the service set identifier (SSID), timestamp, and other pertinent information regarding the access point.

Note: For more details regarding 802.11 frame structure and usage, refer to the 802.11 standard, which is free for download from the 802.11 Working Group Web site.

Management Frames

802.11 management frames enable stations to establish and maintain communications. The following are common 802.11 management frame subtypes:

Authentication frame: 802.11 authentication is a process whereby the access point either accepts or rejects the identity of a radio NIC. The NIC begins the process by sending an authentication frame containing its identity to the access point. With open system authentication (the default), the radio NIC sends only one authentication frame, and the access point responds with an authentication frame as a response indicating acceptance (or rejection). With the optional shared key authentication, the radio NIC sends an initial authentication frame, and the access point responds with an authentication frame containing challenge text. The radio NIC must send an encrypted version of the challenge text (using its WEP key) in an authentication frame back to the access point. The access point ensures that the radio NIC has the correct WEP key (which is the basis for authentication) by seeing whether the challenge text recovered after decryption is the same that was sent previously. Based on the results of this comparison, the access point replies to the radio NIC with an authentication frame signifying the result of authentication.


Deauthentication frame: A station sends a deauthentication frame to another station if it wishes to terminate secure communications.


Association request frame: 802.11 association enables the access point to allocate resources for and synchronize with a radio NIC. A NIC begins the association process by sending an association request to an access point. This frame carries information about the NIC (e.g., supported data rates) and the SSID of the network it wishes to associate with. After receiving the association request, the access point considers associating with the NIC, and (if accepted) reserves memory space and establishes an association ID for the NIC.


Association response frame: An access point sends an association response frame containing an acceptance or rejection notice to the radio NIC requesting association. If the access point accepts the radio NIC, the frame includes information regarding the association, such as association ID and supported data rates. If the outcome of the association is positive, the radio NIC can utilize the access point to communicate with other NICs on the network and systems on the distribution (i.e., Ethernet) side of the access point.


Reassociation request frame: If a radio NIC roams away from the currently associated access point and finds another access point having a stronger beacon signal, the radio NIC will send a reassociation frame to the new access point. The new access point then coordinates the forwarding of data frames that may still be in the buffer of the previous access point waiting for transmission to the radio NIC.


Reassociation response frame: An access point sends a reassociation response frame containing an acceptance or rejection notice to the radio NIC requesting reassociation. Similar to the association process, the frame includes information regarding the association, such as association ID and supported data rates.


Disassociation frame: A station sends a disassociation frame to another station if it wishes to terminate the association. For example, a radio NIC that is shut down gracefully can send a disassociation frame to alert the access point that the NIC is powering off. The access point can then relinquish memory allocations and remove the radio NIC from the association table.


Beacon frame: The access point periodically sends a beacon frame to announce its presence and relay information, such as timestamp, SSID, and other parameters regarding the access point to radio NICs that are within range. Radio NICs continually scan all 802.11 radio channels and listen to beacons as the basis for choosing which access point is best to associate with.


Probe request frame: A station sends a probe request frame when it needs to obtain information from another station. For example, a radio NIC would send a probe request to determine which access points are within range.


Probe response frame: A station will respond with a probe response frame, containing capability information, supported data rates, etc., when after it receives a probe request frame.
Control Frames

802.11 control frames assist in the delivery of data frames between stations. The following are common 802.11 control frame subtypes:

Request to Send (RTS) frame: The RTS/CTS function is optional and reduces frame collisions present when hidden stations have associations with the same access point. A station sends a RTS frame to another station as the first phase of a two-way handshake necessary before sending a data frame.


Clear to Send (CTS) frame: A station responds to a RTS with a CTS frame, providing clearance for the requesting station to send a data frame. The CTS includes a time value that causes all other stations (including hidden stations) to hold off transmission of frames for a time period necessary for the requesting station to send its frame. This minimizes collisions among hidden stations, which can result in higher throughput if you implement it properly.


Acknowledgement (ACK) frame: After receiving a data frame, the receiving station will utilize an error checking processes to detect the presence of errors. The receiving station will send an ACK frame to the sending station if no errors are found. If the sending station doesn't receive an ACK after a period of time, the sending station will retransmit the frame.
Data Frames

Of course the main purpose of having a wireless LAN is to transport data. 802.11 defines a data frame type that carries packets from higher layers, such as web pages, printer control data, etc., within the body of the frame. When viewing 802.11 data frames with a packet analyzer, you can generally observe the contents of the frame body to see what packets that the 802.11 data frames are transporting.

HP Procurve Multicast Layer2 y Layer3

Multicast Layer-2

Ejecutamos el siguiente comando para toadas las vlans de todos los switches que queramos activar el multicast.

switch(conf)# vlan 2
switch(vlan-2 proto)# ip igmp

Multicast Layer-3

En mi ejemplo dispondremos de un switch procurve 3400 que hará de router.

Activamos el enrutamiento del switch
sw3400(conf)# ip routing
sw3400(conf)# ip multicast-routing

En mi caso utilizaremos PIM Dense Mode
sw5406zl(conf)# rotuer pim


En cada vlan activamos que queramos IP-multicast activamos IGMP y PIM-Dense Mode

vlan 2
ip address 192.168.20.254 255.255.255.0
ip igmp
ip pim

vlan 3
ip address 192.168.30.254 255.255.255.0
ip igmp
ip pim


Con la siguiente aplicación podemos verificar el buen funcionamiento generando tráfico multicast desde nuestro PC.

Multicast Hammer


En ejecutar la aplicación observamos que generan los grupos y rutas multicast en nuestro switch:
En este ejemplo utilizamos la VLAN2 como cliente y la VLAN3 como servidor.

sw3400#show ip igmp
VLAN ID : 2
VLAN Name : vlan2
Querier Address : This switch is Querier

Active Group Addresses Reports Queries Querier Access Port
---------------------- ------- ------- -------------------
234.141.6.7 3 0
234.141.6.8 3 0
234.141.6.9 3 0
234.141.6.10 3 0
234.141.6.11 2 0
239.255.255.250 16 0


VLAN ID : 3
VLAN Name : vlan3
Querier Address : This switch is Querier

Active Group Addresses Reports Queries Querier Access Port
---------------------- ------- ------- -------------------
239.255.255.250 16 0



SWAJ34001# sh ip mroute

IP Multicast Route Entries

Total number of entries : 16

Group Address Source Address Neighbor VLAN
--------------- --------------- --------------- ----
234.141.6.7 192.168.20.1 3
234.141.6.8 192.168.20.1 3
234.141.6.9 192.168.20.1 3
234.141.6.10 192.168.20.1 3
234.141.6.11 192.168.20.1 3



PEAP No guardar credenciales Windows XP

Si no se quieren que se guarden las credenciales del usiario y nos las vuelva a pedir, se elimina le entrada del registr UserEapInfo.

Decibeles

Qué son los Decibeles?

La razón básica de utilizar antenas es por que tienen "ganancia" - en otras palabras, incrementan la fuerza de la señal. Notese que no crean energía mágicamente, solo dirigen o enfocan las señales de radio en un haz más estrecho del mismo modo que una lampara sorda lo hace. A mayor ganancia, se obtiene un haz más estrecho con potencia concentrada - pero solo en cierta zona!
La ganancia de una antena se puede entender en terminos de la relación entre entrada y salida - de 1 a 2, 1 a 3, 1 a 4, etc. - esto es debido a que la ganancia es independiente de la potencia. En otras palabras, una antena que duplica la fuerza de la señal de un amplificador de un watt, también duplicará la fuerza de la señal de un amplificador de 10 watts.
Del mismo modo, las atenuaciones o pérdidas también son independientes de la potencia y así un mal cable que atenúa la mitad convertirá un watt en medio watt y diez watts en cinco watts.

Como vimos antes es fácil entender las ganancias y atenuaciones en terminos de cuanto se gana o pierde comparado contra un valor inicial. Sin embargo en la vida real hablamos de varios casos juntos y las cosas se complican - Imaginemos el caso donde "Tengo una antena de 17 veces de ganancia con un tercio de pérdida en el cable y un décimo de pérdida en conectores", se vuelve en extremo dificil ver cuanto es la ganancia total en el sistema, verdad?

Con el fin de simplificar el problema anterior se utilizan los decibeles (dB), los cuales son una representación de la relación de ganancia o pérdida en un sistema. Lo bueno de usar decibeles es que en vez de multiplicar y dividir ganancias y pérdidas respectivamente solo sumamos o restamos decibeles. (Ganancia es un número positivo en decibeles y Pérdida es un número negativo en decibeles). Así pues, si tengo una antena de 15 dB de ganancia con una pérdida de 3 decibeles en el cable y 2 decibeles en conectores, la ganancia de mi sistema es de un total de 10 dBs! (15 dBs (antena) -3 (cable) -2 (conectores) = 10 dB (total)) Mucho más fácil!

Algunos ejemplos de relacion de ganancia:

El doble de potencia es igual a +3dB, y la mitad es -3dB
El cuadrúple de la potencia es igual a +6 dB, y la cuarta parte sería -6 dB
Diez veces la potencia equivale a 10dB y la décima parte es -10dB
Cien veces la potencia equivale a 20dB y una céntesima parte es -20dB
(como se puede ver, la relación es logaritmica ya que los decibeles se definen como 10 * el logaritmo de la relación entre potencias)

Hasta este punto hemos hablado de relaciones de ganancia o pérdida, lo cual es independiente de la potencia. Así pues, no tiene sentido preguntar "Cuanta potencia me dará una antena de 23 dB?" - la antena obtiene tanta potencia como le mande el transmisor, pero la enfoca para dar un efecto de un transmisor 23 dBs más fuerte (o 200 veces más fuerte), pero solo en la dirección hacía donde está enfocada. De hecho, el ancho efectivo de la señal enfocada se especifica en las características de la antena como grados del haz (o beamwidth en grados) y es la zona donde la señal enfocada obtiene su máximo en el centro y baja -3 dBs de cada lado.

En base a lo anterior es claro que una antena de alta ganancia tendrá un haz estrecho y por tanto es más importante hacer una buena alineación. En este punto es importante hacer notar que la ganancia puede ser obtenida en el plano horizontal, vertical o ambos. Una característica de las antenas es la polarización - ya sea vertical u horizontal y define la forma en que las ondas de radio son transmitidas, pero lo más importante de esto es que si la polarización del transmisor y receptor no es la misma se causa una atenuación de más de 20 dBs!

Para terminar, un termino comunmente encontrado es "dBm" y que se refiere a potencia. Un miliwatt (una milésima de watt) equivale a 0dBm y en base a esta referencia se expresan las potencias de los equipos. La potencia de un equipo no es lo mismo que la ganancia como se vió antes, esta es potencia real y la otra es relación de cuando se enfoca la señal.
La sensibilidad de un radio también se expresa en terminos de cuantos dBm o que nivel de potencia se requiere para "entender" una señal.
Así, si tengo una transmisor de 20 dBm, una ganancia de antena de 15 dB, una pérdida en trayectoria (atenuación de señal en la atmosfera), ganancia de antena receptora de 10dB y una sensibilidad de receptor de -90 dBm, es posible tener un enlace?

La solución es cosa de sumar las ganancias y restar pérdidas:
20dBm (potencia de salida) + 15 dB (ganancia antena) - 100 dB (atenuación atmosfera) +10 dB = -50 dBm
Este valor obtenido es el valor de recepción teórico serían los -50 dBm, el cual está 40 dBs por encima de la sensibilidad del receptor por lo cual el enlace si funcionaría - siempre y cuando no hayan obstrucciones en la trayectoria.

Configurar Radio Cisco Aironet

PREAMBLE-SHORT

Este comando minimiza el overhead por las tramas y por lo tanto se tarda menos tiempo en procesar la trama.
(config-if)#preamble-short

En entornos con mucho ruido y señal débil es recomendable desactivarlo:
(config-if)#no preamble-short


DOT11 EXTENSION AIRONET
Si los clientes no son Cisco mejor deshabilitarlas
(config-if)#no dot11 extension aironet

Podemos mejorar el rendimiento, reduciento el tiempo entre tramas. Solamente tendrá efecto este comando cuándo todos los clientes lo suporten.
(config-if)#slot-time-short


Otros comandos que pueden mejorar el funcionamiento:
(config-if)#packet retries 64 drop-packet
(config-if)#fragment-threshold 1024


CANAL O FRECUENCIA

En caso de que estemos en un edificio con clientes internacionales, como por ejemplo un hotel hemos de tener en cuenta a deshabilitar los canales 12 y 13. En concreto en América solamente se utilizan del 1 al 11 en la frecuéncia de 2,4 Ghz.

(config-if)#channel least-congested 1 2 3 4 5 6 7 8 9 10 11


SPEED Y POWER BOTH

Si se tenienen varios puntos de acceso cerca podemos eliminar las velocidades des conexión mas bajas y también para evitar más interferencias entre ellos bajar la potencia de emisión del AP:

(config-if)#no speed 1.0 2.0 5.5 6.0 9.0
(config-if)#power both ofdm 11


BROADCAST-KEY CHANGE

Si utilizamos WPA o WPA2 podemos configurar que cada cierto tiempo se generen de nuevo las claves para todos los clientes asociadoes en el AP, también cada vez que se desconecte un cliente. Tener en cuenta que este último puede ser una vulnerabilidad ya que si se produce repetidas veces en poco tiempo podría sobrecargar el AP.

(config-if)#broadcast-key vlan 10 change 3600 membership-termination


REAUTENTICACIÓN EAP

Si utilizamos autenticación a través del protocolo EAP (PEAP, EAP-TLS, LEAP, ...) podemos modificar el tiempo para exigir al cliente que se reautentique al punto de acceso, en mi caso cada 3600 segundos:

(config)#dot1x timeout reauth-period 3600

En el caso que queramos que sea el radius quién sea el que decida el tiempo de petición de reautenticación, ejecutamos el siguiente comando en el punto de acceso:
(config)#dot1x timeout reauth-period server

Y en mi caso utilizo un radius IAS de Microsoft marcon en la pestaña "Restricciones de Marcado" el checkbox "Minutos que el cliente puede estar conectado (tiempo límiete de sesión)" con el tiempo deseado (en mi caso 15 minutos).