Configuring iptables script for DD-WRT

ryan256

Platinum Member
Jul 22, 2005
2,514
0
71
I run an email server from my home. I have noticed several attempts to brute force my server from IP addresses in China and other countries. When this happens I look up the IP addresses on apnic.net or ripe.net and then add a rule to my router to ban their whole subnet. I want to ban them at my router, not my email server because I don't want them to even see my network anymore.
I don't think this script works correctly though. My office has 2 networks with 2 different public IP addresses. My phone was connected to network1 and my workstation on network2. I connected to my router from my workstation and added a rule to drop all traffic on a subnet that included the public IP address of network1, but not network2. I then tried to RDP to my email server from my phone and was able to do so. My phone should have been blocked from connecting.

Here is a sample of the iptables script I have built so far. I don't think it works correctly though and would like some help.
Code:
iptables -I INPUT -s 105.236.0.0/16 -j DROP
iptables -I INPUT -s 110.234.0.0/15 -j DROP
iptables -I INPUT -s 114.80.0.0/12 -j DROP
iptables -I INPUT -s 118.0.0.0/8 -j DROP
iptables -I INPUT -s 121.128.0.0/10 -j DROP
iptables -I INPUT -s 122.224.36.24/29 -j DROP
iptables -I INPUT -s 124.192.0.0/15 -j DROP
iptables -I INPUT -s 134.208.0.0/16 -j DROP
iptables -I INPUT -s 144.32.0.0/12 -j DROP
iptables -I INPUT -s 183.192.0.0/10 -j DROP
iptables -I INPUT -s 188.124.8.0/24 -j DROP
iptables -I INPUT -s 193.87.172.128/25 -j DROP
iptables -I INPUT -s 200.68.80.0/20 -j DROP
iptables -I INPUT -s 202.164.41.16/28 -j DROP
iptables -I INPUT -s 202.85.208.0/20 -j DROP
iptables -I INPUT -s 203.197.0.0/16 -j DROP
iptables -I INPUT -s 203.40.0.0/13 -j DROP
iptables -I INPUT -s 204.133.174.0/29 -j DROP
iptables -I INPUT -s 209.172.34.128/27 -j DROP
iptables -I INPUT -s 209.190.128.0/18 -j DROP
 
Last edited:

ryan256

Platinum Member
Jul 22, 2005
2,514
0
71
Bump.
Could really use some help on this from someone please. I'm very new to making iptables configurations.
 

MrColin

Platinum Member
May 21, 2003
2,403
3
81
I'm guessing that you have a rule that forwards you RDP port and that rule accepts the connection before the blocking rules are evaluated, just a guess on my part. Try going at it with nmap and see what you get.

Nmap is a free scanning tool, you can get it here http://nmap.org/

Since you are running DD-WRT, you should be extra careful that UPnP is turned off. Pretty much all of the opensource implementations have an exploitable vulnerability.

If you access the router via ssh you can output the rules with "iptables -L" if you have any doubts about your rules bein applied.
 
Last edited:
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |