May 27, 2022, 06:22:11 PM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: how to block all port and permit some port for client ?  (Read 3575 times)

Offline sothy

  • Linux Learner
  • ***
  • Posts: 84
how to block all port and permit some port for client ?
« 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

Offline Ricky

  • LST CareTaker
  • Specially Skilled
  • *****
  • Posts: 2381
how to block all port and permit some port for client ?
« Reply #1 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.

Offline gauravbajaj

  • LST CareTaker
  • Experienced
  • *****
  • Posts: 658
how to block all port and permit some port for client ?
« Reply #2 on: May 04, 2006, 03:39:05 AM »
Just try Ricky's suggestion, but i think its different in SUSE

Gaurav

Offline sothy

  • Linux Learner
  • ***
  • Posts: 84
how to block all port and permit some port for client ?
« Reply #3 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

Offline gauravbajaj

  • LST CareTaker
  • Experienced
  • *****
  • Posts: 658
how to block all port and permit some port for client ?
« Reply #4 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

Offline dragoncity99

  • LST CareTaker
  • Experienced
  • *****
  • Posts: 551
how to block all port and permit some port for client ?
« Reply #5 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/