How to block a port


 
Thread Tools Search this Thread
Special Forums IP Networking How to block a port
# 1  
Old 04-30-2008
How to block a port

Hi,
i faced a problem, where i have to block a port, therefore nobody used it, evenwith SO_REUSEADDR flag. How can i achive it.
# 2  
Old 04-30-2008
Without knowing any more - consider using a firewall.

If a port is "busy" you cannot bump the user off the port unless you kill the process that has the socket to the port open. Then you open the port and block it.

It sounds like you want some kind of firewall rather than a simple C program.
# 3  
Old 05-01-2008
Quote:
Originally Posted by jim mcnamara
It sounds like you want some kind of firewall rather than a simple C program.
i think so too, thread moved to ip networking...
# 4  
Old 05-01-2008
Actually our our product facing similar type of problem. Therefore, i need it. Anybody will help me.
# 5  
Old 05-15-2008
Well, the simplest way to achieve something like this (for *nix) is to link your app with libwrap: libwrap - Wikipedia, the free encyclopedia and then bundle tcpwrappers + a sample hosts.allow and hosts.deny with your product.

I'm sure windows has similar api functionality for their packet filter.

Alternatively you can come up with an internal packet filter for the application based on a configuration file, parser and logic that you devise.
It's very simple in theory...An ip based ruleset is created via flat file, xml, etc.., then on a client connect the ruleset is parsed, the client address is
compared for exclusion. If exclusion is indicated the connection is closed with no further processing except, perhaps, for a log notice, otherwise the client
is serviced.

Last edited by ramen_noodle; 05-15-2008 at 12:06 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Block port for all except for one specific ip in Solaris11.4

Hi, I need to block ssh port 22 from all the servers except one server ip. Until solaris11.3 and below, I used to do like below(under /etc/ipf/ipf.conf),and it's working fine pass in quick from $server_ip to any port=22 block in quick from any to any port=22 But I tried almost same in... (1 Reply)
Discussion started by: Sumanthsv
1 Replies

2. Web Development

Two public ip for server, how to block a port for ip2 but not for ip1

Hello, I am not sure that it's possible to set a server for explained below scenario: I have ordered a second ip for my streaming server. Both ip addresses are set and well responding to my ping requests. LAMP is installed into server. Assume that port 15678 is running for nginx. Admin port is... (0 Replies)
Discussion started by: baris35
0 Replies

3. Solaris

How to find port number wwn of particular port on dual port HBA,?

please find the below o/p for your reference bash-3.00# fcinfo hba-port HBA Port WWN: 21000024ff295a34 OS Device Name: /dev/cfg/c2 Manufacturer: QLogic Corp. Model: 375-3356-02 Firmware Version: 05.03.02 FCode/BIOS Version: BIOS: 2.02; fcode: 2.01;... (3 Replies)
Discussion started by: sb200
3 Replies

4. UNIX for Dummies Questions & Answers

iptables to block port 25 only to a certain range

I want to limit all *outbound* traffic on eth0 (or all *.*) on port 25 to a specific (allowed) range... I.E. 192.168.1.5 (local ip) tries to connect to 1.2.3.4:25 (outside real world ip) It can proceed because 1.2.3.0/24 is the allowed range Now, 192.168.1.5 (local ip) tries to connect to... (1 Reply)
Discussion started by: holyearth
1 Replies

5. Shell Programming and Scripting

Block local and remote port with iptables - Script BASH

Hello I'm beginner in the linux scripting and i would like to get help. I want to create a script that can block one or more Port even see all the TCP port. The ports must be blocked even when starting my machine. Of course requires a second script which will allow the ports that you want to... (0 Replies)
Discussion started by: houstaf
0 Replies

6. Shell Programming and Scripting

to block the files uploading via the port

Hi Folks, I am not good in shell scripting. Please help me with my problem. Is it possible to block the file named "ss.cgi" using the port 25 to upload. (4 Replies)
Discussion started by: gsiva
4 Replies

7. Linux

using firewall to block port

Hi, I will like to allow access to the mysql port (3306) to certain IP address. All other IP's should be automatically blocked. What is the best way to do this? (8 Replies)
Discussion started by: shantanuo
8 Replies

8. IP Networking

How to know port is block..

My server is running on a port 16386, in the case when this port is blocked by some other application ( anti virus etc. ) or firewall then how do i know it's block? Is bind will return any specific error in this case. I have to know is it blocked or not? (2 Replies)
Discussion started by: Saurabh78
2 Replies

9. UNIX for Dummies Questions & Answers

unix program that can port scan a c block of ips for proxies

can anyone tell me a unix program that can port scan a c block of ips for proxies? a fast one, with reliable results, that can load an ip list, or set an ip range, and specify ports thanks! (1 Reply)
Discussion started by: user
1 Replies

10. IP Networking

block telnet to specific port

Hello All I am running redhat linux 7.2 and would like to know how i can block telnetting to a specified port . say for example i would like to block telnet acesses to port 80. regards Xiamin (5 Replies)
Discussion started by: xiamin
5 Replies
Login or Register to Ask a Question