Linux Forums - Linux Help,Advice & support community:LinuxSolved.com

Network Troublshooting => General Networking Support in Linux => Topic started by: twin_mendoza on February 13, 2006, 01:50:54 PM

Title: ALLOWING and BLOCKING certain LOCAL IPADDRESS on IPTABLES
Post by: twin_mendoza on February 13, 2006, 01:50:54 PM
how can i allow a port to a certain IP add at my localnetwork

open port 1036-1050 and 8080 for IP 192.168.0.10 and the rest of the network IP add can only access port 8080. is it possible?

hope to hear from you guys :)
Title: Opening ports for certain ip
Post by: ronaldjayr_jover on February 14, 2006, 03:44:43 AM
hi!!!
 
 how can i allow a port to a certain IP add at my localnetwork

open port 1036-1050 and 8080 for IP 192.168.0.10 and the rest of the network IP add can only access port 8080. is it possible?

--------xxxxxxxxxx---------

let us say that eth1 is bind to your local network


iptables -A INPUT -i eth1 -p tcp -m tcp -d 192.168.0.10 --dport 1036:1051 -j ACCEPT

for the port 8080 just change 1036:1051 ---> 8080

also you should have an output rule after this just replace -i --> -o , -d --> -s , --dport --> --sport


for the other network (add this before at the top of the first rule)

iptables -A INPUT -i eth1 -p tcp -m tcp -d 192.168.0.1/xx --dport 8080 -j ACCEPT

again just edit same as the above mention.

at the last line add the DROP all rule
Title: Opening ports for certain ip
Post by: twin_mendoza on February 17, 2006, 09:37:29 AM
thanks for the relpy ;) i will try that one