March 29, 2024, 02:55:25 PM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: ALLOWING and BLOCKING certain LOCAL IPADDRESS on IPTABLES  (Read 3214 times)

Offline twin_mendoza

  • Linux Noob !
  • *
  • Posts: 6
ALLOWING and BLOCKING certain LOCAL IPADDRESS on IPTABLES
« 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 :)

Offline ronaldjayr_jover

  • Linux Noob !
  • *
  • Posts: 29
Opening ports for certain ip
« Reply #1 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

Offline twin_mendoza

  • Linux Noob !
  • *
  • Posts: 6
Opening ports for certain ip
« Reply #2 on: February 17, 2006, 09:37:29 AM »
thanks for the relpy ;) i will try that one