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

Network Troublshooting => Linux Servers Support => Topic started by: sothy on May 02, 2006, 02:21:31 AM

Title: how to block all port and permit some port for client ?
Post by: sothy on May 02, 2006, 02:21:31 AM
Dear all
 
    Now day i have working fine with squid on SUSE 9.1 but i want to know some knowleage about how to block client port all and then if  we want to open port client we can permit port that we want ......how ever i hope you will know about my question........

Regard
Sothy
Title: how to block all port and permit some port for client ?
Post by: Ricky on May 03, 2006, 10:40:51 AM
well. I have no experience about SuSe but in iptables you can do it easily.

first give all the ports you want to allow .. like
Code: [Select]
iptables -A INPUT -p udp -i eth0 --dport 22 -j ACCEPT
iptables -A INPUT -p tcp -i eth0 --dport 80 -j ACCEPT

here we are allow udp port 22 and tcp port 80 connection on eth0 .

And in the end add following line
Code: [Select]
iptables -P INPUT DROP  
So it will drop everything else other than allowed one.
Title: how to block all port and permit some port for client ?
Post by: gauravbajaj on May 04, 2006, 03:39:05 AM
Just try Ricky's suggestion, but i think its different in SUSE

Gaurav
Title: how to block all port and permit some port for client ?
Post by: sothy on May 06, 2006, 04:17:38 AM
Dear Sir

   About the information that i recived from Ricky have some scripts that i can use not at all . How ever i better than befor that have alot ip that want to try coneect to my server ,But  Mr.Gauravbajaj if you have good idea about how to block and allow ip that we want  could you pleased help and tell me about the script or your experiened that you meet or done .....


Thank You For Your Help.

Regard
Sothy
Title: how to block all port and permit some port for client ?
Post by: gauravbajaj on May 07, 2006, 06:05:22 AM
Actually I worked on SUSE previously, when i have 2-3 serveers of SUSE but as now i  dont have any Server in REDHAT or SUSE...So i can't test the things u asked previously.

Ya I can test if u give ipaddress and the password of ur SUSE machine ....
Otherwise its difficult to me as I dont have any Linux machine now.

Gaurav
Title: how to block all port and permit some port for client ?
Post by: dragoncity99 on May 07, 2006, 09:48:26 AM
Try this, u have plenty of script samples, up to u to pick which one u love:

linuxguruz.com/iptables/