Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I remember when I was in university, I could remote access individual workstations in the computer lab by specifying p1.someuniversity.edu or p2.someuniversity.edu through ssh.

Now at home I have something like this set up:

  • A static IP: 123.123.321.321
  • A domain: mydomain.com
  • Multiple computers including a homeserver all connected to a router
  • The router is configured with dd-wrt

I am able to remote desktop to the home server using port forwarding on my router and then telling my domain registrar to point www.mydomain.com to my static ip. But what if I want to access other computers on my network? For example if I have a ubuntu desktop on the network, how would I be able to ssh to it through wkst1.mydomain.com? Also, is there a name for the type of network setup that my university computer lab had?

share|improve this question
add comment

4 Answers 4

up vote 2 down vote accepted

URLs are meant to specify three things - a protocol, a host, and the location of a resource on that host - NOT just a host. Not all protocols use URLs or make sense with them, SSH being one of them (SFTP being different, of course).

What you are really asking is how can you give each computer on your network its own externally resolvable domain name.

You are likely a standard residental ISP customer with a single IP given to you by your ISP, with your machines on a private IP range LAN and use a NAT router. So, as aforementioned, you cannot do what your university did - what your university did depends on each machine having its own public IP address, which is possible for universities as some have large IP blocks assigned to them. This isn't going to happen for you as a residential ISP customer, though.

Nothing is stopping you from running your own DNS server at home, telling your router to give out your private DNS server as "the" DNS server and assigning each machine on your network an internally accessible domain name using it. It will work beautifully - within your house (until you want to resolve an external host such as google.com - unless you set up DNS forwarders, but that's another subject).

I have never been too clear on the DHCP "domain" option myself but it doesn't and cannot affect anything reachable from outside your network in this scenario.

For your single public IP you can get a domain name for it, and there are providers such as no-ip.com that give you a free one - you do need to run a client somewhere on your network that updates the provider with changes in your public IP address. I believe no-ip.com lets you have up to two domains pointing to any machine you like. But, if you point them both to your single public IP, they are really pointing to the same place, because domains do not have any concept beyond "this string = this IP address."

So, with things like SSH you are stuck with port forwarding. You have to tell your router to forward incoming traffic on something like TCP 1000 to your first workstaiton's private IP, port 22, and then TCP 1001 to your second workstation's private IP, port 22.

With HTTP, many web servers can do a thing called "reverse proxying" where one URL is actually a front end to a different webserver. So, if you are running a webserver on workstation 1 (i.e. http://mypublicname.no-ip.invalid) - you can configure Apache to reverse proxy something like the directory "workstation2" to a second workstation also running Apache. So then, the end result is that http://mypublicname.no-ip.invalid talks to the webserver on workstation 1, and http://mypublicname.no-ip.invalid/workstation2 tells the webserver on workstation 1 to talk to the webserver on workstation 2, and forward back the result to you. This is protocol specific and I'm not sure too much other than HTTP can be "reverse proxied." You couldn't RDP over an HTTP reverse proxy unless you had some scripts or Apache plugins supporting that.

You also may want to look into an SSL VPN such as Adito aka OpenVPN ALS. It lets you set up tunnels and provides a very nice interface for doing so. It's very convenient and worth the trouble to go through setting up.

share|improve this answer
    
Based on all the answers I have received, I realized that my initial question was based on the (incorrect and naive) assumption that the university computer lab had a similar topology to my home network. I will probably end up using the port fowarding solution that you, John and Hennes have all suggested. Btw, Thanks for the explanation on URLs, that was actually something I was missing in my understanding of networks. –  DaveS Mar 20 '13 at 16:11
add comment

Your University lab was completely standard - there was nothing special about it. In your home situation, you're going through a single IP to get to all your machines, so your starting point is a good one, but then you need to forward alternate ports to other systems. Example: forward port 2022 to port 22 on your Ubuntu desktop, then ssh to the same hostname but port 2022 to get to SSH on your Ubuntu machine. You will be well-served to follow Alex's recommendation and set up static internal DHCP leases in this situation.

share|improve this answer
add comment

You need to enable dnsmasq service and assign static DHCP leases(optional) and domain names for your computers

share|improve this answer
    
So I do have static DHCP leases for the relavent computers, but I never understood what the domain settings in dnsmasq did specifically. If a computer on the network had a hostname "computer1" does that mean I would be able to reference it on the network with computer1.mydomain.com? If I am outside of the network, can I still reference it using computer1.mydomain.com? My gut feeling tells me I won't be able to. –  DaveS Mar 20 '13 at 14:57
    
you still need to connect to your remote desktop server first. then you will be able to use your local DNS names. but not directly from outside –  Alex P. Mar 20 '13 at 15:11
add comment

The computers at your university worked like most of the normal Internet: Each computer has it own unique IP. In addition they configured DNS so that you could connect to a computer on a name base, rather than having to type the IP number.

You can compare this to every person having a phone number, which is listed iba global phone book

You can do something similar at home. However, most home setups only come with a single IP v4 address. That means that you either:

  1. Only use one single computer at the same time, or
  2. You need to do some 'trickery`.

The trickery here is usually NATing. The phone analogy is to have a single phone number. Add a receptionist at the door. Each call is not made to a person in the building, but to the receptionist. You then ask him or her to put you through to one of the internal phones.

Since there is only a single number (single phone number c.q. a single IP) you can not specify a specific person (computer) on the inside by just calling. You need to add some additional trickery. E.g. all calls from phone number A will immediately be put though to sales. All calls from phone number B will immediately be put though to legal, etc etc.

In this case putting the call though is port forwarding.

A connection to your IP:port will be recognised by your firewall and instead of establishing a local connection if will forward it to one of your computers.

Since each combination of IP:port is unique, you can only forward it to a single computer.

If you want to reach multiple computers inside a NATted network, you will have to configure the firewall with several forwarding rules for distinct ports.

Example:
Forward all connections to (my_ip:port_2022) to computer A:, port 22.
Forward all connections to (my_ip:port_3022) to computer B:, port 22.
Forward all connections to (my_ip:port_4022) to computer C:, port 22.

The only potential execption to this is HTTP, since that does not only sent a request to an IP:port, but also mentions a hostname in its package. However this is an exception, most protocols do not mention a destination hostname.

share|improve this answer
    
I did a bit more investigation using a domain-ip translator and you are right, it seems like all the workstations in that computer lab has its on IPv4 address. Using your solution I would connect to my computers using urls like this: www.mydomain.com:2022. Is that correct? Does this mean there is no way to give individual computers their own url without them each having an IP address? –  DaveS Mar 20 '13 at 15:11
    
Either: 1) Give each their own publicly reachable IP address (IP v4 or IPv6) and connect to that. This is the way the internet was designed. Or 2) Redirect all HTTP traffic to a single web server, and let that forward the request based on the host name. (Using the fact that the host name is transmitted in the HTTP request or 3) Use a different port for each computer. (as in the example in the post). –  Hennes Mar 20 '13 at 15:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.