Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I have one Linux machine with many services which needed to be accessed from outside users, each service has one port, how can i make all these service be accessible by one external public IP?
Thank you.
Based on this description ...
A few VMs on Linux server machine and each using Internal IP which wanna each VM service accessible from outside via one public IP.
The solution is to set up the linux server (running the hypervisor) to use iptables, and then configure iptables to forward connection requests to specific ports on the external IP through to some port on the appropriate internal IP.
Here's a more detailed description:
https://www.digitalocean.com/community/tutorials/how-to-forward-ports-through-a-linux-gateway-with-iptables
There many other relevant sources if you Google for "iptables port forwarding".
On your router you will need to enable port forwarding or NAT. For each internal port on your Linux Machine, you will create a port forwarding to the name port number and IP address of the Linux Machine on the router.
For example, if you want outside users to connect to the Linux Machine with IP address 192.168.1.20 via port 80 (web), then on the router you will create a port forward that opens the external port 80 and forwards this to IP Address 192.168.1.20 on port 80 as well. So if someone from the outside wanted to connect to the Linux Machine, they would use your PUBLIC IP Address using port 80.
You don't always have to match the outside port with the internal port but it does make it easier to setup and for applications to recognise ie web browsers that use port 80 by default.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I am doing my hw on this page: https://www.isi.deterlab.net/file.php?file=/share/shared/Softwareexploitsexercise/index.html#dassign
In the second task, I don't really know how to do the following:
If you have set up ssh tunneling to port 80 via local port 8118 (a
good idea), the memo application can be accessed at
http://localhost:8118/cgi-bin/memo.cgi
How to set up ssh tunneling to port 80 via local port 8118? Is that certain command in terminal? Could you tell me how to do? The whole operation should be done in shell because it is on certain platform.
This ssh feature is called port forwarding.
Local port forwarding listens to the port on local machine and forwards it via the connection to specified destination:
ssh -L 8118:localhost:80 ssh-server
In the example it forwards the port from client machine to localhost of the remote server but you can specify any destination you want. I assume the http server runs on that server.
Remote forwarding does the opposite, i.e. listens on port on remote server and forwards via ssh to specified destination:
ssh -R 8118:localhost:80 ssh-server
Again, it doesn't have to be localhost. It can forward the port 8118 on ssh-server to any destination accessible from the client machine.
Both forwardings are useful when the service is not directly accessible from the remote destination, either because of firewall, visibility or simply the service running on localhost only.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I have an OpenVPN server running on my Linux box and it's working fine. The server has a lot of IP addresses but it only uses one for all the clients (of course).
Is it possible to use multiple IP addresses (public) on the same server?
If you post this question on ServerFault, this post will get more eyeballs.
OpenVPN can listen on multiple IP addresses. The directive local sets the IP address(s) it listens on. Here is an excerpt from OpenVPN man page.
--local host
Local host name or IP address for bind. If specified, OpenVPN will bind to this address only. If unspecified, OpenVPN will bind to all interfaces.
Watch out if you have multiple public IP addresses on multiple interfaces. You may have to resort to some sort of port forwarding. Probably you should make OpenVPN listen on a single interface, preferably local interface and port forward traffic coming from various public IP's to this Interface.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I purchased a domain through Amazon Route 53 and am hosting my Node.js/ExpressJS app on an Amazon Linux EC2 Instance server. I can get my site to run on my EC2 server by using the public IP:portNumber or by using the publicDNS:portNumber, but I am struggling to understand how to set up the record sets in the hosted zone section of the Route 53 console to have my website point to www.thedomainipurchased.com:portNumber. I also read somewhere that you can't add the port number onto the public ip like that, so I would like to know how to set up both records to do this. I'm new to DNS, which is why I've had such a hard time although I'm sure to some people this seems very simple so would really appreciate any feedback to be explained in as basic and simple of a way as possible. Record Set Picture here
DNS only provides a way to map names to the IP addresses of hosts. Except under very limited circumstances you can't include a port number. DNS simply isn't designed to do that.
Ports are determined by the protocol involved. If you use a web browser to connect via HTTP then it will default to using port 80. If you use a web browser to connect via HTTPS then it will default to using port 443. When you send e-mail the default port is 25. When you SSH into a server the default port is 22. And so on. Default ports are essentially part of the specification for the global internet.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I would like to know how to make my Linux Server accesible for anyone around the world. I currectly can access it via 192.168.1.22 locally on my network. I would like it to be accesible through and IP or a domain name.
If you are wanting all ports to be accessible then you can make the box a DMZ on your router and set a static IP, then you are done. If you want it to be accessible through SSH which is what I am going to assume, then you need to set a static IP for the box forward the internal IP address and port in your router and then optionally set up DDNS settings if available. At that point you will be able to access the box from any public network. If you need help let me know.
Either get a static IP address from your Internet Service Provider, or use Dynamic DNS to map a domain name to a dynamic IP address.
One well known Dynamic DNS provider is NoIP
http://www.noip.com/free/
In any case, you probably have a NAT "firewall" that blocks all incoming traffic, so you'll need to configure the firewall to allow ports through that you want to server. Typical Linksys / Netgear NAT firewalls / Wifi routers allow you to port forward to a single private IP address.
Finally, you should make sure your ISP allows running a server. Though most of them dont mind, because the upload speed is throttled by design, you still want to check the terms of service.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
So I've been scouring the internet for days trying to figure this out and can't figure it out.
I know its going to be an easy one.
So I recently took an old desktop and loaded ubuntu server 12.04 on it. My goal with this project is to create an area to host a few git repositories and maybe a simple webpage.
I've installed both the SSH and Apache2 packages and tried to configure them. Right now I can log in from my laptop using ssh greg#0.0.0.0.0 but only while I am on the same network. Once I leave the house I get a timeout error.
So 2 things I would like to get at right now.
How to configure the SSH to allow me to access the server from outside the network.
Get my host name on the server so logins will be greg#hostname instead of greg#0.0.0
(I've done sudo hostname and changed the etc/hostname file and no results)
Thanks guys.
The timeout external to your home network occurs because the IP you specified will be routed elsewhere on external networks.
As others have indicated, you need to configure port forwarding on your router (external interface) to the SSH server. You can either use the standard port (22) or any alternative port (something above 1024). For the webserver you will need to set the port forwarding from port 80 on the external interface to your server and maybe port 443 if you want to include SSL/TLS connections.
I also recommend using the SSH config file (~/.ssh/config) to make it easier when making either an internal or external connection. Add something like this:
Host serverext
Hostname 1.2.3.4
User greg
Port 22
Host serverint
Hostname 192.168.1.10
User greg
Port 22
Change the Hostname for the serverext config to the IP address of your Internet connection. If you use a non-standard port for the external SSH connections then change the port field for serverext to match that.
Change the Hostname for the serverint config to the internal IP address for that server on your network.
Once this is configured, in conjunction with the port forwarding you will be able to use "ssh serverint" to connect to your server when you're at home and "ssh serverext" to connect to it when you're somewhere else.
It is possible to include advanced configuration options through the SSH configuration file, such as port tunneling and websocket connections. In the past I've done things like that and redirecting SSH connections through SOCKS proxy servers. I've even had it run through Tor, but it is very slow.