-5

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

6
  • I would suggest making your question way more clear. Your missing about 80% of the information needed to answer it.
    – Jeroen
    Jun 29, 2015 at 13:05
  • @Jeroen, sorry if i wasn't clear, i'll update the question.
    – thclpr
    Jun 29, 2015 at 13:06
  • I think he wants to have access from IP1 (from 80 or 443) to IP2 (on 443) using ssh protocol.
    – cemdorst
    Jun 29, 2015 at 13:17
  • English isn't my primary language... so that's why i cant make myself very clear :\.
    – thclpr
    Jun 29, 2015 at 13:35
  • @cemdorst nop, basically i want to have ssh running under port 443 from the secondary ip, since the primary ip have a nginx server using 443.
    – thclpr
    Jun 29, 2015 at 13:37

2 Answers 2

2

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.

0

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 ?

Not the answer you're looking for? Browse other questions tagged .