ASA Lab with ASDM

asav-lab2

It has been too long since my last post. I’ve been very busy in work and also studying away working towards CCNA security. I just wanted to show what my latest topology looks like that I will be using to study with doing as many labs as possible. Hopefully, this will grow over time.

The topology as full access to the Internet which is great.

And also the most important piece is I have the ASDM running from my browser on my PC ūüôā as you can see below.

asdm

This is a big deal as I will be able to configure the ASA from the ASDM and practice using it as much as possible.

I will probably add a zone-based router to the topology at some stage as well. The switches are vIOS switches which will allow me to do Port Security and DHCP Snooping etc.

If you have any questions on the setup let me know.

Note: The lab has been built using GNS3 version 2.0b3

 

 

IPSec Site-to-Site VPN

 

In this post, I will show you how to setup a site-to-site VPN using IPSec. I read up on IPSec and its two tunnels IKE Phase 1 (Management) and IKE Phase 2 (Data) and thought the best way to understand this is to create a lab.

Lab Topology

screenshot

Above is the lab that I set up. A few things to know.

I am using BGP between R1-R2-R3. R1 is Site1 and R3 is Site2. R2 is the Internet. I’m not going to through setting up the eBGP peerings but the main thing once configured is that you can ping from Site1’s public IP address to Sites2’s public IP address. If you would like the configuration files for the basic setup including eBGP let me know and I will share them with you.

Lab Objectives:

  1. Setup IKE Phase 1 Tunnel using the following parameters:
  • Hashing= SHA
  • Authentication= pre-shared key
  • DH Group= 5
  • Lifetime= Default
  • Encryption= AES-128

2. Setup IKE Phase 2 Tunnel using the following parameters:

  • Create a transform set using esp-des and esp-md5-hmac
  • Create a crypto map with the peer address, reference the transform set and access-list
  • Create an access-list to identify¬†interesting traffic to encrypt using the IPSec tunnel

Lab Configuration

With connectivity already in place, we should be able to ping each sites public IP address across the Internet.

Site 1:

Site1#ping 96.1.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 96.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/21/24 ms

Site 2:

Site2#ping 86.1.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 86.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/28/40 ms

Also, we should try and ping each LAN PC. This is to show that at the moment we have no way of reaching each sites LAN but when we setup IPSec our data will be encapsulated and encrypted using the public addresses.

PC1 (Site 1)

No dice as expected!

PC1> ping 196.168.1.2
196.168.1.2 icmp_seq=1 timeout
196.168.1.2 icmp_seq=2 timeout
196.168.1.2 icmp_seq=3 timeout
196.168.1.2 icmp_seq=4 timeout
196.168.1.2 icmp_seq=5 timeout

PC2 (Site 2)

Same result!

PC2> ping 172.16.0.2
172.16.0.2 icmp_seq=1 timeout
172.16.0.2 icmp_seq=2 timeout
172.16.0.2 icmp_seq=3 timeout
172.16.0.2 icmp_seq=4 timeout
172.16.0.2 icmp_seq=5 timeout

IKE Phase 1

Keeping in mind the Lab Objectives lets set up each of the IKE Phase 1 requirements.

First, we need to setup a isakmp policy.

Site1(config)#crypto isakmp policy 1

A good way to remember what parameters can be set in IKE Phase 1 is the word HAGLE.

H=Hash

A=Authenication

G=DH Group

L=Lifetime

E=Encryption
Site1(config-isakmp)#hash sha
Site1(config-isakmp)#authentication pre-share
Site1(config-isakmp)#group 5
Site1(config-isakmp)#encryption aes 128

I left the lifetime of the tunnel to the default here for this lab. Note that the parameters need to match on each site for the IKE Phase 1 tunnel to come up.

Next step is to set the pre shared key that will be used between the two sites. Lets use mrrobot.

Site1(config)#crypto isakmp key mrrobot address 96.1.1.1

Here we have entered the shared key to use and also the peer address we want to use it within our case Site 2.

IKE Phase 2

This tunnel is the IPSec tunnel which will be used to encrypt user data.

Site1(config)#crypto ipsec transform-set myset esp-des esp-md5-hmac

Here we are using a transform-set with the name myset given to it and we are using esp-des for encryption (weak very weak but it will do for the lab)  and esp-md5-hmas for hashing and integrity.

Next, we will set up a crypto map

Site1(config)#crypto map mymap 10 ipsec-isakmp
% NOTE: This new crypto map will remain disabled until a peer
and a valid access list have been configured.
Site1(config-crypto-map)#set peer 96.1.1.1
Site1(config-crypto-map)#set transform-set myset
Site1(config-crypto-map)#match address 100
Site1(config-crypto-map)#exit

Here we are telling the crypto map called mymap what peer to setup the tunnel with, the transform set to use and what interesting traffic to match.

Next setup the access-list that the crypto map is using.

Site1(config)#access-list 100 permit ip 172.16.0.0 0.0.0.255 192.168.0.0 0.0.0.255

With this access-list we are telling it to match traffic from Site 1 LAN with a destination of Site 2 LAN any other traffic that does not match this access list will be sent unencrypted.

Lastly we need to apply the crypto map to the public facing interface.

Site1(config)#int fa0/0
Site1(config-if)#crypto map mymap
*Mar 1 01:12:06.375: %CRYPTO-6-ISAKMP_ON_OFF: ISAKMP is ON

Ok that is everything we need to configure on Site 1 for IPSec. I am not going to go through the same for Site 2 as it is pretty much the same but in reverse.

Testing

So lets test this out to see if it works if it does traffic that we tried to send earlier from Site 1’s LAN should now be successful.

Ping from PC1 to PC2

PC1> ping 192.168.0.2
192.168.0.2 icmp_seq=1 timeout
192.168.0.2 icmp_seq=2 timeout
84 bytes from 192.168.0.2 icmp_seq=3 ttl=62 time=36.000 ms
84 bytes from 192.168.0.2 icmp_seq=4 ttl=62 time=39.000 ms
84 bytes from 192.168.0.2 icmp_seq=5 ttl=62 time=43.000 ms

Success ! The first two packets that failed could be due to ARP and/or the time it took for the two Tunnels to be built.

And just to show the other side is also working.

PC2> ping 172.16.0.2
84 bytes from 172.16.0.2 icmp_seq=1 ttl=62 time=36.000 ms
84 bytes from 172.16.0.2 icmp_seq=2 ttl=62 time=42.000 ms
84 bytes from 172.16.0.2 icmp_seq=3 ttl=62 time=50.000 ms
84 bytes from 172.16.0.2 icmp_seq=4 ttl=62 time=49.000 ms
84 bytes from 172.16.0.2 icmp_seq=5 ttl=62 time=46.000 ms

Show commands

IKE Phase 1 Tunnel

Site1#show crypto isakmp sa

dst          src                     state               conn-id    slot         status
86.1.1.1  96.1.1.1             QM_IDLE      1                  0             ACTIVE

Here we see that we have an IKE Phase Tunnel Active.

IKE Phase 2 Tunnel

Site1#show crypto ipsec sa

interface: FastEthernet0/0
Crypto map tag: mymap, local addr 86.1.1.1

protected vrf: (none)
local ident (addr/mask/prot/port): (172.16.0.0/255.255.255.0/0/0)
remote ident (addr/mask/prot/port): (192.168.0.0/255.255.255.0/0/0)
current_peer 96.1.1.1 port 500
PERMIT, flags={origin_is_acl,}
#pkts encaps: 5, #pkts encrypt: 5, #pkts digest: 5
#pkts decaps: 9, #pkts decrypt: 9, #pkts verify: 9
#pkts compressed: 0, #pkts decompressed: 0
#pkts not compressed: 0, #pkts compr. failed: 0
#pkts not decompressed: 0, #pkts decompress failed: 0
#send errors 0, #recv errors 0

local crypto endpt.: 86.1.1.1, remote crypto endpt.: 96.1.1.1
path mtu 1500, ip mtu 1500, ip mtu idb FastEthernet0/0
current outbound spi: 0xD796A48B(3616973963)

A lot more information in the IPSec output. We can see what interface the crypto map is on. What is the local and remote addresses that are getting encrypted? The current peer. The number of packets sent and the number encrypted.

eBGP Configuration

As requested from by Muadiv here is the BGP configuration on each router for this lab.

Site 1:

router bgp 1
no synchronization
bgp log-neighbor-changes
neighbor 86.1.1.2 remote-as 2
no auto-summary

Internet Router:

router bgp 2
no synchronization
bgp log-neighbor-changes
network 86.1.1.0 mask 255.255.255.0
network 96.1.1.0 mask 255.255.255.0
neighbor 86.1.1.1 remote-as 1
neighbor 96.1.1.1 remote-as 3
no auto-summary

Site 2:

router bgp 3
no synchronization
bgp log-neighbor-changes
neighbor 96.1.1.2 remote-as 2
no auto-summary

 

Labs Labs Labs…

For me labs are the most important part of my pursuit of certification. I am a visual learner more than anything else and I find doing labs is a great way to learn and it also helps you remember topics and commands. Another important part is troubleshooting your lab, when you first configure something chances are it wont work fist time round so you have to think about what steps you have taken in configuring the lab and start troubleshooting the issues. What a great way to learn.

So what is the best way to practice using labs? The lab rental model is good if you don’t¬†have the physical hardware, it can be expensive to buy and run in your own home lab, the other option is to run virtual labs on your own PC at home and its the one I use.

I built my own PC which was another great learning experience. It has a i5 Intel processor, with 16G of RAM, 250G SSD, ASRock Motherboard….I wont bore you with all the details but its a powerful enough machine.

So what is the best software out there to run on your own PC? I use a combination of software depending on what I am doing. I use Packet Tracer for every quick and basic labs. I also run GNS3 which is for more complex labs which I used a lot for my CCNP R&S certification exams.

But the latest one I am using is Unified Networking Labs or UNL for short. To run the UNL software you must use VMWare or VirtualBox and need a powerful PC depending on the complexity of the lab you want to run. You can download the software from http://www.unetlab.com/ if you are interested in trying it out.

So why UNL? Well it supports a lot of the security appliances you need to use for the CCNA Security exam. ACS, ASA, ASAv, Cisco Switches IOU, Cisco Routers to name a few. It is really important to get some hands on experience on the ASA in particular and also its GUI interface the ASDM.

Unified Network Labs

Below I will show you what it looks like and also setup the ASA and a Virtual Windows Machine to access the ASDM from all within the UNL system.

I wont go into detail on how to install the software as the UNL website does a really good job of that and also provides videos as well.

unl_login
UNL Login Screen

Once you start the VMWare for UNL you log onto the system via your browser. Username/Password is admin/unl.

Once logged in you’ll get the following screen.

addlab

To create a new lab click on Actions and ‘Add a new lab’

After naming your lab and saving it it will appear in your list, double click on the lab and then select Open.

selectlab

On the left hand side click the plus button to add an object and select node. Select ASAv from the list to add it to the lab, do this again and select Windows to add a virtual Windows machine. Next select the link icon to add a link between the nodes. asdm

Next step is to Start the nodes by right clicking on them and selecting Start. Now the fun begins configuring the ASAv and Windows machine so we can not only configure the ASAv via the CLI but also using the ASDM GUI.

First thing we need to do is configure the ASAv node. I am using putty here.

asaputty

First step, configure the management interface that is connected to the Windows machine. Here I gave it an IP address of 192.168.1.200/24.

I then enable http server and also told the ASA what network is allowed to connect to it.

What isn’t shown in the screen capture above is configuring a username and password to use via the ASDM. The command for this is:

#username admin password admin123 privilege 15

You also need to tell the ASDM how to authenticate the user and what database to use. I’m just using the local ASA one.

#aaa authenticate http console LOCAL

That is it ! now save your configuration using wr command.

Next the Windows machine. I connect to it via Remote Desktop Viewer (I run Linux on my home PC)

windows

Nothing special here apart from the fact that you need to have the Windows machine on the same network as the ASA. Open up Network Connections and enter in an IP address in the 192.168.1.0 subnet. I used 192.168.1.201/24.

Once configured run a quick ping test.

ping

SUCCESS !

Double click on the ASDM icon to launch the ASDM and configure the IP address as the IP address you gave the management interface on the ASAv in my case 192.168.1.200 and the username/password of admin/admin123.

 

asdmhs

Bingo ! I am now connected to the ASAv via the ASDM GUI.

I hope you find this useful. Any questions just ask in the comments section.

NOTE: You need to download and install the different images you want to use in the UNL system via the Cisco website just like you have to do with GNS3. The UNL website has a HOW-TO guide on how to import them into the system.

Spoofing

Both MAC and IP Addresses can be spoofed using different tools available to an attacker.

They might carry out a ARP poisoning attack creating a Man In The Middle so they can see all traffic going between host devices and the default gateway of the network. CAM table overflow attack is another were an attacker would send thousands of spoofed MAC addresses into a network to fill up the CAM table of a switch.

Attackers spoof IP Addresses when carrying out DDoS attacks particularly when using reflection attacks. The attacker would set the source address to the end point they want to attack so when they send a request to an open NTP server on the internet using the ‘monlist’ command (which requests the last 600 IP addresses that requested time from the NTP server) the reply will go to the end point that the attacker is targeting and not back to the attacker itself.

ISPs need to be part of the solution by deploying ingress filtering on their networks to stop attackers on their network spoofing IP addresses.

 

 

DoS/DDoS

DoS (Denial Of Service) attack is aimed at making a network resource such as a website unavailable for valid use. These types of attacks are a major risk to a company’s infrastructure ¬†and also their reputation. If a company offers a service available on the internet it can be targeted by an attack(s) for a number of reasons, they mightn’t agree with the companies policies, bought a service from them that didn’t meet their expectations, ex-employee and so on. Attackers can use known vulnerabilities in networking protocols to launch an attack with, such has a TCP SYN Attack. TCP is a reliable¬†protocol which means it will keep track to see if all packets are delivered and if not it will resend the packets that were lost along the way. When a client (host) wants to communicate with a website it will first set up a TCP connection with the server. This is called the 3-way handshake as shown below.

 

3waytcp

 

With a TCP SYN Attack the attacker will keep sending SYN requests towards the target in our example the web server. In return the web server will send a SYN ACK back to the client but most likely the attacker is sending hundreds of requests from spoofed IP addresses and because of this¬†the web server will never receive the ACK back. The web server is kind enough to wait for the ACK and in doing so ties up resources on the web server and the more SYN requests the more resources are used until all resources are used up. Now legitimate users traffic can’t establish a TCP connection with the web server as it cannot process the requests, the web server is now unavailable.

DDoS (Distributed Denial Of Service) uses botnets around the internet to attack its target. So what is a botnet? A botnet is a PC or even a smartphone that has been infected with malware. Once the malware is installed on the device it becomes part of a botnet network. These botnets are controlled by the attacker from a control and command server on the internet. The attacker can command the botnets to attack a target all at the same time. Examples of attacks used by attackers are Reflection attacks and Amplification attacks. A well-known reflection and amplification attack is using open NTP (Network Time Protocol) servers on the internet that are incorrectly configured and still respond to a monlist request.

ntp

Above is the NTP attack in action. The Attacker will send a request to the Botnets to target the Web Server. The Botnets will send a small request usually Kilobytes in size to the open NTP server(s) requesting a list (monlist) of the last 600 IP addresses that requested time from the NTP server but instead of the botnets receiving the reply the botnets spoof the source IP address to be that of the Web Servers (Reflection) address meaning all replies will go towards the Web Server. The NTP reply can be 10 times the size or more of the initial request (Amplification) meaning Gbps worth of data hitting the Web Server causing it to crash or using up all the available bandwidth. DNS servers can be used in a similar way.

With the explosing of IoT devices available on the internet has seen an increase in DDoS attacks. IoT devices have poor security with many of them having the same default username/password to access the devices. A recent IP CCTV DDoS attack was launched which was 620GBs in size. Thousands of IP CCTV cameras were taken over due to weak passwords and used to attack a website. When setting up IoT devices the manufacturer should force the user to change the default password using a minmum of 8-10 characters which should include uppercase, special characters and numbers which would be a start in stopping attackers from getting access to the IoT devices on the internet.

ARP Poisoning Lab

It has been a couple of weeks if not more since I last posted on my study blog. Life getting in the way as it does. But I hope to get back on track now.

In my last post I talked about ARP Poisoning and how it works as a Man In The Middle attack. So how do you stop this sort of an attack?

Does something called DHCP Spoofing ring a bell? I previously talked about it and how to stop it in the DHCP Spoofing post. So if you need a refresher click on the link and then come back here.

So we can use the DHCP Snooping database to help us also stop ARP poisoning after all the database keeps mappings of IP addresses to MAC addresses and what port they were learnt on. So for this to work you need to already have DHCP Snooping enabled. If you are on a non-DHCP network you can setup ARP ACL lists to do the mappings instead.

To enable ARP Inspection you need to enable it in Global Config mode  and it is done on a per vlan basis.

#config t

#ip arp inspection vlan 123

Just like with DHCP Snooping untrusted ports will DROP any traffic that does not match the IP address to MAC address mapping on that port. And just like with DHCP Snooping you can set ports (Interfaces) to be trusted. If a port is changed to a trust port it will not be subject to inspection and it will allow the traffic to flow. To change a port to a trusted port go into the interface.

#interface fa0/2

#ip arp inspection trust

And that is it.

To finish out you can enable ARP Inspection on Access, Trunk and EtherChannel ports.

ARP Poisoning/Snooping Attack

ARP

First of all a quick review of ARP and what it is used for in networking is a good place to start. ARP stands for Address Resolution Protocol and it is used to map IP addresses to MAC addresses so data can be delivered to the correct host. An IP address on its own can’t do the job. MAC addresses are used to deliver the IP packets on the network. But what happens if a host, for example host A wants to send a packet to host B, host A knows the IP address of host B but does not know what his MAC address is, without this the packet will never get delivered. ARP steps in. To find out the MAC address of host B, host A will send an ARP request with the IP Address of host B asking who has IP Address 10.1.1.1, this is broadcast out onto the network, all hosts will see this messages as it is a broadcast message. However host B will be the only one to respond to the message by sending a unicast message back to host A saying basically I’m host B, in the reply will be host B’s MAC address now host A has all the information it needs to send the packet on its way. The next time that host A or host B needs to send packets to each other they wont have to use ARP they will use their arp cache that is stored locally. The cache stores the IP address to MAC address mappings.

ARP Poisoning

arppoisoning

In the diagram above we have a simply network topology. Local LAN with some PCs and a Router to get off the local network out towards the Internet.

In normal operation the ARP table on the hosts would look like this.

IP ADD                   MAC ADD              PORT

192.168.1.1            AA:AA                    Fa0/0

192.168.1.2           BB:BB                     Fa0/1

192.168.1.254       CC:CC                    Fa0/2

So if PCB wanted to get out onto the internet to the web server it would have Destination IP address of the web server 200.1.1.1 and the MAC address of the default gateway CC:CC it would get this information from its ARP address table shown above.

But if an attacker wanted to launch a Man In The Middle attack to look at the information flowing between the web server and PCB it could use a technique called ARP poisoning. So how does this work. The attacker would spoof the MAC address for PCB and the Default Gateway using Gratuitous ARP by sending out a message saying if you need to get to 192.168.1.2 use AA:AA he would do the same with 192.168.1.254.

IP ADD                   MAC ADD              PORT

192.168.1.1            AA:AA                    Fa0/0

192.168.1.2           AA:AA                     Fa0/1

192.168.1.254       AA:AA                    Fa0/2

Now when PCB wants to communicate with the web server it will look at its ARP cache table and put in the MAC address of PCA in its packet due to the attacker poisoning the ARP tables on the network. PCB wouldn’t be aware that its ARP table was poisoned.

arp

Now the Attacker can sniff all the traffic going to and from the web server. To make sure that PCB does not suspect anything is up the attacker will send on the traffic to the web server after he sniffs it and he will also do the same for the return traffic. This way PCB will never know there is a Man In The Middle attack going on. In my next post I will show you how to mitigate this attack.

Port Security Lab

In a previous post I described what a CAM Table Overflow Attack was and how to mitigate it using port security. So let get straight into it.

Topology I’m using

startPS

Straight forward topology PC-1 and PC-2 are on the same subnet.

PC-1:

  • IP Address 192.168.1.1
  • MAC Address:¬†0060.3E94.1111

PC-2:

  • IP Address: 192.168.1.2
  • MAC Address:¬†0001.C710.2222

I changed the MAC addresses manually in the PC configuration to end with .1111 for PC-1 and .2222 for PC-2 as it makes it easier to know what MAC belongs to what PC.

To stop a CAM Table Overflow Attack from being successful we can and should enable port security on the switch.

First lets look at the MAC address table as it stands on the switch. We can see the MAC addresses from PC-1 and PC-2 and what ports they are connected on.

SP_mac_table

The next step is to configure port security.

Switch(config)#interface range fa0/1 – 2

Switch(config-if-range)#switchport mode access

Switch(config-if-range)#switchport port-security

Switch(config-if-range)#switchport port-security maximum 1

Switch(config-if-range)#switchport port-security violation shutdown

Switch(config-if-range)#switchport port-security mac-address sticky

Switch(config-if-range)#end

port-sec_config

Thats all there is to it. Remember that the port cannot be a dynamic port and you must use the switchport mode command to change the port to an access port.

To verify the configuration use the following show commands (output below).

  • show mac address-table
  • show port-security address
  • show port-security

Note below that instead of the Type being Dynamic it has changed to Static this is because we used the command of mac-address sticky above.

SPshowcommands

To force a violation in Packet Tracker we can go into one of the PCs configuration and change the MAC address of the PC this should cause a psecure violation.

pcmacconfig

I changed PC-1 here so that its MAC address is now ending with .3333 instead of .1111 this should cause the port to shutdown.

portsecviolation

As you can see from the output above the link has changed to down.

Also if you run the same commands from earlier we can see that Fa0/1 has a SecurityViolation count of 1.

If you run the command #show port-security interface fa0/1 we can get more details on the violation.

  • Port Status : Secure – shutdown
  • Last Source Address:Vlan: 0060.3E94.3333:1
  • Security Violation Count: 1

A closer look at the output we can see the port status is shutdown and the last MAC address on the port was from 0060.3E94.3333 and it caused the violation and lastly the count has gone up to 1.

To bring the port back up you have to go into the interface that is down and run:

  • #shutdown
  • #no shutdown

OR

You can use the errdisable command but I can’t show you that as unfortunately Packet Tracer doesn’t support the command. The command will automatically bring the interface back up after X amount of time.

DHCP Snooping Lab

Packet Tracer

Before we get started with this Lab I want to let you know about Packet Tracer. Packet Tracer is a great piece of software from Cisco and I’m running the latest version of it which is version 7.0. It can be limited in some areas but we can run a lot of the labs that are needed for the CCNA level exam with it. For labs that are more complex you can use GNS3 or if you have access to real equipment in your work place you can set up a nice little lab with some real equipment. And then there is¬†of course Rack Rentals if you want to use real equipment but you don’t have the budget to spend on getting second hand gear.

You can download Packet Tracer from https://www.netacad.com/ simply setup a free account and download the version for the operating system you are using, in my case I have it running on a Linux machine.

DHCP Snooping Lab

Objective:

  • Setup a router as a DHCP server
  • Set the default gateway to 192.168.1.1/24
  • Exclude the following IP address range from DHCP: 192.168.1.1 – 192.168.1.10
  • Connect the router to a Switch
  • Connect 3 hosts (PCs) to the Switches and set them up to request IP address via DHCP
  • Configure the switch with DHCP Snooping
  • Configure the interface connected to the router as a Trusted Port.

When you first start Packet Tracer you’ll get the following screen:

PT_Startscreen

On the bottom you have a list of icons for different devices. Here you select the devices and drag them onto the main window.

networkdiagram

This is what the lab should look like.

Lets configure the Router first. Click on the Router and select the CLI tab. Note that I have already configured interface Fa0/0 with the IP address 192.168.1.1 and did a no shutdown on the port to bring it up.

Setting up the router as a DHCP Server:

Router#config t

Router(config)#ip dhcp excluded-address 192.168.1.1 192.168.1.10

Router(config)#ip dhcp pool MRROBOT

Router(dhcp-config)#network 192.168.1.0 255.255.255.0

Router(dhcp-config)#end

Router#

Screenshot-Router1

Now that the Router is setup to hand out IP address from the 192.168.1.0/24 network lets configure the PCs to request IP address from the Router using DHCP.

First click on PC-0 and select the Config tab. Select DHCP (default is Static) now the PC will send a broadcast DHCP Discovery message onto the local LAN to request an IP address.

PC Configuration

Here we can see that the router gave it 192.168.1.11 which is the first IP address it is allowed to give out from its pool. Remember we excluded addresses 192.168.1.1 to 192.168.1.10 in the Router configuration. Repeat this for each PC you have connected to the Switch.

PCipconfig

Next step is to enable DHCP snooping on the switch to stop rogue DHCP servers from successfully operating on the network. Enter the following commands.

Switch#config t

Switch(config)#ip dhcp snooping

Switch(config)#ip dhcp snooping vlan 1

Switch(config)#end

SwtichDHCPSnopp

Lets test to see if this has worked. You might have noticed I haven’t enabled any ports on the Switch yet to be trusted ports. I’ll release the IP address that is on PC-0 and request a new one. It should fail. And what do you know it did.

PCDHCPFail

Lets fix this so that the port connected to the Router on the Switch is a Trusted port which will then allow all DHCP messages through, can you remember what they are? Remember our friend called DORA?

The Router is attached to Fa0/4 on the Switch. Lets make it a trust port.

Switch#config t

Switch(config)#int fa0/4

 

Switch(config-if)#ip dhcp snooping trust

Switch(config-if)#end

SwitchTrustportconf

Time to test it out to see if it was successful.

PCDHCPSucc

I did a ipconfig /release followed by ipconfig /renew and we are back in business. The PC is getting an IP address again via DHCP.

And to finish off the lab some show commands.

  • show ip dhcp snooping bindings
  • show ip dhcp snooping

Switch#show ip dhcp snooping binding

Switch#show ip dhcp snooping

showcommands

These are useful commands to check the bindings of MAC address to IP address and what VLAN and Interface they’re on.

In the second command you can see what Interfaces are Trusted and what are not.

Any questions let me know in the comments.