I need to create a firewall that can allow only certain ips on certain port. For example allow 1.2.3.4, 2.2.2.2 and 5.5.5.5 on port 45654. If 6.6.6.6 tries to access 45654 to deny it.
What command i have tried :
netsh advfirewall firewall add rule name="application" dir=in action=allow program="C:application.exe" enable=yes remoteip=64.68.22.49,51.68.11.49/32,LocalSubnet profile=private protocol=TCP localport=42262
The problem is that i try to block all and allow ips each and every one of them via windows firewall (interface) but didn't work, either is blocking all or allowing all.
In linux everything is simple :
Linux equivalent
-I INPUT -s 0/0 -p tcp --dport 1080:65535 -j REJECT
-I INPUT -p tcp --match multiport --dports 35001:65000 -j ACCEPT
-I INPUT -p tcp --dport 61605 -j REJECT
-I INPUT -p tcp -s 103.204.244.3/32 --dport 61605 -j ACCEPT
-I INPUT -p tcp --dport 62814 -j REJECT
-I INPUT -p tcp -s 103.204.244.3/32 --dport 62814 -j ACCEPT
-I INPUT -p tcp --dport 61525 -j REJECT
-I INPUT -p tcp -s 103.204.244.3/32 --dport 61525 -j ACCEPT
iptables output :
ACCEPT tcp -- 178.166.173.55 0.0.0.0/0 tcp dpt:61605
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:61605 reject-with icmp-port-unreachable
ACCEPT tcp -- 178.150.247.127 0.0.0.0/0 tcp dpt:62814
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:62814 reject-with icmp-port-unreachable
ACCEPT tcp -- 178.150.247.127 0.0.0.0/0 tcp dpt:61525
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:61525 reject-with icmp-port-unreachable
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpts:1080:65535 reject-with icmp-port-unreachable
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
Any ideas?
Thanks.
Recent Questions...
ما را در سایت Recent Questions دنبال میکنید
برچسب:
نویسنده: استخدام کار
بازدید: 246
تاريخ: سه
شنبه
15 تير
1395 ساعت: 0:33