AnthonyArmato
Senior Member
Is it possible to block a range of IPs without having to enter them one at a time via Firewall/Network Services Filter ?
Is it possible to block a range of IPs without having to enter them one at a time via Firewall/Network Services Filter ?
Is it possible to block a range of IPs without having to enter them one at a time via Firewall/Network Services Filter ?
IMPORTANT: The reason i am using a jffs script to filter non authorize dns request is that there is a bug in the network service filter (from firewall router menu) and you cannot filter correctly and easily all other dns server (different from opendns ones you want to use) if you are using "parental control" feature of your router: parental control feature active will make your network filter rules (from the router gui menu) going wild with firmware 3.0.0.4.270.24 (merlin).
iptables -I PREROUTING -t nat -p udp -s `nvram get lan_ipaddr`/`nvram get lan_netmask` ! -d `nvram get lan_ipaddr`/`nvram get lan_netmask` --dport 53 -j DNAT --to-destination `nvram get lan_ipaddr`
If you want to take it one step forward, the following will force all DNS queries to go through your router (which will in turn go through OpenDNS). That way, a misconfigured client will still have Internet access, just that it will be forced to to through your configured DNS.
Merlin said:
Yes very good idea. That way it will silently force to use the opendns dns server instead of dropping the undesired dns attempt. I would try this improvement as soon as i have a chance to.
This modification has to be added to another script than "firewall-start" i guess?
Thanks
Trying to do this to fix youtube by chance?
Absolutely no idea how to do that.The Network Services filter blocks the LAN to WAN packet exchanges and restricts devices from using specific network services.
So that's not blocking Ip ranges, thats for denying local hosts access to specific ports / hosts you put in this list.
What you can do is figure out how you block a range with iptables and then put this in the script "firewall-start" on the jffs partition. I think that's the only way you would be able to get this going.
something like iptables INPUT -p all -s aaa.bbb.ccc.ddd/netmask -j DROP should work I think
Think I got it. Spoke to Asus. The guy had me block 3 IPs to block a whole subnet. Something about a broadcast address etc etc. But like I said to him, I didn't need the whole subnet blocked.
So I found something online that said to run the following commands. (I inserted the IP range I needed blocked)
Does this look correct ?
iptables -i eth1 -A INPUT -s 173.194.55.0/24 -j DROP
iptables -i eth1 -A INPUT -s 206.111.0.0/16 -j DROP
Running iptables -L shows this...
DROP all -- 173.194.55.0/24 anywhere
DROP all -- 206.111.0.0.ptr.us.xo.net/16 anywhere
Figured that out too.
Only thing I can't figure out is saving. Is it saved automatically or do I need to run a command to do that ?
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!