Results 1 to 6 of 6

Thread: networking ssh issue

  1. #1
    Join Date
    Jul 2023
    Beans
    2

    networking ssh issue

    I am a long time slackware user, who just switched to ubuntu (Ubuntu 22.04.2 LTS). Once installed I renamed the first wired ethernet card to eth0 (simplicity for what I am use to). I can ssh from a windows computer (securecrt) to the lan IP address with no issue. I have a port forward in my internet providers modem/router to the ubuntu ip address. When I try to ssh to my external ip I get "Hostname lookup failed: host not found" I log in to the internal ip and then try to ssh to external ip and it works like a charm. In past set up /etc/hosts /etc/resolv.conf make sure ethernet card was up and working with static ip and routes were correct and it was a done deal. Any help on this matter would be greatly appreciated.

  2. #2
    Join Date
    Jun 2023
    Beans
    19

    Re: networking ssh issue

    When you try to connect, you aren't by chance on the lan network you were describing that works were you? I have seen weirdness with that. Your client system is NATing out to get to the external which is trying to loop back to itself. There are ways to make it work, but I don't think they are usually worth it.

  3. #3
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: networking ssh issue

    You may need to enable IP packet forwarding. By default, Ubuntu and many other distros do not pass packets between interfaces for security reasons.

    Check the file /etc/sysctl.conf and remove the hash mark from
    Code:
    #net.ipv4.ip_forward=1
    to enable forwarding. If you run "sudo sysctl -p" the kernel will read the new configuration. See if it works any better after that.

    If that doesn't help, we'll need to look into routing.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

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

    Re: networking ssh issue

    Some routers think that packets from the LAN side trying to access the WAN port are an attack vector and the router blocks those. Most routers have a way to disable that.

    Rather than describe what you are doing, please post the exact commands and the output. Please use code tags. It is fine to change the public IP, if you like, but leave everything else as is. It would also help if you turn up the verbosity for the connection. For example,

    Code:
    $ ssh -vv username@IP
    What would tell us much.

    Also, if you have any ~/.ssh/config settings that could be impacting the connection, that would be good to know too. I use that file to make ssh connections to different userids, non-standard ports and to remote servers easy. Basically, I never need to actually know those things once I setup a stanza in the config file. All libssh tools honor it - so ssh, scp, rsync, rdiff-backup, x2go, and 50 other tools all honor what is in the ~/.ssh/config file.

  5. #5
    Join Date
    Jul 2023
    Beans
    2

    Re: networking ssh issue

    It seems to be working once I enabled ip packet forwarding.

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

    Re: networking ssh issue

    Quote Originally Posted by krazykanuk36 View Post
    It seems to be working once I enabled ip packet forwarding.
    There are some huge security implications in allowing a router on a Linux system that isn't also a firewall. Please be careful. If you have a router and computers on the same LAN, enabling forwarding isn't required.

Tags for this Thread

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
  •