Hello all,
Was curious to know if there is a way to block all IP/Traffic based on location utilizing the Firewall Filter Application within RouterOS?
So for example:
Blocking all requests or pings from a particular Country, etc?
using telnet o ssh or in winbox you can launch a terminalok, Understood! and thank you for the reply. I have a list I acquired from ipdeny.com and its about a list of 4000+ ips
Is there any easier way of performing this through CLI? rather then inputting it block by block through the WebGUI Firewall Filter?
using telnet o ssh or in winbox you can launch a terminalok, Understood! and thank you for the reply. I have a list I acquired from ipdeny.com and its about a list of 4000+ ips
Is there any easier way of performing this through CLI? rather then inputting it block by block through the WebGUI Firewall Filter?
27.116.56.0/22
43.231.131.0/24
43.249.40.0/22
/ip firewall address-list
add list=BLOCK address=27.116.56.0/22
add list=BLOCK address=43.231.131.0/24
add list=BLOCK address=43.249.40.0/22
/ip firewall filter add action=drop chain=forward src-address-list=BLOCK
/ip firewall address-list
Do you use SSH/telnet often on that router?
If you use winbox to administer your devices, simple disable SSH/telnet in services....
Skot, Thank you so much! your input is greatly appreciated! I will definitely look into this further and try to take a stab at this.If you don't want to add them one by one, you should take the IP files from that website and automate using PHP, bash, or something else to output a properly formatted .rsc script that can be imported into the router and automatically add the address list entries. You'd also have to add firewall rules to drop traffic from those address lists.
Lines like this:Would become something like this:Code: Select all27.116.56.0/22 43.231.131.0/24 43.249.40.0/22
And then have a firewall rule to drop this traffic:Code: Select all/ip firewall address-list add list=BLOCK address=27.116.56.0/22 add list=BLOCK address=43.231.131.0/24 add list=BLOCK address=43.249.40.0/22
Ideally you would have this done on a server, which would periodically re-download the lists, output fresh scripts, and upload them to the router using ftp and an name.auto.rsc file, or the router could have a schedule to download the new lists and import them. You'd also have to have a script that would clear out old entries.Code: Select all/ip firewall filter add action=drop chain=forward src-address-list=BLOCK
Or... another more manual option would be to download the IP lists and open them in notepad++. Replace the beginning of the line with the first part of the address lists command. Tutorials here or here for replacing beginning of lines. Then copy script to clipboard.
In router CLI, go to the address-list:... and paste copied script. Repeat this process with all IP files you want to block. Make sure you have firewall filter rule to drop these like example above. The downside, like Jarda says, is that IP lists may change, and manually updating the lists this way would not be efficient.Code: Select all/ip firewall address-list