Showing posts with label LearnByDoing. Show all posts
Showing posts with label LearnByDoing. Show all posts

Friday, March 18, 2016

Learning By Doing: Challenges

Main Page | CCNA Exercises | CCNP Labs

UP To The Challenge?


Let's begin then!
  1. Calculating Subnets.
  2. Analyze TCP Header During Transmission.
  3. Installing Packet Tracer.
  4. Cisco Router and Switch Initial Configuration with Packet Tracer.
  5. CDP: Building Topology Diagram.
  6. Lab 1-1: Switch Startup and Initial Configuration.
  7. Lab 1-2: Troubleshooting Switch Media Issues.
  8. Lab 2-1: Router startup and Initial Configuration.
  9. Lab 2-2: Internet connections - Static NAT.
  10. Lab 2-2: Dynamic NAT.
  11. Lab 2-2: Port Address Translation (PAT).
  12. Lab 3-1: Improving Device Security.
  13. Lab 3-2: Device Hardening. 
  14. Lab 3-3: Using ACLs to filter IP based traffic. 


Lab 3-3: Using ACLs to filter IP based traffic

Previous Lab | Exercises | Next Lab



Lab pre-requisites:

Lab 2-1 Packet Tracer Topology Download.

Topology Diagram


This is continuation of the previous lab related to basic security.
  
Task 1: Configuring an ACL (Access Control List).


In this exercise assumptions have been made:

PC1 (IP Address: 10.1.1.100/24) is allowed to to access Server (172.16.1.100) using any protocol.

PC2 (IP Address: 10.1.1.101/24) CANNOT use telnet Server. All other traffic is allowed.

There are few ways of constructing ACL. Here's one of them:

Step 1
Configure ACL statements:



Branch#conf t

Enter configuration commands, one per line. End with CNTL/Z.

Branch(config)#access-list 100 deny tcp host 10.1.1.101 host 172.16.1.100 eq telnet

Branch(config)#access-list 100 permit ip any any

Branch(config)#

Step 2
Apply the ACL on Fas0/0 interface blocking incoming packets.

Branch(config)#int f0/0

Branch(config-if)#ip access-group 100 in

Branch(config-if)#

Branch#show access-list 100
Extended IP access list 100
deny tcp host 10.1.1.101 host 172.16.1.100 eq telnet
permit ip any any
Branch#

Notice
Packet Tracer does not provide us with index number next the ACL statements (on real equipment they are present and can be used to remove statements using 'named' acl syntax. 

Notice
Packet Tracer does not have 'show ip int f0/0' command implemented properly. This command normally displays whether incoming and/or outgoing ACL is applied on the interface.
  
Notice
Packet Tracer is somewhat limited here. We cannot enable http server (ip http server) on HQ router in order to properly test the ACL.


Also 'named' ACLs are not working in the version of Packet Tracer I am using. This does not allow me to show you how to re-sequence statements, remove statements, and squeeze statements between other ones.

Verification:

Notice
I have tested ACL using PC2 and telnet is NOT being blocked as expected. This proves that version of Packet Tracer I use is NOT working properly.

 


Previous Lab | Exercises | Next Lab

Wednesday, March 16, 2016

Lab 3-2 Device Hardening




Lab pre-requisites:

Lab 2-1 Packet Tracer Topology Download.

Topology Diagram


This is continuation of the previous lab related to basic security.
  
Task 1: Managing unused ports on a Switch.
Task 2: Using Switchport port-security.
Task 3: Disable unused services.

Since all the switch ports are 'up' by default, this means that creating any connection to a port (connecting a device to a port), will cause the port to go up. This can create a problem for an administrator, as the users have access to the access switch ports through sockets in a wall or a floor. It is in the best interest of administrator to control who can plug new devices into the network. 

Task 1: Managing unused ports on a Switch.

As an example let's disable the following ports on SW1:
Fas0/2, Fas0/4-12, Fas0/14-24.

In order to do it in 'one shot' we are going to use the range command. It allows us to access the range of ports. If ports are contiguous, the range command uses a hyphen as separator, if not a comma is used as shown below:

SW1(config)#interface range fas0/2,fas0/4-12,fas0/14-24

SW1(config-if-range)#description UNUSED

SW1(config-if-range)#shutdown

I have thrown in the 'description', just to make sure that the ports are disabled for a reason.

Verification in Packet Tracer would be to type in:

SW1#show run

Notice
If you are using a real equipment I suggest that you used the following command:

SW1#show interface status | include disabled

This will display all the ports you have disabled filtering the ones that have not been disabled.

Task 2: Using Switchport port-security.

Now, let's fool around with port security. Suppose we want to ensure that port fas0/13 currently servicing our Branch router (fas0/0), will only allow its mac address as the source mac address. Port security can be applied.

Try to remember the few things realated to port security:
  • In order to enable port security, 'switchport mode access' is required on the port as by default all ports are running 'dynamic' mode (Dynamic Trunking Protocol). Only ports in truly 'access mode' can be enabled for port security by default.
  • If you apply port-security the following security template will be applied: (only 1 mac address can be serviced on the port, the first mac address learned becomes the secure one, this mac address is NOT copied to the port configuration, the violation action is shutdown.
 More information on the options in another post.

Let's configure the following on the port fas0/13 (connection to Branch):
  • Only 1 mac address allowed (Branch fas0/0)
  • Upon violation: shutdown the port (err-disable)
SW1(config)#int f0/13
SW1(config-if)#switchport mode access

SW1(config-if)#switchport port-security

SW1(config-if)#


Verification:

       
Based on the test we can say the following:

Port fas0/13 is currently in secure mode (Secure Port).

Only 1 mac address is allowed (MaxSecureAddr Count).

The first learned mac address has become secure (CurrentAddr Count).

There was no violation reported (SecurityViolation Count).

If there is transmission hitting the port fas0/13 with the illegitimate mac address, the port is going to be 'shutdown' (put in error-disable state).

Another way of checking this:



Notice
If the port is err-disabled, there are only two ways to bring it up:
  1. Disable the port (shutdown), and re-enable manually (no shutdown).
  2. Use errordisable recovery (not taught in CCNA courses).
Display the current secure mac address:



Notice
Packet Tracer does not have this feature fully implemented (it does not behave like it would on a real switch).

In case you have a real equipment, you can do the following:

Configure Branch fas0/0 with a new mac:

Branch(config)#int f0/0

Branch(config-if)#mac-address 0008.eeee.eeee

Branch(config-if)#


In a few seconds, the router Branch will send 'gratuitous arp' message. Its source mac-address changed and will cause the violation.


The port of the SW1 (fas0/13) will go 'down' and be placed in error-disabled mode. 


You could then check this by issuing one of the two commands:


SW1#show interface status | i err

or

SW1#show int fas0/13

Also, SW1 shows the message that causes the violation etc.

Task 3: Disable unused services.

The last task relates to disabling certain services that might create security problem for us.

If you want to disable CDP protocol, you can do this on all interfaces of a switch/router at the same time:

SW1#conf t
SW1(config)#no cdp run

or on per interface basis:

SW1#conf t
SW1(config)#interface fas0/1
SW1(config-if)#no cdp enable

Verification:

SW1#show cdp interface

You will see that Fas0/1 is no listed anymore.

Notice
The below commands are NOT supported in Packet Tracer
On some routers (especially older ones), check the following command for open ports:
show control-plane host open-ports

You might see that HTTP port is open (port 80). Then best practice is to disable it:

Branch#conf t
Branch(config)#no ip http server

Also, a good practice would be to disable the following services (enabled by default on older routers):

Branch(config)#no service tcp-small-servers
Branch(config)#no service udp-small-servers
Branch(config)#no service finger
Branch(config)#no ip bootp server

If you want to learn more on those all sevices check Cisco documentation.



Monday, January 18, 2016

Lab 2-2 Dynamic NAT




Lab pre-requisites:

Lab 2-1 Packet Tracer Topology Download.

Topology Diagram


Connecting a LAN to the Internet requires a little thought as there are few ways of doing it. Here we are going to explore three of them:
  • Static NAT (one-to-one translation)
  • Dynamic NAT (many-to-many translation)
  • Dynamic NAT Overload or PAT (many-to-one translation)

Task 1: Defining static IP addresses and setting a static default route.
Task 2: Configure NAT.
Task 3: Configure PAT.

Dynamic NAT
Solution

Since in our previous lab exercise we used DHCP to assign IP Address to our Branch router, this time around let's try to do it manually (I should've done this in previous task; ups).

We begin by removing NAT line from our configuration on Branch

On Branch Router:

Branch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Branch(config)#no ip nat inside source static 10.1.1.100 209.165.201.10

Branch(config)#

We leave the following though:

interface FastEthernet0/0
 ip nat inside
!
interface FastEthernet0/1
 ip nat outside
!

They will be used in all flavors of NAT we configure here.

Now we need to configure the following steps to complete the lab:

  • IP Address assigned manually (default router will have to be added manually too).
  • Pool of public IP Addresses will need to be added (we'll use 209.165.201.3 - 209.165.201.10 /27).
  • Access Control List will need to be added to match on source IP addresses (subnet 10.1.1.0).
  • Dynamic NAT configuration.
And this is where the rubber meets the road.

Assign IP Address Manually

Branch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Branch(config)#int f0/1
Branch(config-if)#ip address 209.165.201.1 255.255.255.224
Branch(config-if)#exit

Default Route Configuration

Branch(config)#ip route 0.0.0.0 0.0.0.0 209.165.201.2

Branch(config)#


Configuring Pool of Public Addresses (inside global)

Branch(config)#ip nat pool PUBLIC 209.165.201.3 209.165.201.10 netmask 255.255.255.224
Branch(config)#



NOTICE!
Packet tracer only supports 'netmask' argument. It does NOT support 'prefix-length number'.


Access Control List Configuration

Branch(config)#access-list 1 permit 10.1.1.0 0.0.0.255
Branch(config)#

Dynamic NAT Configuration

Branch(config)#ip nat inside source list 1 pool PUBLIC
Branch(config)#


NOTICE!
IOS is case sensitive when it comes to defining name and using them ('PUBLIC' is not the same as 'public').



At this point there are NO NAT entries built in the NAT table. However, if we send the ping packet from PC1 towards 209.165.201.2, the entry is going to be created.




NOTICE!
Packet Tracer emulates real life behavior. First ping attempt lost two packets on ARP request. 



Don't forget that ICMP protocol ages out very quickly (1 min.). So after pinging, try to look at the table as quickly as possible.

This type of NAT lends IP Address dynamically as soon as an interesting traffic matched in ACL is sent towards the Internet (out of 'ip nat outside' interface).

In case you want multiple hosts to borrow the same address you can either add the keyword 'overload' in as the last word in the NAT configuration:

ip na inside source list 1 pool PUBLIC overload

or use Port Address Translation (PAT), which will be used in our next exercise.

Meanwhile this is the whole configuration we have done:

interface FastEthernet0/0
 ip address 10.1.1.1 255.255.255.0
 ip nat inside
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 209.165.201.1 255.255.255.224
 ip nat outside
 duplex auto
 speed auto
!
ip nat pool PUBLIC 209.165.201.3 209.165.201.10 netmask 255.255.255.224
!
ip nat inside source list 1 pool PUBLIC
!
ip route 0.0.0.0 0.0.0.0 209.165.201.2 

!

Cisco Is Easy - Main

  Cisco Basics (CCNA level)  Lessons: Watch Video Tutorials on Youtube 01 - Connecting to Cisco Console Port with MINICOM 02 - Navigatin...