Question:
How do I redirect a specific port to a different address?
Michael
2015-10-18 15:34:03 UTC
I have set up a server using a free hosting service and it works fine. Now, if someone were to type in my public IP address as if the server was hosted on my network, could I redirect them to the address of the hosting service so that they could use my public IP to connect to the server even though the server is not hosted on my network? I have done this with my website, so if someone were to type in my public ip in their browser, they would be redirected to the url of my website. I know that for the website it only redirects port 80 and 443, so if there a tool or program out there that I could use to redirect a port (the port for this specific server is 39238) to another url (hostname)? I know how to pet-forward so if i could get this redirect working, i would know how to port forward the port i mentioned above. I have a Mac set up as a small server, is there a tool or software out there that would work on a Mac? If you have any idea, i would like to know or if you know any other methods of doing what i want. The end result i want is for people to be able to use my public Ip to connect to a server outside my network that has a host name. So, not would have to be my IP-->completely different hostname. Thanks for any help,
Michael
Five answers:
Franco
2015-10-18 15:40:51 UTC
Update: Michael, please listen to be very carefully. You SAID, and I quote "I have set up a server using a free hosting service and it works fine." I assume you understand what you said. You have no choice, but to use WHATEVER was given to you.

I clearly said to you in ENGLISH what you have to do. If you don't understand what I said, then there is nothing I can do about it. YOU CANNOT USE YOUR IP. You are using someone else's server, so you have no choice, but to use whatever was given to you, and not your own ip address.



Is there any way that users could instead type in my public IP and be connected to that server? No.







Michael, I think I understand what you want to know.



"but for example, if someone typed in my IP in a web browser, they would be redirected to my website (which is not in my network)"



If someone typed your ip, then they would be trying to access your network. Your better off using someone else's ip, server, and you put your website on a server that's not used with your network.



You won't have to concern yourself with making any redirections if you take my advice.
efflandt
2015-10-18 18:51:16 UTC
What web server are you running on the Mac and why such is it on such an odd port 39238. Because it is not the default port 80, that means that for someone to access it they would need a ":39238" suffix on your public IP address, then that port needs to be port forwarded to your server. The web server would need to be configured to redirect an request for that public_IP:39238 in the Host header (or all requests) to your hosted website.



Example for apache web server: https://httpd.apache.org/docs/2.4/mod/mod_alias.html#redirect
Michael
2015-10-18 15:48:04 UTC
but for example, if someone typed in my IP in a web browser, they would be redirected to my website (which is not in my network)
?
2015-10-19 13:26:52 UTC
http://jensd.be/343/linux/forward-a-tcp-port-to-another-ip-or-port-using-nat-with-iptables

Might be worth a shufti, limit of knowledge now, regards, Bob UK.
2015-10-18 15:52:17 UTC
Why would you want anyone typing your own public IP? Qhat a useless idea.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...