Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When I tried to connect to Ubuntu 13.04 from OS X via SSH in home, I can successfully connect to it. But I just got to know that when I tried to connect while I'm out of home, then I got the following error: ssh: Could not resolve hostname myhostname: nodename nor servname provided, or not known. It looks like the cause is two machines reside in different network here, I think. When I tried to search on the Web, I saw IP address is conflicted. However, I can't understand what it means nor I don't know it truly causes the problem here in the first place. So how can I solve for the issue here? I think it requires some sort of manual settings on the part of Ubuntu before I connect, if I interprets it correctly.

So how can I fix the issue? And can I connect while I'm out too? (which I believe I can, but am not completely sure...)

Thanks.

share|improve this question
    
First of all, yes you can. Now. Did you already configure your Server's Firewall to allow incoming petitions from LAN/WAN on port 22? Did you route the external petitions to port 22 to the proper IP/Device? That's important because of maybe your petitions from outside aren't arriving to the proper place. Please let us know what have you done in order to allow the external incoming SSH connections. Thank you. –  Geppettvs D'Constanzo Aug 14 '13 at 23:05
    
What exactly is the hostname you're trying to connect to? There are many requirements to access the machine from outside its network? (1) You need to configure it to allow connections from outside. (2) You need to find out your public IP. (3) You need to configure your router/gateway to forward port 22 to the machine. (4) You need to register the IP address in DNS servers to access it using the hostname. Where did you see on the web "IP address is conflicted"? –  Alaa Ali Aug 14 '13 at 23:14
    
Instead hostname, how about using IP? Does it connect? Whenever your are near the server (I mean, in the same network) you can connect? If you check with an external providers does the port 22 appears open? If some misconfiguration persist in your network, and you can't be physically present to configure the router, you may not access your server. –  Braiam Aug 14 '13 at 23:16
    
Let me reply in step-by-step. First I just changed my server's settings by sudo ufw default deny, sudo ufw allow 22, and finally sudo ufw enable and then tried to connect from different network, then failed (same error message as above). I'm not sure whether those sets of commands are ones that I should run though... –  user2360798 Aug 15 '13 at 0:33
    
When I tried to connect by ssh usename@127.0.0.1, then I got ssh: connect to host 127.0.0.1 port 22: Connection refused. I don't know what is public IP, but maybe 127.0.0.1? (which I got from running ifconfig. –  user2360798 Aug 15 '13 at 0:36

1 Answer 1

This is not an answer, but I have more to say than fits in a comment. The beast you're trying to tame can be tamed, but it's way bigger than you're thinking, as you stand with your hand on the end of its tail. I don't know how to get you on its back, but I can describe its butt, which you haven't yet laid hands on.

First things. That address you got, 127.0.0.1, that's not your address. Try this command, similar but less noise: ip -f inet a. You'll see probably two short groups. Ignore the group that says LOOPBACK 127.0.0.1. Look in the other, for a line with any other set of numbers. Look for a line that reads something like "inet 192.168.100.1/24". That's your address. Not the /24 part.

Time for a pause. Who else has that address? Everybody has that address. Walk out on your balcony, put your hand on your brow, squint, count. How many other balconies do you see? Behind every single one of them is another computer with that same address. Every single apartment. Except that guy on the bottom floor, polishing his Harley on his patio. He has that address and two others.

Like most folks, you probably have a WiFi router that sets up a little internet fiefdom for your private amusement. It's from there that your inet address comes from, and it works only within your private fiefdom. Just like Harley and everybody else. The whole internet is broken up into cells this way.

What you want, you want a global presence so you, and anybody in Latvia, can find your home server from anywhere in the world. That takes more work than plugging in a WiFi router. There are several approaches. A service like managed DNS is probably your most attractive option. No-ip for example offer a free service geared toward home users. That's not your next step.

I hesitate to recommend a service, but there it is. I hesitate, because you're about to get kicked, reaching for the butt. Kicked hard. The 'net is lousy with bad guys who are always probing for fresh new virgin computers to stand up and peek outside their little fiefdoms, ready for a good beating. You opened up port 22 to the world. That's the red neon light port. Put your computer on the global net that way, and you will be probed and discovered.

I had the neatest experience back in the '90s. For a time there, there was a known exploit that allowed Windows XP to be hijacked without doing anything at all. You didn't have to run a program or browse a website. Just jack your box in to the net. The funny thing was, base XP was vulnerable, but SP3 was not, if I recall correctly. But the CD was base, and you installed SP3 from the 'net. Yeah. I installed base XP, jacked in to upgrade to SP3, and in minutes I was infected. Fantastic.

It's usually not that bad, and Linux is safer than that, for all we know. But you opened port 22 to the world. No one ever does that. Do you have a good, strong, user password? A really good, strong password? Do you have a root account? Have you disabled root login over SSH? Have you disabled ssh password authentication altogether, opting for public key login? What services do you have running? Have you cut them back to a minimal set? Do you have active SELinux/AppArmor profiles for them?

Honestly you're probably still safe enough, because your WiFi router surely has a firewall that prevents SSH attempts from outside, and just protected you from yourself. Don't disable that just yet. I'm not expert on this stuff by any means. This is just the basics. Stricter Defaults on help.ubuntu.com might be a good introduction to this topic, but you'll want to read and understand more than that, before contacting No-ip.

share|improve this answer

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.