Skip to main content

How to Configure a Router to block websites with Access-List

Here are the simple steps to follow to block a website to the user who are accessing Internet through your Router
Step 1: Configure a DNS server

Let’s say we want to block access to the creatively named We don’t know the IP address, and we don’t want to know it. When we configure the Access List in the router—the Cisco IOS can look it up and fill it automatically.
To do this, we need at least one DNS server configured on the router. To configure a DNS server, use the ip name-server command. Here’s an example:
Router(config)# ip name-server
In this case, we configured a primary and a backup DNS server for the router to use to resolve DNS names. This doesn’t affect any traffic flowing through the router; the router will use these DNS servers when we ping a Web server by name. Here’s an example:
Router# ping
Translating “”…domain server ( [OK]
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to, timeout is 2 seconds:
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
In this example, the router used the domain name server we specified (i.e., to resolve the DNS name. It successfully translated the DNS name to
If we hadn’t already specified a DNS server, then the router would have returned something like the following:
Translating “”…domain server (
% Unrecognized host or address, or protocol not running.
Step 2: Create the ACL
To actually block the undesirable Web site, we need to create an access control list (ACL) to define exactly what we want to block. Here’s an example:
Router(config)# access-list 101 deny tcp any host eq www
 Translating “”…domain server ( [OK]
Router(config)# access-list 101 permit ip any any
(Do not forget this permit tcp any any, As you know otherwise all web traffic will be denied)
This ACL denies all Web traffic from any source going to the specified Web site. After blocking that traffic, it will also allow all other Web traffic from any source to any destination. Finally, because of the implied deny, it will deny all other traffic.
What if you want to determine which IP addresses are trying to go to the blocked Web site? You can log this information using the log keyword. Here’s an example:
Router(config)# access-list 101 deny tcp any host eq www log
Step 3: Avoid this
Here’s one issue to keep in mind. After we entered the first line of the ACL above, notice how the router used the DNS server to resolve the DNS name. It then replaced the IP address that the hostname resolved to in the ACL. Here’s a closer look at the configuration:
Router# sh run
inc access-list 101
access-list 101 deny tcp any host eq www
This is a nice feature, but it can be problematic for a couple of reasons. First, the IP address entered is only the first IP address that the DNS server responded to. If this is a large Web site that has multiple servers (such as a search engine), the ACL only contains the first IP address that the DNS server responded with—you’ll need to manually block the other IP addresses. Here’s an example:
C:\> nslookup
Non-authoritative answer:
In addition, if the IP address of the blocked Web server changes, your ACL will remain the same. You would need to manually update the ACL.
Step 4: Apply the ACL
Just because we’ve created the ACL doesn’t mean the router is actually using it—we still have to apply the ACL. We created this ACL with the assumption that it’s blocking traffic from our local LAN that’s going out to the WAN (i.e., the Internet). That’s because we formatted the ACL with source then destination.
Because of this design, we need to apply the ACL in the OUTBOUND direction on the router. Here’s an example:

Router(config)# int serial 0/0
Router(config-if)# ip access-group 101 out
That is it… Your have successfully blocked the


Popular posts from this blog

a file I/O error has occurred while accessing vmware converter

While converting physical Windows 7 machine to Virtual machine of infrastructure type, I got this error. The error seems it is unable to read/write source or destination datastore.

I have installed VMware-converter-en-6.2.0-8466193 on Windows 7 physical machine with option locally selected. (not at server/client option)

All of my ESXi servers are connected to the vCenter Server, so I had to use vCenter Server's IP address to send this physical machine to the virtual world.

The issue i found was with the dns resolution to the vCenter Server's hostname. Since I am not using the same dns server on the Windows 7 client machine. So I updated the host entries manually for the vCenter Server's hosname to it IP address.

After adding dns eteries to the hostfile of windows 7, I am not getting this "a file I/O error has occurred while accessing vmware converter" and the migration has started.

Connection control operation failed for disk 'ide1:0'

I was getting this error while removing Operating System ISO image mounted on the Virtual Machine.

What worked for me, is
1. Uncheck the "Connected and Connect at power on" from Device Status.
2. Then Change the Device type from "Datastore ISO File to Client Device" Radio Button
3. and press OK to save the changes.

Note:- I was able to remove the mounted ISO only by directly logging to the ESXi at https://esxi-ip-address/ui

where it asks

"The guest operating system has locked the CD-ROM door and is probably using the CD-ROM, which can prevent the guest from recognizing media changes. If possible, eject the CD-ROM from inside the guest before disconnecting. Disconnect anyway and override the lock?"

You need to select yes to eject the CD-ROM and then remove the ISO file successfully.

GNS3 Docker Error while creating node: Docker has returned an error: Cannot connect to host docker:80

Error while creating node: Docker has returned an error: Cannot connect to host docker:80 ssl:False [No such file or directory]

After adding docker template for Alpine Linux in gns3, you get above mentioned message when you want to use alpine linux in GNS3.

To get rid of this message you have to install Docker by following below link
curl -fsSL | sh

If you do not have curl installed then instal curl first with below command.apt-get install curl
After installing Docker you need to add your user name in the docker group with the following command. $ sudo usermod -aG docker your_username

Verify if the docker service is started with following command$ service docker status
If docker is not started then start with following command $ sudo service docker start
Logout from GNS3 Virtual Machines and log back. Start gns3 and use alpine linux.