Welcome to the CCNA Cybersecurity Scenarios repository, a comprehensive resource for students, networking enthusiasts, and professionals aiming to strengthen their cybersecurity skills at the CCNA level. This repository features lab scenarios, configuration examples, and troubleshooting exercises focused on securing network infrastructures. More advanced scenarios such as VPN and Firewalls would be in the advanced CCNA and CCNP security repository.
Key concepts include:
- Network security fundamentals
- Access control lists (ACLs)
- NAT and PAT configurations
- Configuring Network Management Services
- Secure router and switch configurations
Labs are designed to be compatible with Cisco Packet Tracer, GNS3, or EVE-NG, with detailed instructions for setup and execution.
This repository may contain IP addresses, usernames, and passwords used for lab scenarios. Handle this information responsibly and ensure it is used strictly for educational purposes.
This guide covers how to configure and verify network security using Access Control Lists (ACLs) on Cisco devices. You'll set up a basic network topology, configure routing, and apply both standard and extended ACLs to control traffic and enhance security.
Start by creating the network topology and ensuring all devices are initialized correctly.
1.2 Initialize Devices
- Assign hostnames to devices for easy identification.
- Set passwords for console, VTY, and enable modes to secure access.
- Configure basic IP settings on routers, switches, and PCs.
-
Configure Basic Settings
- Assign IP addresses to interfaces on routers and PCs.
- Enable interfaces using the
no shutdown
command. - Set up basic routing information and hostnames.
-
Configure OSPF Routing
- Enable OSPF on routers (R1, ISP, R3):
configure terminal router ospf 1 network <network_address> <wildcard_mask> area 0
- Verify OSPF neighbors with:
show ip ospf neighbor
- Enable OSPF on routers (R1, ISP, R3):
-
Verify Connectivity
- Test connectivity using:
ping <destination_ip> traceroute <destination_ip>
- Test connectivity using:
-
Configure a Numbered Standard ACL
- Create and apply a basic ACL to permit or deny traffic:
access-list 10 permit 192.168.1.0 0.0.0.255 interface <interface_name> ip access-group 10 in
- Create and apply a basic ACL to permit or deny traffic:
-
Configure a Named Standard ACL
- Use named ACLs for better readability:
ip access-list standard ALLOWED_DEVICES permit 192.168.2.0 0.0.0.255 interface <interface_name> ip access-group ALLOWED_DEVICES in
- Use named ACLs for better readability:
-
Verify ACLs
- Confirm ACLs are applied and functioning as intended:
show access-lists show ip interface <interface_name>
- Confirm ACLs are applied and functioning as intended:
-
Configure a Numbered Extended ACL
- Apply advanced filtering based on protocols and ports:
access-list 100 permit tcp 192.168.1.0 0.0.0.255 any eq 80 interface <interface_name> ip access-group 100 in
- Apply advanced filtering based on protocols and ports:
-
Configure a Named Extended ACL
- Create a descriptive and flexible ACL:
ip access-list extended WEB_ACCESS permit tcp 192.168.2.0 0.0.0.255 any eq 443 interface <interface_name> ip access-group WEB_ACCESS in
- Create a descriptive and flexible ACL:
-
Verify Extended ACLs
- Ensure ACLs are functioning correctly:
show access-lists show running-config
- Ensure ACLs are functioning correctly:
-
Modify an Existing ACL
- Adjust ACLs as needed using sequence numbers:
ip access-list extended WEB_ACCESS no 10 10 permit tcp 192.168.2.0 0.0.0.255 any eq 8080
- Adjust ACLs as needed using sequence numbers:
-
Verify the Modified ACLs
- Check the updated ACL to ensure proper filtering:
show access-lists
- Check the updated ACL to ensure proper filtering:
Access Control Lists (ACLs) are critical for enhancing network security. They allow administrators to control traffic based on IP addresses, protocols, and port numbers, reducing the attack surface and limiting unauthorized access. Proper ACL configuration helps ensure that only legitimate traffic flows through the network, strengthening overall security posture.
This guide focuses on configuring Network Address Translation (NAT) on Cisco devices. It covers building the network, configuring both Static and Dynamic NAT, and verifying proper connectivity and address translation.
##Part 1: Build the Network and Verify Connectivity
-
Basic Device Configuration
- Set hostnames, passwords, and IP addressing.
- Enable interfaces with the
no shutdown
command.
-
Verify Initial Connectivity
- Confirm end-to-end connectivity between internal and external devices:
ping <destination_ip> traceroute <destination_ip>
- Confirm end-to-end connectivity between internal and external devices:
-
Configure Static NAT
- Map a specific private IP address to a public IP address:
ip nat inside source static <private_ip> <public_ip>
- Identify NAT interfaces:
interface <inside_interface> ip nat inside interface <outside_interface> ip nat outside
- Map a specific private IP address to a public IP address:
-
Verify Static NAT Configuration
- Test connectivity from an external device to the internal server using the public IP.
- Use the following command to verify NAT translation:
show ip nat translations
- Check the NAT statistics for any issues:
show ip nat statistics
-
Define a NAT Pool
- Create a pool of public IP addresses for dynamic translation:
ip nat pool NAT_POOL <start_ip> <end_ip> netmask <subnet_mask>
- Create a pool of public IP addresses for dynamic translation:
-
Create an Access Control List (ACL)
- Define which internal addresses are eligible for NAT translation:
access-list 1 permit 192.168.1.0 0.0.0.255
- Define which internal addresses are eligible for NAT translation:
-
Configure Dynamic NAT
- Link the ACL with the NAT pool:
ip nat inside source list 1 pool NAT_POOL
- Set interfaces for NAT as in the Static NAT section.
- Link the ACL with the NAT pool:
-
Verify Dynamic NAT Configuration
- Test connectivity from internal devices to an external network.
- Check NAT translations and statistics:
show ip nat translations show ip nat statistics
Network Address Translation (NAT) is essential for allowing multiple devices in a private network to access external networks (like the internet) using limited public IP addresses. NAT enhances security by masking internal IPs and helps in conserving IPv4 address space.
This guide focuses on configuring NAT Pool Overload and Port Address Translation (PAT) on Cisco devices. These techniques enable multiple internal devices to share a single public IP address, ensuring efficient IP address utilization and secure connectivity.
Same as the NAT scenario setup.
-
Define a NAT Pool
- Create a pool of public IP addresses:
ip nat pool OVERLOAD_POOL <start_ip> <end_ip> netmask <subnet_mask>
- Create a pool of public IP addresses:
-
Create an Access Control List (ACL)
- Specify the internal network to be translated:
access-list 1 permit 192.168.1.0 0.0.0.255
- Specify the internal network to be translated:
-
Configure NAT Pool Overload
- Link the ACL with the NAT pool and enable overload:
ip nat inside source list 1 pool OVERLOAD_POOL overload
- Link the ACL with the NAT pool and enable overload:
-
Set NAT Interfaces
- Define the inside and outside interfaces:
interface <inside_interface> ip nat inside interface <outside_interface> ip nat outside
- Define the inside and outside interfaces:
-
Verify NAT Pool Overload
- Test connectivity from internal devices to an external network.
- View NAT translations and statistics:
show ip nat translations show ip nat statistics
-
Configure PAT Using Interface Overload
- Instead of a pool, use the router's external interface IP for PAT:
ip nat inside source list 1 interface <outside_interface> overload
- Instead of a pool, use the router's external interface IP for PAT:
-
Verify PAT Configuration
- Test by initiating connections from multiple internal devices.
- Use these commands to confirm active translations and overload status:
show ip nat translations show ip nat statistics
- NAT Pool Overload enables multiple internal devices to share a limited pool of public IPs efficiently.
- PAT (Port Address Translation) allows numerous internal hosts to share a single public IP address by distinguishing sessions using port numbers.
- These methods conserve IPv4 addresses, enhance security by masking internal IPs, and ensure seamless external connectivity.
This guide focuses on network discovery protocols and time synchronization on Cisco devices. It includes configuring and verifying Cisco Discovery Protocol (CDP), Link Layer Discovery Protocol (LLDP), and Network Time Protocol (NTP) to ensure efficient network management and accurate device timekeeping.
Basic Device Configuration
- Configure hostnames, IP addresses, and enable interfaces.
- Ensure all devices can communicate by performing basic connectivity tests:
ping <destination_ip> traceroute <destination_ip>
-
Verify CDP Status
- CDP is enabled by default on Cisco devices. Verify with:
show cdp show cdp neighbors
- CDP is enabled by default on Cisco devices. Verify with:
-
Enable or Disable CDP
- Enable CDP globally and on interfaces (if disabled):
cdp run interface <interface_name> cdp enable
- To disable CDP on an interface (for security purposes):
no cdp enable
- Enable CDP globally and on interfaces (if disabled):
-
View Detailed Neighbor Information
- Get detailed information about connected neighbors:
show cdp neighbors detail
- Get detailed information about connected neighbors:
-
Enable LLDP
- Unlike CDP, LLDP is disabled by default. Enable it globally:
lldp run
- Enable LLDP on specific interfaces:
interface <interface_name> lldp transmit lldp receive
- Unlike CDP, LLDP is disabled by default. Enable it globally:
-
Verify LLDP Status
- Display LLDP neighbor information:
show lldp neighbors show lldp neighbors detail
- Display LLDP neighbor information:
-
Disable LLDP (Optional)
- If needed, disable LLDP globally or on specific interfaces:
no lldp run interface <interface_name> no lldp transmit no lldp receive
- If needed, disable LLDP globally or on specific interfaces:
-
Configure an NTP Server
- Set the device to synchronize with an external NTP server:
ntp server <ntp_server_ip>
- Set the device to synchronize with an external NTP server:
-
Configure NTP Authentication (Optional)
- For secure NTP configuration:
ntp authenticate ntp authentication-key 1 md5 <key_value> ntp trusted-key 1 ntp server <ntp_server_ip> key 1
- For secure NTP configuration:
-
Verify NTP Synchronization
- Check synchronization status:
show ntp associations show ntp status
- Display the current time:
show clock
- Check synchronization status:
- CDP (Cisco Discovery Protocol): Allows devices to discover directly connected Cisco devices, aiding in network topology mapping and troubleshooting.
- LLDP (Link Layer Discovery Protocol): An open standard for device discovery, useful in multi-vendor environments.
- NTP (Network Time Protocol): Ensures accurate timekeeping across network devices, which is essential for log accuracy, security protocols, and system operations.
This guide covers the essential steps to secure Layer 2 switches in a network. It includes configuring basic switch settings, enabling SSH access, securing trunk and access ports, and implementing DHCP snooping for enhanced network security.
-
Set the Hostnames
configure terminal hostname S1
-
Configure the Management Interface
- Assign an IP address to the VLAN interface for remote management:
interface vlan 1 ip address 192.168.1.2 255.255.255.0 no shutdown exit
-
Configure Console and VTY Access Passwords
line console 0 password cisco login exit line vty 0 4 password cisco login transport input ssh exit
-
Encrypt Passwords
service password-encryption
-
Set an Enable Secret Password
enable secret cisco
-
Set Domain Name and Generate RSA Keys
ip domain-name example.com crypto key generate rsa modulus 1024
-
Configure SSH Version 2
ip ssh version 2
-
Create a Local User for SSH Access
username admin privilege 15 secret cisco
-
Restrict VTY Access to SSH Only
line vty 0 4 login local transport input ssh exit
-
Verify SSH Configuration
- Use the following commands to confirm SSH is active:
show ip ssh show ssh
- Use the following commands to confirm SSH is active:
-
Test SSH Access
- From an SSH client or terminal, attempt to connect:
ssh -l admin 192.168.1.2
- From an SSH client or terminal, attempt to connect:
-
Configure Trunk Port Mode
interface fastEthernet 0/1 switchport mode trunk
-
Change the Native VLAN for Trunks
switchport trunk native vlan 99
-
Verify Trunk Configuration
show interfaces trunk
-
Enable Storm Control for Broadcasts
storm-control broadcast level 10.00
-
Configure Access Ports
interface range gigabitEthernet 0/2-24 switchport mode access switchport access vlan 10
-
Enable PortFast and BPDU Guard
spanning-tree portfast spanning-tree bpduguard enable
Why Enable BPDU Guard?
- BPDUs (Bridge Protocol Data Units) are used in Spanning Tree Protocol (STP) to prevent loops.
- If a rogue switch is connected, it could send malicious BPDUs and compromise network stability.
- BPDU Guard ensures that if any BPDU is received on a PortFast-enabled port, the port will be automatically disabled, protecting the network.
-
Verify BPDU Guard
show spanning-tree interface detail
-
Enable Root Guard
spanning-tree guard root
-
Enable Loop Guard
spanning-tree guard loop
-
Configure and Verify Port Security
switchport port-security
switchport port-security maximum 2
switchport port-security violation restrict
switchport port-security mac-address sticky
show port-security interface <interface>
- Disable Unused Ports
interface range gigabitEthernet 0/25-48
shutdown
- Move Ports from VLAN 1 to an Alternate VLAN
switchport access vlan 99
- Configure PVLAN Edge (Private VLAN Edge)
switchport protected
-
Configure DHCP on R1
ip dhcp pool name network 192.168.10.0 255.255.255.0 default-router 192.168.1.1 dns-server 8.8.8.8
-
Configure Inter-VLAN Routing on R1
interface gigabitEthernet 0/1.10 encapsulation dot1Q 10 ip address 192.168.10.1 255.255.255.0
-
Configure Trunk on S1
interface fastEthernet 0/5 switchport mode trunk
-
Enable DHCP Snooping
ip dhcp snooping ip dhcp snooping vlan 10,20 interface fastEthernet 0/5 ip dhcp snooping trust
Why Enable DHCP Snooping?
- DHCP Snooping helps prevent rogue DHCP servers from assigning incorrect IP addresses.
- It ensures that only trusted ports can offer DHCP services, enhancing network security.
-
Verify DHCP Snooping
show ip dhcp snooping show ip dhcp snooping binding
Securing Layer 2 switches is essential to prevent vulnerabilities and attacks in a network. Key elements include configuring basic switch settings to ensure proper initialization, enabling SSH access for secure management, securing trunk and access ports to prevent unauthorized connections and attacks like VLAN hopping, and implementing DHCP snooping to block rogue DHCP servers from disrupting network services. These steps help protect the network from common security threats and ensure that only authorized devices and traffic can access critical resources
This guide provides a comprehensive, step-by-step configuration for securing routers, ensuring both connectivity and enhanced security measures are implemented effectively.
R1(config)# interface g0/1
R1(config-if)# ip address 192.168.1.1 255.255.255.0
R1(config-if)# no shutdown
R1(config)# interface s0/0/0
R1(config-if)# ip address 10.1.1.1 255.255.255.252
R1(config-if)# clock rate 64000
R1(config-if)# no shutdown
R2(config)# interface s0/0/0
R2(config-if)# ip address 10.1.1.2 255.255.255.252
R2(config-if)# no shutdown
R2(config)# interface s0/0/1
R2(config-if)# ip address 10.2.2.2 255.255.255.252
R2(config-if)# clock rate 64000
R2(config-if)# no shutdown
R3(config)# interface g0/1
R3(config-if)# ip address 192.168.3.1 255.255.255.0
R3(config-if)# no shutdown
R3(config)# interface s0/0/1
R3(config-if)# ip address 10.2.2.1 255.255.255.252
R3(config-if)# no shutdown
R1(config)# router ospf 1
R1(config-router)# network 192.168.1.0 0.0.0.255 area 0
R1(config-router)# network 10.1.1.0 0.0.0.3 area 0
R2(config)# router ospf 1
R2(config-router)# network 10.1.1.0 0.0.0.3 area 0
R2(config-router)# network 10.2.2.0 0.0.0.3 area 0
R3(config)# router ospf 1
R3(config-router)# network 192.168.3.0 0.0.0.255 area 0
R3(config-router)# network 10.2.2.0 0.0.0.3 area 0
- Set IP, subnet mask, and gateway on PCs
ping 192.168.3.3
traceroute 192.168.3.3
R1(config)# enable secret cisco12345
R1(config)# service password-encryption
R1(config)# security passwords min-length 10
R1(config)# banner motd # Unauthorized Access Prohibited #
R1(config)# hostname R1
R1(config)# ip domain-name example.com
R1(config)# crypto key generate rsa modulus 2048
R1(config)# username admin secret Adm!n1234
R1(config)# line vty 0 4
R1(config-line)# transport input ssh
R1(config-line)# login local
R1(config)# ip scp server enable
R1(config)# aaa new-model
R1(config)# aaa authentication login default local
R1(config)# aaa authorization exec default local
- AAA (Authentication, Authorization, and Accounting) manages user access and activities. Authentication verifies identity, Authorization defines user permissions, and Accounting tracks actions. This configuration enables local authentication, authorization, and activity logging.
R1(config)# parser view AdminView
R1(config-view)# secret admin123
R1(config-view)# commands exec include all
R1(config)# parser view UserView
R1(config-view)# secret user123
R1(config-view)# commands exec include show
- Views in Cisco devices allow defining user roles and command access. AdminView grants full access, while UserView limits access to show commands. This setup enhances security by restricting command usage based on roles.
R1(config)# snmp-server group SNMPv3Group v3 priv
R1(config)# snmp-server user SNMPUser SNMPv3Group v3 auth sha authpass priv aes 128 privpass
R1(config)# snmp-server host 192.168.3.1 version 3 priv SNMPUser
- SNMPv3 user has access to all interfaces for monitoring purposes.
To ensure SNMP access is limited to R1's LAN (192.168.1.0/24), configure an access control list (ACL) to permit SNMP packets only from this network:
R1(config)# ip access-list standard PERMIT-SNMP R1(config-std-nacl)# permit 192.168.1.0 0.0.0.255 R1(config-std-nacl)# exit This ACL allows SNMP traffic only from the LAN network 192.168.1.0/24, securing access to SNMP data.
1- Configure NTP with Authentication:
On R2 (NTP Master Configuration):
First, configure NTP authentication on R2 by defining the authentication key, hashing type, and password. The password is case-sensitive.
R2(config)# ntp authentication-key 1 md5 NTPpassword
Then, configure the trusted key on R2, which will be used for authentication:
R2(config)# ntp trusted-key 1
Enable the NTP authentication feature:
R2(config)# ntp authenticate
Configure R2 as the NTP master with a stratum number of 3. The stratum number indicates the distance from the original time source. For this lab, we use stratum 3 on R2:
R2(config)# ntp master 3
On R1 and R3 (NTP Clients Configuration):
For both R1 and R3, configure NTP authentication using the same authentication key and password as on R2:
R1(config)# ntp authentication-key 1 md5 NTPpassword
R3(config)# ntp authentication-key 1 md5 NTPpassword
Configure the trusted key on R1 and R3 to ensure they only trust the time source from R2:
R1(config)# ntp trusted-key 1
R3(config)# ntp trusted-key 1
Enable the NTP authentication feature on both devices:
R1(config)# ntp authenticate
R3(config)# ntp authenticate
Then, configure R1 and R3 as NTP clients of R2, and enable calendar synchronization using the ntp update-calendar
command:
R1(config)# ntp server 10.1.1.2
R1(config)# ntp update-calendar
R3(config)# ntp server 10.1.1.2
R3(config)# ntp update-calendar
- R1 and R3 will now sync their time with R2, using NTP authentication for secure time synchronization.
---
This update provides the full NTP authentication configuration for R1, R2, and R3, ensuring secure synchronization of time across devices.
### Step 3: Syslog Setup
R1(config)# logging 192.168.1.3
- Ensure the syslog server is configured to receive and store logs effectively.
---
## Part 5: Securing the Control Plane
In this part of the lab, you will configure OSPF routing protocol authentication using SHA256 to ensure the integrity and authenticity of OSPF messages. Additionally, you will verify that OSPF authentication is functioning correctly.
### Task 1: Configure OSPF Routing Protocol Authentication using SHA256 Hashing
**Step 1: Configure a key chain on all three routers.**
a. **Assign a key chain name and number:**
On each router (R1, R2, and R3), configure the key chain with a name (`NetAcad`) and key number (`1`):
```bash
R1(config)# key chain NetAcad
R1(config-keychain)# key 1
b. Assign the authentication key string:
Set the key string to be used for OSPF authentication (ensure it is the same on all routers):
R1(config-keychain-key)# key-string CCNASkeystring
c. Configure the encryption algorithm to be used for authentication:
To use SHA256 encryption for OSPF authentication, configure the cryptographic algorithm:
R1(config-keychain-key)# cryptographic-algorithm hmac-sha-256
Step 2: Configure the serial interfaces to use OSPF authentication.
a. Assign the key-chain to the serial interfaces:
Now configure the OSPF authentication for the serial interfaces on R1 and R3 by using the ip ospf authentication
command to assign the key chain:
R1(config)# interface s0/0/0
R1(config-if)# ip ospf authentication message-digest
R1(config-if)# ip ospf message-digest-key 1 md5 CCNASkeystring
Repeat the same configuration for R3:
R3(config)# interface s0/0/1
R3(config-if)# ip ospf authentication message-digest
R3(config-if)# ip ospf message-digest-key 1 md5 CCNASkeystring
b. Verify OSPF Authentication:
After configuring the authentication, verify that OSPF is using the configured authentication by checking the OSPF neighbors:
R1# show ip ospf neighbor
You should see that the OSPF neighbors are authenticated, confirming that the SHA256 OSPF authentication is working correctly.
R1(config-router)# area 0 authentication message-digest
R1(config-if)# ip ospf message-digest-key 1 sha256 OSPFpass
- Using SHA256 ensures stronger OSPF authentication, enhancing security.
R1# auto secure
show running-config
Securing administrative access to routers is crucial to protect network infrastructure from unauthorized access and potential attacks. By implementing strong authentication, encryption, and access control mechanisms, we ensure that only authorized personnel can configure or manage the device. This minimizes the risk of malicious configurations, data breaches, or downtime caused by unauthorized changes. Methods such as password encryption, SSH for secure remote access, and the use of role-based views help protect sensitive network devices and maintain the integrity of the network.