Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22

Thread: Why can't I ssh by name?

  1. #11
    Join Date
    Jul 2006
    Beans
    261

    Re: Why can't I ssh by name?

    Quote Originally Posted by TheFu View Post
    Exactly how does the router have this information? Is it running DNS?
    When I did the Ubuntu installation I was asked for a hostname. Here I entered "mypc". When I loging on my router I can see the IP Address given to "mypc" and "mypc" written next to this. If I delete this entry a different IP Address is given to "mypc" and again "mypc" is written next to this. If I change the hostname (let say to "mypc2") and I delete the entry (from router), mypc2 gets a new IP Address with (now) "mypc2" written next to this. So I guess the name is being provided to the router by mypc once a connection is establish (ip provided).

    Mine is a small network (4 pc tops) and I am doing this mostly to learn. I could use static ips (either configure this from "mypc" or else the router itself). I had done this in the past. However this time round I would like to be able to access the machines with their name rather then IP Address. You said "setup DHCP reservations and DNS on your router"; To my knowledge DHCP means I get provided an IP Address by the router different each time. This works as I do get an IP Address. DNS means being able to associate a name with that IP Address. This also seems to be working as when I login to the router I can see the name next to the IP Address.

    Are there any logs I can look into to see what is going on when I enter "ssh sim085@mypc" to see if for example router is not returning any information or it is a question of my machine not asking the router for this information?

  2. #12
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Why can't I ssh by name?

    "DHCP Reservation" - this uses MAC addresses to set the same IP for the same network adapter always. Effectively, static IPs.

    The DHCP lease time can be changed too - 7 days is common for a small network. If the device is on when the lease expires, then it will get the same IP again.

    The PC provides the hostname it has to the router as part of the DHCP protocol. This data may or may not be used - suppose it depends on the router software. With DHCP reservations, the MAC address is **always** used.

    ssh has verbosity settings
    ssh -vvvv user@server
    and the server side daemon has debug levels in the config file. These will be written to syslog/auth.log like always. Handy to look at if there are issues.

  3. #13
    Join Date
    Feb 2011
    Location
    Coquitlam, B.C. Canada
    Beans
    3,521
    Distro
    Ubuntu Development Release

    Re: Why can't I ssh by name?

    To me, it sounds like your router has DNS, but your Ubuntu box isn't using it. What does /etc/resolv.conf contain? Mine contain the address of my local DNS (which is also the address of my DHCP server) on the "nameserver" line.
    Any follow-up information on your issue would be appreciated. Please have the courtesy to report back.

  4. #14
    Join Date
    Jul 2006
    Beans
    261

    Re: Why can't I ssh by name?

    That file contains;

    nameserver 8.8.8.8,
    nameserver 192.168.1.254

    192.168.1.254 is the IP Address I use to access my router.

    Quote Originally Posted by Doug S View Post
    To me, it sounds like your router has DNS, but your Ubuntu box isn't using it. What does /etc/resolv.conf contain? Mine contain the address of my local DNS (which is also the address of my DHCP server) on the "nameserver" line.

  5. #15
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Why can't I ssh by name?

    The comma is a problem. Delete it.
    You probably want to swap the order so the router is first. Should make all things a little faster.

    Does the file say that you shouldn't edit it at the top? If so - read what it says and follow those instructions to make changes.

  6. #16
    Join Date
    Feb 2011
    Location
    Coquitlam, B.C. Canada
    Beans
    3,521
    Distro
    Ubuntu Development Release

    Re: Why can't I ssh by name?

    Myself, I would get rid of the 8.8.8.8 nameserver, and let your router DNS take care of upstream requests when needed.
    However, and as TheFu mentioned, the first step is to determine how your resolv.conf file is made.
    Did you mention which version of Ubuntu you are using? It matters because things have changed in the last few years.

    I suspect your router DNS entry is coming from your DHCP lease request. You can check via the /etc/dhcp/dhclient.conf file, see if domain-name-servers is included in the request, it is by default. Here is mine (which is not the default)
    Code:
    request subnet-mask, broadcast-address, time-offset, routers,
            domain-name-servers;
    Any follow-up information on your issue would be appreciated. Please have the courtesy to report back.

  7. #17
    Join Date
    Jul 2006
    Beans
    261

    Re: Why can't I ssh by name?

    I do not remember editing it. In fact I have removed the comma from the file but each time I am restarting I am getting that comma back
    It says generated by resolveconf(8). There is a directory /resolveconf. Had a look but cannot find from where 8.8.8.8 is coming from.

    EDIT:
    I did a fresh install which /etc/resolv.conf does not have that 8.8.8.8 entry and I can ssh with host name from that so it seems that is the culprit. This was an old installation. Cannot remember from where that 8.8.8.8 came from.


    Quote Originally Posted by TheFu View Post
    The comma is a problem. Delete it.
    You probably want to swap the order so the router is first. Should make all things a little faster.

    Does the file say that you shouldn't edit it at the top? If so - read what it says and follow those instructions to make changes.
    Last edited by sim085; April 30th, 2015 at 09:11 PM.

  8. #18
    Join Date
    Feb 2011
    Location
    Coquitlam, B.C. Canada
    Beans
    3,521
    Distro
    Ubuntu Development Release

    Re: Why can't I ssh by name?

    What version of Ubuntu are you using?

    Look in /etc/network/interfaces. It could also be forced via a prepend statement in /etc/dhcp/dhclient.conf.
    Any follow-up information on your issue would be appreciated. Please have the courtesy to report back.

  9. #19
    Join Date
    Jul 2006
    Beans
    261

    Re: Why can't I ssh by name?

    Originally I had Ubunti 12.04 but had upgraded to 14.04.

    In /etc/network/interfaces I have the following entry:

    "dns-nameservers 8.8.8.8, 192.168.1.254"


    Quote Originally Posted by Doug S View Post
    What version of Ubuntu are you using?

    Look in /etc/network/interfaces. It could also be forced via a prepend statement in /etc/dhcp/dhclient.conf.

  10. #20
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Why can't I ssh by name?

    That's where the comma is coming from - delete it - generally I would have 2 separate lines, but I've seen it both ways. Don't know if one way is better than the other.

Page 2 of 3 FirstFirst 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •