[Webinar] Streamline your web hosting managementRegister Today


Cisco host permit and deny a range of addresses

Posted on 2009-05-06
Medium Priority
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 eq 22
access-list 123 deny   tcp any any eq 22
access-list 123 permit ip any any
Question by:c3ne
  • 3

Expert Comment

ID: 24319517
You use a filter, not the subnet mask. use for this example.

Expert Comment

ID: 24319545
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 eq 22

Author Comment

ID: 24319580
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 eq 22
access-list 123 permit tcp any host eq 22
% Invalid input detected at '^' marker.

Accepted Solution

keno44 earned 500 total points
ID: 24319602
Take the word host out of the statement. Sorry, I didnt catch that earlier!!

Assisted Solution

akalbfell earned 500 total points
ID: 24321392
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 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


Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Imagine you have a shopping list of items you need to get at the grocery store. You have two options: A. Take one trip to the grocery store and get everything you need for the week, or B. Take multiple trips, buying an item at a time, to achieve t…
In this article, WatchGuard's Director of Security Strategy and Research Teri Radichel, takes a look at insider threats, the risk they can pose to your organization, and the best ways to defend against them.
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…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

590 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