cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
236
Views
0
Helpful
9
Replies

Blocking a website from a cisco Router

Hi.,

Community People.

How best can i prevent my inside network from accessing a certain website:

for instance, url:  www.Blinkstreamz with IP: 213.176.3.30.

 ''ip route 213.176.3.0 255.255.255.0 null0 name Blinkstreamz''

Can the above route suffice to block  any IP from inside my network from accessing this website

8 Accepted Solutions

Accepted Solutions

Sure if this website use this public IP

All traffic will drop since egress interface is null

MHM

View solution in original post

Joseph W. Doherty
Hall of Fame
Hall of Fame

That might work.  You might also limit the route statement to just the host IP.

Another alternative would be to use an ACL.

View solution in original post

Blue_Bird
VIP
VIP

It works..as long as web site is having fixed IP Address. If the website "Blinkstreamz" uses CDNs or load balancers, it may operate over multiple IPs. In that case, better to use firewall rules if possible that block access based on domain names or a wider set of IP ranges.


Best regards
******* If This Helps, Please Rate *******

View solution in original post

M02@rt37
VIP
VIP

Hello @2D-Technology Services 

You could use an extended ACL like this, and apply it on your LAN interface in ingress:

ip access-list extended BLOCK_BLINKSTREAMZ
deny ip any host 213.176.3.30 log
permit ip any any

interface gix/x
ip access-group BLOCK_BLINKSTREAMZ in

This will block all protocols (TCP, UDP, ICMP) to 213.176.3.30 and alowing everything else.

Best regards
.ı|ı.ı|ı. If This Helps, Please Rate .ı|ı.ı|ı.

View solution in original post

Hi M02@RT37

Can I also apply this on the interface facing my ISP.

View solution in original post

Joseph W. Doherty
Hall of Fame
Hall of Fame

Some commentary on other replies.

@balaji.bandi has touched upon one of the classical issues in blocking traffic to another site not under your control, i.e. IPs might change (as first noted by @Blue_Bird ).  His suggestion of using scripting, including possibly on-router scripting, to recurrently check DNS to block IP, and remediated IP on router, is a great way to avoid the need, in theory, to manually monitor and reconfigure the router if DNS to IP changes.

Oh, and BTW, another possible approach would be to block the DNS resolution for that name, but that would allow someone that otherwise knows the IP to get to the site.

An ACL blocking access might be used as an ingress or egress ACL.  Generally, ACLs are recommended to be applied ASAP to avoid needless processing of packets that will be dropped.  However, keep in mind, that as initial session setup packets will be dropped, such sessions won't be formed, i.e. most of to be blocked traffic would be the follow on session traffic, where you block the traffic probably matters little, except for convenience.  For example, doing all the blocking in one place, such on the Internet connecting router (as as the ISP connecting interface, which you asked about), would likely be the easiest to maintain.

The logic also applies to using the null route approach too (i.e. you should only need to do that in the Internet connecting router).

In M02@rt37 's example ACL, he shows an ACE with the log option.  Which is great for logging what host IP is attempting access, but, in theory, slightly more resource intensive (I recall, traditionally an ACL is more resource intensive than a null route), however, keep in mind what I wrote above, since sessions are being initially blocked, there shouldn't be a huge number of such packets to block to route to null.  (In other words, again, don't worry about "efficiency">)

View solution in original post

There are many way to drop traffic 

One using routing 

Other using ACL 

What different' if you apply ACL then router will check each traffic pass is it permit or deny 

Where when use rib it low intensive to CPU where only this destiantion will routing to null and drop

MHM

View solution in original post

9 Replies 9

Sure if this website use this public IP

All traffic will drop since egress interface is null

MHM

Joseph W. Doherty
Hall of Fame
Hall of Fame

That might work.  You might also limit the route statement to just the host IP.

Another alternative would be to use an ACL.

Blue_Bird
VIP
VIP

It works..as long as web site is having fixed IP Address. If the website "Blinkstreamz" uses CDNs or load balancers, it may operate over multiple IPs. In that case, better to use firewall rules if possible that block access based on domain names or a wider set of IP ranges.


Best regards
******* If This Helps, Please Rate *******

M02@rt37
VIP
VIP

Hello @2D-Technology Services 

You could use an extended ACL like this, and apply it on your LAN interface in ingress:

ip access-list extended BLOCK_BLINKSTREAMZ
deny ip any host 213.176.3.30 log
permit ip any any

interface gix/x
ip access-group BLOCK_BLINKSTREAMZ in

This will block all protocols (TCP, UDP, ICMP) to 213.176.3.30 and alowing everything else.

Best regards
.ı|ı.ı|ı. If This Helps, Please Rate .ı|ı.ı|ı.

Hi M02@RT37

Can I also apply this on the interface facing my ISP.

There are many way to drop traffic 

One using routing 

Other using ACL 

What different' if you apply ACL then router will check each traffic pass is it permit or deny 

Where when use rib it low intensive to CPU where only this destiantion will routing to null and drop

MHM

balaji.bandi
Hall of Fame
Hall of Fame

i don't have in hand to offer that script some where in my archive i have tested, i will post when i find it

you can use EEM script or external script to  check the DNS Lookup against the domain, if the IP change amend the ACL to the router.

by the what Router and IOS, make sure you have latest code of 15.x to be there to work as expected, 12.X have some limitation.

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Joseph W. Doherty
Hall of Fame
Hall of Fame

Some commentary on other replies.

@balaji.bandi has touched upon one of the classical issues in blocking traffic to another site not under your control, i.e. IPs might change (as first noted by @Blue_Bird ).  His suggestion of using scripting, including possibly on-router scripting, to recurrently check DNS to block IP, and remediated IP on router, is a great way to avoid the need, in theory, to manually monitor and reconfigure the router if DNS to IP changes.

Oh, and BTW, another possible approach would be to block the DNS resolution for that name, but that would allow someone that otherwise knows the IP to get to the site.

An ACL blocking access might be used as an ingress or egress ACL.  Generally, ACLs are recommended to be applied ASAP to avoid needless processing of packets that will be dropped.  However, keep in mind, that as initial session setup packets will be dropped, such sessions won't be formed, i.e. most of to be blocked traffic would be the follow on session traffic, where you block the traffic probably matters little, except for convenience.  For example, doing all the blocking in one place, such on the Internet connecting router (as as the ISP connecting interface, which you asked about), would likely be the easiest to maintain.

The logic also applies to using the null route approach too (i.e. you should only need to do that in the Internet connecting router).

In M02@rt37 's example ACL, he shows an ACE with the log option.  Which is great for logging what host IP is attempting access, but, in theory, slightly more resource intensive (I recall, traditionally an ACL is more resource intensive than a null route), however, keep in mind what I wrote above, since sessions are being initially blocked, there shouldn't be a huge number of such packets to block to route to null.  (In other words, again, don't worry about "efficiency">)