Solved

Cisco host permit and deny a range of addresses

Posted on 2009-05-06
6
855 Views
Last Modified: 2012-05-06
I am using a cisco router.  I want to restrict the use of ssh to only an internal 172.16.x.x set of addresses and block any other address from using using port 22.

I am using the following and including the subnet mask to indicate that I want to use the entire class b range.  

First, do I need to include the subnet mask?
Second, if so, what is the proper format?

access-list 123 permit tcp any host 172.16.0.0 255.255.0.0 eq 22
access-list 123 deny   tcp any any eq 22
access-list 123 permit ip any any
0
Comment
Question by:c3ne
  • 3
6 Comments
 
LVL 3

Expert Comment

by:keno44
Comment Utility
You use a filter, not the subnet mask. use 0.0.255.255 for this example.
0
 
LVL 3

Expert Comment

by:keno44
Comment Utility
Sorry, to be more clear. It's not generally referred to as a 'filter', this is a 'wildcard masking'.

so it should read

access-list 123 permit tcp any host 172.16.0.0 0.0.255.255 eq 22
0
 

Author Comment

by:c3ne
Comment Utility
I get an invalid input response using either the mask or the filter with the market at the beginning of the filter.

router(config)#$ 123 permit tcp any host 172.16.0.0 0.0.255.255 eq 22
access-list 123 permit tcp any host 172.16.0.0 0.0.255.255 eq 22
                                                                           ^
% Invalid input detected at '^' marker.
0
 
LVL 3

Accepted Solution

by:
keno44 earned 125 total points
Comment Utility
Take the word host out of the statement. Sorry, I didnt catch that earlier!!
0
 
LVL 8

Assisted Solution

by:akalbfell
akalbfell earned 125 total points
Comment Utility
use the tab it will help you as you type in commands as far as what you need next.
there is an easier way to limit access to the device so its only through SSH and not Telnet..

enter these commands, this will take care of the access list also..

conf t
ip access-list extended SSH_ACCESS
  permit ip 172.16.0.0 0.0.255.255 any
<type exit to get out of NACL mode>
line vty 0 4
transport input ssh
access-class SSH_ACCESS in

soon as you put the access list command in and the SSH thats it so make sure you are sure its right...a good little trick is before you do anything with the access lists type reload in 5, if it asks you to confirm the reload hit yes and then the timer starts...that will give you 5 minutes after which if you dont cancel it the router will reboot. so say you lock yourself out with an access list just wait 5 minutes and it will reboot and load the last saved config....just make sure if you do everything right to do a reload cancel to cancel it...you can change the 5 to any number of minutes you want


0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

The Cisco RV042 router is a popular small network interfacing device that is often used as an internet gateway. Network administrators need to get at the management interface to make settings, change passwords, etc. This access is generally done usi…
Creating an OSPF network that automatically (dynamically) reroutes network traffic over other connections to prevent network downtime.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now