cancel
Showing results for 
Search instead for 
Did you mean: 
jeesshnasree
Starfighter Starfighter
Starfighter
  • 16.7K Views

how to resolve port conflict issues

 
4 Replies
Jayadev
Flight Engineer Flight Engineer
Flight Engineer
  • 16.7K Views

The best way to resolve the port issue is to find an alternative unused port and map it to the application. This is more to do with the design of the application. As an example if port 80 is already in use by a web application  then one can choose 8080 for another web application.

There may be other design points to be considered before a port is assigned to an application. 

0 Kudos
Tracy_Baker
Starfighter Starfighter
Starfighter
  • 16.6K Views

There may be other design points to be considered before a port is assigned to an application. 

This is almost an understatement. A few things to take into consideration:

  • Is the server's firewall configured to allow the new port?
  • Is the application to be accessed from clients outside of the network? In this case, it is entirely possible that another, most likely hardware based, firewall will need to be configured to allow the traffic (in addition to the server's firewall).
  • Is SELinux configured to allow the non-standard port?
    • For example: SELinux does not allow 8080 traffic by default for httpd (see the http_port_t type context).
Program Lead at Arizona's first Red Hat Academy, est. 2005
Estrella Mountain Community College
0 Kudos
JamieFargen
Mission Specialist
Mission Specialist
  • 16.7K Views

Jayadev-

I am not sure if your example of choosing port 8080 for another "web application" is a great example, because web servers support name-based virtualhosting. For example in Apache "name-based virtual hosting, the server relies on the client to report the hostname as part of the HTTP headers. Using this technique, many different hosts can share the same IP address."

Here is an example name-based virtual config from the Apache site:

<VirtualHost *:80>
    # This first-listed virtual host is also the default for *:80
    ServerName www.example.com
    ServerAlias example.com 
    DocumentRoot "/www/domain"
</VirtualHost>

<VirtualHost *:80>
    ServerName other.example.com
    DocumentRoot "/www/otherdomain"
</VirtualHost>


Regards,
Jamie Ian Fargen

 

0 Kudos
williamwlk
Flight Engineer Flight Engineer
Flight Engineer
  • 16.6K Views

Hi @jeesshnasree

 

You don't give us any background info on the issue so I will try and shoot in the blind and give you some idea in different context:

It is a good thing that you know you have a port conflict issue. If not yet, comb through the relevant logs and you will see the port binding error as clear as crystal.

How to resolve it?

- If you wanna find out the port in question is being used by which program:

# netstat -anp | grep <port_number> | grep LISTEN 

E.g # netstat -anp | grep 8080| grep LISTEN

-a for all, -n for numeric and -p for program using the port

OR

# lsof -i :<port_number>

E.g # lsof -i :8080

-i for internet address and port stuff

And fix the application or shut the App down (or KILL if you must) if you need to own the port :)

Hope this helps.

Regards,
Will

0 Kudos
Join the discussion
You must log in to join this conversation.