Port Security
Synchronized Transcript
44 cues indexed • Click dialogue or words to jumpWelcome to Jeremy’s IT Lab. This is a free, complete course for the CCNA. If you like these videos, please subscribe to follow along with the series.
Also, please like and leave a comment, and share the video to help spread this free series of videos. Thanks for your help. If you want more labs like this, I highly recommend Boson Software’s NetSim for CCNA.
NetSim is a network simulator like Packet Tracer, but it’s far more powerful and contains over 100 detailed guided labs covering the CCNA exam topics.
If you want to get NetSim, follow the link in the description. In this video we’ll configure port security on SW1 and SW2. We’ll configure it on SW1’s interfaces connected to the PCs, and on SW2’s G0/1 interface, connected to SW1.
Some of the commands I introduced in the lecture video aren’t supported in packet tracer, but the most important ones are. So, first let’s configure SW1.
On the F0/1, 2, and 3 interfaces we’ll enable port security with the shutdown violation mode, 1 MAC address allowed, sticky learning disabled, and an aging time of 1 hour.
ENABLE. CONF T. The port security configuration of each interface will be the same, so let’s do INTERFACE RANGE F0/1 – 3.
By default, the violation mode is shutdown, and the maximum number of MAC addresses allowed is also 1. Sticky MAC address learning is also disabled by default, so we don’t have to configure any of those.
Let’s just set the aging time to 1 hour. With the default time of 0 minutes, secure MAC addresses will never age out. SWITCHPORT PORT-SECURITY AGING TIME, and then enter the time in minutes, 60.
Now, port security itself isn’t actually enabled yet, so I’ll enable it. SWITCHPORT PORT-SECURITY. But the command is rejected, a common mistake when configuring port security.
These interfaces have the default administrative mode of DYNAMIC AUTO. Let’s check one of them. DO SHOW INTERFACES F0/1 SWITCHPORT.
Up here you can see it, administrative mode dynamic auto. To enable port security, the interface must be manually configured as an access port or trunk port.
So, SWITCHPORT MODE ACCESS. Now let’s try again. SWITCHPORT PORT-SECURITY. Okay, it should be enabled.
I’ll check one of the interfaces. DO SHOW PORT-SECURITY INTERFACE F0/1. Okay, port security is enabled and the default setting of the violation mode is shutdown.
The aging time of 60 minutes I configured is shown here. That’s all we need to configure on SW1. So let’s move on to SW2.
We’ll configure port security on G0/1 with the Restrict violation mode, a maximum of 4 addresses, and sticky MAC address learning enabled.
Why 4 addresses, even though there are only 3 PCs in the network currently? It’s because SW2 will be receiving CDP messages from SW1, so it will learn SW1’s MAC address too.
Okay, let’s configure it. ENABLE. CONF T. INTERFACE G0/1. The default port security violation mode is shutdown, so let’s configure restrict mode.
SWITCHPORT PORT-SECURITY VIOLATION RESTRICT. And then the maximum number of addresses. SWITCHPORT PORT-SECURITY MAXIMUM 4.
And then enable sticky MAC address learning. SWITCHPORT PORT-SECURITY MAC-ADDRESS STICKY. Finally let’s enable port security.
There is only 1 VLAN in the network, VLAN 1, so I’ll just configure G0/1 as an access port, although trunk is an option too. SWITCHPORT MODE ACCESS.
Now I’ll enable port security. SWITCHPORT PORT-SECURITY. Okay, let’s check those settings. DO SHOW PORT-SECURITY INTERFACE G0/1.
Okay, port security is enabled, the violation mode is restrict, and the maximum number of addresses is 4. As for sticky learning, we’ll test that now.
I’ll ping from each PC to R1 so that SW1 and SW2 can learn their MAC addresses. PC1 first.
PING 10.0.0.254. Okay, then PC2.
PING 10.0.0.254. And finally PC3. PING 10.0.0.254.
Okay, now let’s check on SW2. DO SHOW PORT-SECURITY INTERFACE G0/1.
So, the total MAC addresses learned is 4, PCs 1, 2, 3, and SW1. And all 4 of those MAC addresses are sticky.
Let’s check the config of G0/1. DO SHOW RUN. Scroll down to G0/1, and here we can see the MAC addresses of PC1, PC2, PC3, and this one here must be SW1.
And let’s check the MAC address table. DO SHOW MAC ADDRESS-TABLE. Okay, there are the same 4 MAC addresses. Notice the type of STATIC, even though they were dynamically learned.
That’s because of sticky learning. And one more command, DO SHOW PORT-SECURITY. So, G0/1 has a maximum of 4 secure MAC addresses, it currently has learned 4, there are 0 security violations, and the security action
is restrict. Now let’s trigger some violations and see what happens. First, I’ll trigger a violation on SW2. To do that, I’ll go on SW1 and configure the VLAN 1 SVI.
INTERFACE VLAN1. IP ADDRESS 10.0.0.10 255.255.255.0. NO SHUTDOWN.
Okay, so if SW1 tries to ping R1, the source MAC address will be the MAC address of the VLAN 1 SVI. SW2 learned the MAC address of SW1’s G0/1 interface, but it doesn’t know the MAC address of the VLAN 1 SVI.
So let’s try that ping. DO PING 10.0.0.254. Okay, the ping isn’t working. That’s because SW2 is blocking the pings because of the unauthorized source MAC address.
Let’s check on SW2. DO SHOW PORT-SECURITY INTERFACE G0/1. Okay, notice the port status is still secure-up, but the violation counter has been incremented.
There haven’t been any syslog messages, that might be an issue with packet tracer. By default, a syslog message should be displayed in the console.
Anyway, that’s the restrict mode. Now let’s trigger a violation on SW1. To do that, I’ll change the MAC address of PC1.
To do that in packet tracer, go to the config tab of PC1, click on FastEthernet0, and then change the MAC address here.
I’ll change the last ‘1’ to an ‘A’. And let’s try to ping R1. PING 10.0.0.254. Okay, it doesn’t work this time.
Let’s take a look on SW1. Okay, here syslog messages have been shown for the F0/1 interface being shutdown, but no actual port security related syslog messages.
Anyway, let’s check the interface. DO SHOW PORT-SECURITY INTERFACE F0/1. Okay, the state is secure-shutdown, and the security violation count is 1.
Now, errdisable recovery isn’t available in packet tracer so if you want to re-enable the interface, you’ll need to do it manually. Anyway, in this lab we did some basic port security configurations and observed how the shutdown and restrict violation modes work.
That’s all for this lab. Next, let’s take a look at a bonus lab in Boson Software’s NetSim for CCNA.