Monday, June 24, 2013

how to close a port and open a ports in linux

how to close an open ports and open a ports in linux with simple commands

You Can Close The Port With IPTABLES, 

But The Corresponding Service Will Be Remain In Memory, 

If You Don't Want Some Open Ports, You Can Stop Related Services, 

For Example, If You Don't Want Port 21(You Want To Close It) 

Stop FTP(File Transfer Protocol) Service. 

Opening The Port Has No Meaning 

You Must Start A Service Depend On Port Number 

For Example If You Start SSH(Secure Shell) Port 22 Will Be Open


Firewall can close and open your ports on your system, and its 
used by different type of firewall on different operating 
systems. Which Linux Distribution you are using ? Is it only a 
single server or a system within a Data Center? The solutions 
may be different based on your current requirement. 

If you are using a single system then just use the builtin 
firewall - iptables. 

Exactly, all had reply good. 

Actually whenever there is requirement for opening anc closing port is 
there must be something important you have to do. 

so can you pl. tell what is your requirement? 
so depending on that we can show you diff. methods. 

[1] if you wish to stop any service then use service httpd stop 
this command will stop your web server so then the port no 80 will not 
listen any request. 

[2] the other thing is ;use iptaables rules. 

read man iptables 

Pl. try to give ur exact requirement. 
1. How to open and close ports with iptables 
2. how to make a port listen 
3. how to make our own service ie our own system 5 service and xinetd based service. 
4. what is the difference between port listening and port opening here a lot of difference is there please explain me 
5. port forwarding


Post a Comment

Design by BABU | Dedicated to grandfather | welcome to BABU-UNIX-FORUM