Named ACLs applied to VTY lines control which IP addresses can establish SSH or Telnet sessions on a Cisco device. This approach differs from interface-based ACLs and uses the access-class command instead of access-group.
ACLs on VTY Lines
We've talked about standard ACLs and how to apply them to interfaces to block traffic going to other networks. But in this case, let's say we actually want to block traffic from logging into a VTY, or logging into a session on one of our devices. That's going to look a little different, so let's go over the commands to be able to create that security.
Previously we were on our demo laptop and we were trying to access this network over here. We were blocking certain IPs while allowing other IPs. But in this case, maybe we just want to stop people from being able to log into this switch, while allowing certain other IP addresses to log into it.
So what are the commands to do that? First of all, since I'm blocking the SSH access, the VTY access, to this device right here, that's the device I'm going to need to be on for this next set of commands. I'm going to use essentially the same ACL as I used before, but we're going to apply it to the VTY lines on this device.
So let's jump onto this device. Here we are. I'm going to get into global configuration mode, and I'm going to take the same set of commands that we've been working with to create this ACL. So we're creating my ACL — or maybe we actually want to rename this. Once again, the advantage of a named ACL is for it to give some insight into what it's using, so let's do SSH ACL. I'm going to copy this right here, I'm going to paste it onto here, and now it's entered into this machine. I'll exit out of there.
Next we'll get into this line vty, so line vty 0 15. We'll get into that, and I'm going to apply access-class, my ACL — we do need to change that, because we changed the name. Notice the IP is not at the beginning of this like it was in our last one, and instead of list it uses class, so it's a little different than when we're applying it to an interface. So we're going to paste this into here.
Now the way this is set up, from this demo laptop I'd be able to SSH into this device as long as it's coming from 10.1.10.34. I have 10.1.10.35 on this machine as well, and I would not be able to SSH into this machine from that IP address. So that is how we lock down access to this.
TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.
Explore free tools and programs →