WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [Solved] Can't ssh anymore  (Read 2232 times)

Offline Santos

  • Full Member
  • ***
  • Posts: 105
[Solved] Can't ssh anymore
« on: May 08, 2023, 02:30:22 AM »
Hello

I was trying to protect my home network by getting the Cloudfare's DNS server (1.1.1.1) to avoid malware.

But ever since I changed the DNS address on my router I'm unnable to connect to  ssh  server within my LAN network.

Got computer1 with sshd, it works, logging into localhost works.
Computer2 will try to access computer1 through  ssh. But it doesn't work.

I thought the family DNS would be like prohibiting any local IP to be accessed, but I reversed changes (DNS is 0.0.0.) but still cannot connect to any ssh session.

ssh works on both computer, I used a third computer to test connection and it worked but with my tiny core box is not giving any chance.

EDIT:
Coreplus 12 x64
« Last Edit: May 21, 2023, 11:21:34 AM by Rich »

Offline Santos

  • Full Member
  • ***
  • Posts: 105
Re: Can't ssh anymore
« Reply #1 on: May 08, 2023, 10:47:52 PM »
Resolved!

I tried changing different settings but I just unplug the router and plug it back in. :)

Offline gadget42

  • Hero Member
  • *****
  • Posts: 657
Re: Can't ssh anymore
« Reply #2 on: May 08, 2023, 11:03:33 PM »
Resolved!
I tried changing different settings but I just unplug the router and plug it back in.
just to clarify/confirm...you used the electrical supply cord plug to remove and then reconnect to your mains electricity(so a cold-boot for your router unless it has some internal/auxillary power source)?
The fluctuation theorem has long been known for a sudden switch of the Hamiltonian of a classical system Z54 . For a quantum system with a Hamiltonian changing from... https://forum.tinycorelinux.net/index.php/topic,25972.msg166580.html#msg166580

Offline Santos

  • Full Member
  • ***
  • Posts: 105
Re: Can't ssh anymore
« Reply #3 on: May 11, 2023, 07:50:38 PM »
Hello

Yes, a cold boot. I unplug the power cable. Wait ~20 seconds and plug it back in. No internal power source in the router, I checked and there is no battery compartment.

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 661
Re: Can't ssh anymore
« Reply #4 on: May 11, 2023, 09:54:25 PM »
And one more thing, when connecting to the ssh server it will check with reverse dns lookup if the ip correspond to the hostname and it take some time to do that. If you disable that feature first in the sshd_config
with
Code: (bash) [Select]
UseDNS no and start the daemon sshd with -u0, you should see some performance to connect. It doesn't need to timeout.

And one more great fature with sshd you can check what being set with this command.
Code: (bash) [Select]
sudo sshd -T | grep -i UseDNS
You should also see that the sshd server internally not using some uppercase letters in the config.
« Last Edit: May 11, 2023, 09:56:49 PM by patrikg »

Offline Santos

  • Full Member
  • ***
  • Posts: 105
Re: Can't ssh anymore
« Reply #5 on: May 12, 2023, 06:26:09 AM »
@patrikg

1. Does that means that changing the DNS server on my router could block me from accessing other LAN machines if  sshd  not properly set up?

2. If I understand correctly, the DNS lookup that is done by the sshd  server uses the DNS configured on the router, and because I used a Cloudfare 'family' address (1.1.1.2) I could get blocked from local sshd instances, correct?

3. And by setting  UseDNS  to 'no' should be fixing that, right?

EDIT:

I verified and on my machine, the option was set to 'no'.

Code: [Select]
useDNS no
« Last Edit: May 12, 2023, 06:28:19 AM by Santos »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10957
Re: Can't ssh anymore
« Reply #6 on: May 12, 2023, 08:19:02 AM »
Since a router reboot helped, it was likely a router glitch and nothing to do with the DNS.
The only barriers that can stop you are the ones you create yourself.

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 661
Re: Can't ssh anymore
« Reply #7 on: May 12, 2023, 10:30:17 AM »
Like curaga says that not the problem, the problem like you said stays somewhere else. If you started over and the problem was over,,maybe the problem was arp or something else.
And "usedns no", I think this was not default before.

I don't know if the sshd server use the -u0 as start parameter, i don'r know how tc start the sshd.

Offline Santos

  • Full Member
  • ***
  • Posts: 105
Re: Can't ssh anymore
« Reply #8 on: May 20, 2023, 11:14:27 AM »
Hey there.

I did a little troubleshooting on my machine. Turns out it wasn't the router nor the DNS server.

I have a laptop. Sometimes I used it with WiFi and other times with a wired connection.

This is what happened.

I thought that it will be good to avoid any conflicts between internet interfaces, so before I plug the Ethernet cable, I ran the  wifi.sh  utility, it asked me if I wanted to disconnect and rescan and I said 'yes'. But I do not reconnect back again, instead y close the utility (select 'q' as an answer to exit).

I get access to the internet, but I do not know what happens since I'm blocked from accessing ssh server in my LAN.

If instead, just plug the Ethernet cable without messing with the  wifi.sh  script and run  sudo udhcpc  to get internet connection with the  eth0  interface, everything works. Internet and  ssh  connections.

So I'm guessing the  wifi.sh  script does something to the interfaces that allows me to access the internet but somehow routes LAN traffic in an odd way.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10957
Re: Can't ssh anymore
« Reply #9 on: May 20, 2023, 10:31:13 PM »
The default utilities can't handle complex setups like two simultaneous network interfaces, they only expect one. They clear the routes and set new ones.
The only barriers that can stop you are the ones you create yourself.

Offline Santos

  • Full Member
  • ***
  • Posts: 105
Re: Can't ssh anymore
« Reply #10 on: May 21, 2023, 10:30:49 AM »
I'm happy to hear that.

I was doing it that way since I wanted my computer to stay without any internet connection. Just to keep it excluded from the internet when I'm not using my laptop.

So, knowing that by running  sudo udhcpc  is enough to have eth0 up and running is good for me. It means that, after disconnecting the Ethernet cable, my computer will be truly isolated from the internet.

I consider this issue resolved, thank you all for your responses!

Take care. :)