Hi , i am struggling to find a way to this complicate set of rules in iptables .
Imagine this list of ips :
What i need :
- I need that these ips can access only port 8080 on server no matter what port they are coming .
- All other ips not on this list can not access port 8080 but can access the current open ports on server .
How to do this with iptables ?
UPDATED
I have been trying here to figure out a solution .
What i need is a prerouting rule with ip source and a set of rules to allow that specific ip to allow port 8080 but close all others .
One thing to startup is to set in my prerouting table this rule :
Test for only 1 ip
Quote:
# Basically i was expecting to preroute this ip to port 8080
-A PREROUTING -p tcp -s 1.1.1.1 -j REDIRECT --to-ports 8080
|
and in the iptables input rules these instructions :
Quote:
#these set of rules allow port 8080 to that ip but block all others
-A INPUT -p all -m all -s 1.1.1.1 --dport 8080 -j ACCEPT
#Here drop all ports from 1 to 8079 to this ip
-A INPUT -s 1.1.1.1 --dport 1:8079 -j DROP
#Here drop all ports from 8081 to 65535 to this
-A INPUT -s 1.1.1.1 --dport 8081:65535 -j DROP
# Here i close the port 8080 for all other ips that are not in list
-A INPUT -p tcp -m tcp --dport 8080 -j DROP
|
However , it is not working