Page 1 of 1

How to deny/allow website by IP address in RB750 router?

Posted: Mon Jul 02, 2012 11:47 am
by piseth168
Any friend can tell me how we can block website by IP address some of client we don't allow to access youtube or facebook.

How to deny/allow website by IP address in RB750 router?

Re: How to deny/allow website by IP address in RB750 router?

Posted: Mon Jul 02, 2012 2:25 pm
by lordkappa
You could block by IP, but many sites like youtube have a slew of ip's.

Use the "Content" option in the firewall to filter based on a keyword. "Facebook.com" or "Youtube.com".
/ip firewall filter 
add chain=forward action=reject reject-with=tcp-reset protocol=tcp content="Host: www.facebook.com" 
You could simply drop the traffic, but the TCP Reset option will immediately dump the client to an error screen, and not just leave the browser retrying the connection over and over.

Re: How to deny/allow website by IP address in RB750 router?

Posted: Tue Jul 03, 2012 5:18 am
by piseth168
Hi, As your comment we can block all in network. As I need I want to block by IP address. Some user I don't allow to access website.

You could block by IP, but many sites like youtube have a slew of ip's.

Use the "Content" option in the firewall to filter based on a keyword. "Facebook.com" or "Youtube.com".
/ip firewall filter 
add chain=forward action=reject reject-with=tcp-reset protocol=tcp content="Host: www.facebook.com" 
You could simply drop the traffic, but the TCP Reset option will immediately dump the client to an error screen, and not just leave the browser retrying the connection over and over.

Re: How to deny/allow website by IP address in RB750 router?

Posted: Tue Jul 03, 2012 6:50 am
by lordkappa
Hi, As your comment we can block all in network. As I need I want to block by IP address. Some user I don't allow to access website.
I'm confused. Did you solve the problem?

If my rule didn't work as written, see http://wiki.mikrotik.com/wiki/Manual:IP/Firewall/Filter regarding how to write firewall rules. You can change it for your specific needs.

Re: How to deny/allow website by IP address in RB750 router?

Posted: Wed Jul 04, 2012 6:47 pm
by tjc
It sounds like piseth168 wants to filter by originating user as well as destination.

So the answer is half the solution needed, and just needs a src-address or src-address-list which covers the machines that you're interested in limiting.

Re: How to deny/allow website by IP address in RB750 router?

Posted: Thu Jul 05, 2012 3:24 am
by piseth
Dear tjc,

You thing is correct. Could you share me current configure?

regards.
It sounds like piseth168 wants to filter by originating user as well as destination.

So the answer is half the solution needed, and just needs a src-address or src-address-list which covers the machines that you're interested in limiting.

Re: How to deny/allow website by IP address in RB750 router?

Posted: Thu Jul 05, 2012 4:52 am
by lordkappa

Re: How to deny/allow website by IP address in RB750 router?

Posted: Thu Jul 05, 2012 9:40 am
by nerwin43
better block the website on the PC itself. You can do it by adding www.facebook.com on the host file.

This i how your host file should look like.

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
::1 localhost
127.0.0.1 www.facebook.com
127.0.0.1 www.youtube.com




hope it help.

Re: How to deny/allow website by IP address in RB750 router?

Posted: Thu Jul 05, 2012 11:42 pm
by shahbazian
Hi
For permit access to some of web sites, you can do it by adding this commands
/ ip proxy set enabled=yes
/ ip proxy access add dst-host=facebook.com action=deny
/ ip proxy access add dst-host=*.facebook.com action=deny
/ip firewall nat add chain=dstnat protocol=tcp dst-port=80 src-address-list=webclients action=redirect to-ports=8080 comment=Transparent_web_proxy
/ip firewall address-list add list=webclients address=first_client_ip_address
/ip firewall address-list add list=webclients address=2nd_client_ip_address
/ip firewall address-list add list=webclients address=3rd_client_ip_address

Re: How to deny/allow website by IP address in RB750 router?

Posted: Sun Jul 08, 2012 9:51 pm
by jandafields
You could block by IP, but many sites like youtube have a slew of ip's.

Use the "Content" option in the firewall to filter based on a keyword. "Facebook.com" or "Youtube.com".
/ip firewall filter 
add chain=forward action=reject reject-with=tcp-reset protocol=tcp content="Host: www.facebook.com" 
You could simply drop the traffic, but the TCP Reset option will immediately dump the client to an error screen, and not just leave the browser retrying the connection over and over.
This solution just gives you a false sense of security. It's too easy to circumvent by going to https://facebook.com (because https is encrypted so you can't read the host headers and it won't get caught).

The best way to do this with mikrotik is to block based on content to port 53udp (DNS), this way it can't even look it up. you should also transparently reroute all dns traffic to the mikrotik, so users can't use their own dns settings and get around it.

Of course, they could edit their host file and still get to facebook. This is one bad limitation of mikrotik that cisco can easily do. Mikrotik can't firewall based on url, but cisco can. That would be great if it could!!!!

Otherwise, it's impossible to block websites because of the https issue.

Re: How to deny/allow website by IP address in RB750 router?

Posted: Mon Jul 09, 2012 1:59 am
by lordkappa
You could block by IP, but many sites like youtube have a slew of ip's.

Use the "Content" option in the firewall to filter based on a keyword. "Facebook.com" or "Youtube.com".
/ip firewall filter 
add chain=forward action=reject reject-with=tcp-reset protocol=tcp content="Host: www.facebook.com" 
You could simply drop the traffic, but the TCP Reset option will immediately dump the client to an error screen, and not just leave the browser retrying the connection over and over.
This solution just gives you a false sense of security. It's too easy to circumvent by going to https://facebook.com (because https is encrypted so you can't read the host headers and it won't get caught).

The best way to do this with mikrotik is to block based on content to port 53udp (DNS), this way it can't even look it up. you should also transparently reroute all dns traffic to the mikrotik, so users can't use their own dns settings and get around it.

Of course, they could edit their host file and still get to facebook. This is one bad limitation of mikrotik that cisco can easily do. Mikrotik can't firewall based on url, but cisco can. That would be great if it could!!!!

Otherwise, it's impossible to block websites because of the https issue.
There's always some way around any solution... The most surefire way, then, would be to only allow HTTP traffic through a proxy that you control.

Re: How to deny/allow website by IP address in RB750 router?

Posted: Mon Jul 22, 2013 8:20 am
by Prajeesh
Try with Layer 7 protocol

^.+(facebook.com).*$

it works for both http/https

Re: How to deny/allow website by IP address in RB750 router?

Posted: Sat Jul 27, 2013 1:37 am
by jandafields
Try with Layer 7 protocol

^.+(facebook.com).*$

it works for both http/https
That is a HORRIBLE thing to do. You will end up blocking LOTS of other websites! (I just tried it, and several websites that have a facebook button on them would not load, or woud halfway load). Any website that has facebook code built in ("like us on facebook, etc"). Those pages will load until they get to the facebook code, then they will hang while waiting for facebook to build the "like" link.

Re: How to deny/allow website by IP address in RB750 router?

Posted: Mon Nov 04, 2013 3:05 pm
by ojeysky
You could block by IP, but many sites like youtube have a slew of ip's.

Use the "Content" option in the firewall to filter based on a keyword. "Facebook.com" or "Youtube.com".
/ip firewall filter 
add chain=forward action=reject reject-with=tcp-reset protocol=tcp content="Host: www.facebook.com" 
You could simply drop the traffic, but the TCP Reset option will immediately dump the client to an error screen, and not just leave the browser retrying the connection over and over.
This solution just gives you a false sense of security. It's too easy to circumvent by going to https://facebook.com (because https is encrypted so you can't read the host headers and it won't get caught).

The best way to do this with mikrotik is to block based on content to port 53udp (DNS), this way it can't even look it up. you should also transparently reroute all dns traffic to the mikrotik, so users can't use their own dns settings and get around it.

Of course, they could edit their host file and still get to facebook. This is one bad limitation of mikrotik that cisco can easily do. Mikrotik can't firewall based on url, but cisco can. That would be great if it could!!!!

Otherwise, it's impossible to block websites because of the https issue.
Actually this way worked for me....https traffic delivers an unreachable error while my squid handles the http part with a nice connection failed message ;)

Re: How to deny/allow website by IP address in RB750 router?

Posted: Mon Apr 07, 2014 9:42 am
by timteka
This is one bad limitation of mikrotik that cisco can easily do. Mikrotik can't firewall based on url, but cisco can. That would be great if it could!!!!
Guys, any news on the topic? Maybe there's already a Feature Request for the firewall based url content filtering?