LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   block all IPs except one how in my setup?? (https://www.linuxquestions.org/questions/linux-networking-3/block-all-ips-except-one-how-in-my-setup-302144/)

cranium2004 03-16-2005 12:26 AM

block all IPs except one how in my setup??
 
hello,
How to prevent my RH9 linux machine to send packets to any internal private 10.0.*.* host ips? I have one LAN in which all machines connected to switch and ther are may LANs in my Organisation. Now i want traffic from pc should only be given to an other pc in my same LAN where i know that require me crossover cable but is that possible???
In simple words, Block all IPs except one which is allowed to communicate to my pc

Demonbane 03-16-2005 02:38 AM

/sbin/iptables -I INPUT -s ! 10.0.0.1 -j DROP

change 10.0.0.1 to the ip of the machine allowed to communicate

cranium2004 03-17-2005 12:05 AM

hello,
Ok how to modify
iptables -I INPUT -s ! 10.0.0.1 -j DROP
to allow only 10.0.0.1 to have communication with me as 10.0.0.100 with condition that any other ips excluding 10.0. network? That mean if i ping 172.16.*.* and 192.168.*.* from my 10.0.0.100 its must be allowed but in 10.*.*.* range only 10.0.0.1 alllowed
How to do that?

Demonbane 03-20-2005 03:24 PM

You mean you want to only limit connect to the 10.0.0.1 host in the 10.x.x.x network, while all hosts from other networks such as 172.16.x.x/192.168.x.x are unrestricted?
ok simple, add these 2 rules on top:
Code:

iptables -I INPUT -s 172.16.0.0/16 -j ACCEPT
iptables -I INPUT -s 192.168.0.0/24 -j ACCEPT



All times are GMT -5. The time now is 11:57 AM.