How could use two diferent services using the same port on two diferent IP addresses?
Example:
IP 1 : 192.168.10.10:
Service: Http Server
Ports: 443
IP 2 : 192.168.10.11:
Service: SSH Server
Port: 443
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this communityHow could use two diferent services using the same port on two diferent IP addresses?
Example:
IP 1 : 192.168.10.10:
Service: Http Server
Ports: 443
IP 2 : 192.168.10.11:
Service: SSH Server
Port: 443
If, for example, your IPs are 192.168.10.10
and 192.168.10.11
, and you want sshd
to listen to port 443
on IP1, and httpd
to Listen to port 443
on IP2:
Add to your /etc/ssh/sshd_config
file:
ListenAddress 192.168.10.10:443
and restart SSH. SSH will now listen on port 443 of IP1.
Add to your httpd.conf
file (assuming Apache, should be easy with other httpd servers as well:
Listen 192.168.10.11:443
and restart httpd. Apache will now listen on port 443 of IP2.
You don't mention what OS you are using, or what HTTP server you are using, so you may need to look for exact syntax or file locations for your system.
If you want to segregate IP1 ==> NGINX and IP2 ==> SSHD, I suggest you to turn on NetFilter w/ PREROUTING : Nginx listen on 8443 and SSHD on 22 ; close these ports and PAT the 443 port regarding of the source.
Else, sorry, this isn't possible for one server to have two processes handling one Net socket (TCP/443), because the system couldn't know which process has to handle this or that kind of request.
What I imagine you can do :
* Implement a sort of reverse proxy-like process to handle all requests and reroute it to sushi
or apache
; I'm thinking about the old-fashioned TCPMux with xinetd
, but it appears to be a dirty solution (actually as dirt as your request. Find infos here.
* Far less dirty, implement some web-based SSH panel like Gateone downloadable here.
Hope that it helped ?