You are not logged in.

#1 2023-12-08 11:28:54

Kagurazaka Kenji
Member
Registered: 2023-12-06
Posts: 3

[Solved] SSH Connection refused

I am running a clean installation with the latest image in Hyper-V. What happens is that when I try to connect Arch in the VM from Windows (my main system), it fails. Moreover, for that reason I wasn't able to copy and paste from Arch so I have to type the results. Details are:
1. Using Arch Linux 6.6.4-arch1-1 (tty1)
2. Packages are up-to-date with pacman -Syu
3. Pretty much sure that settings in Windows are correct. (ssh worked before)
4. IP address is correct
Arch console

[user@ArchLinux ~]$ ip -brief address
lo          unknown          127.0.0.1/8 ::1/128
eth0        UP               192.168.71.11/24 fe80::8796:5dd:9980:3956/64

Windows console

PS C:\Users\Administrator> ssh -o StrictHostKeyChecking=no user@192.168.71.11
ssh: connect to host 192.168.71.11 port 22: Connection refused

5. UFW Firewall allows ssh port

[user@ArchLinux ~]$ sudo ufw status
Status: active

To                Action       From
--                --           --
22                ALLOW        Anywhere

22/tcp            ALLOW        Anywhere

22 (v6)           ALLOW        Anywhere

22/tcp (v6)       ALLOW        Anywhere

6. Using openssh, service started

[user@ArchLinux ~]$ systemctl status sshd
■ sshd.service - OpenSSH Daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; preset: disabled)
   Active: active (running) since Fri 2023-12-08 16:20:45 CST; 1h 51min ago
   Main PID: 316 (sshd)
   Tasks: 1 (limit: 4674)
   Memory: 2.9M
   CPU: 10ms
   CGroup: /system. Slice/sshd.service
           ↳316 "sshd: /usr/bin/sshd -D [listener] 0 of 10- 100 startups"

Dec 08 16:20:45 ArchLinux system[1]: Started OpenSSH Daemon.
Dec 08 16:20:45 ArchLinux sshd[316]: Server listening on 0.0.0.0 port 22.
Dec 08 16:20:45 ArchLinux sshd[316]: Server listening on :: port 22.

7. iptables.rules empty

[user@ArchLinux ~]$ cat /etc/iptables/iptables.rules
# Empty iptables rule file
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCPET [0:0]
COMMIT

8. Networking is fine

[user@ArchLinux ~]$ ping bing.com
PING bing.com (13.107.21.200) 56(84) byte of data.
64 bytes from bing.com (13.107.21.200): icmp_seq=1 ttl=115 time=64.1ms
64 bytes from bing.com (13.107.21.200): icmp_seq=2 ttl=115 time=63.9ms
64 bytes from bing.com (13.107.21.200): icmp_seq=3 ttl=115 time=68.4ms
^C
--- bing.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms rtt min/avg/max/mdev = 63.858/65.446/68.413/2.099 ms

9. No desktop environment installed yet, only a few crucial packages are installed

Does anyone have any idea of what I am doing wrong?

Last edited by Kagurazaka Kenji (2023-12-09 00:46:26)

Offline

#2 2023-12-08 13:07:04

-thc
Member
Registered: 2017-03-15
Posts: 473

Re: [Solved] SSH Connection refused

Well - since your Arch VM has a virtual network adapter connected to a virtual (Hyper-V) switch - it depends on how this connection allows incoming packets.

Offline

#3 2023-12-08 13:21:11

seth
Member
Registered: 2012-09-03
Posts: 48,344

Re: [Solved] SSH Connection refused

I wasn't able to copy and paste from Arch

You can feed output directly into a pastebn service (1st link below) oir redirect it into a file and eg. usb-walk that to a system w/ gui and internet.

The most interesting part is probably the sshd config

tail -n10000  /etc/ssh/sshd_config* /etc/ssh/sshd_config*/* | curl -F 'file=@-' 0x0.st

"ping bing.com"

ping 192.168.71.11

would be way more relevant.

Offline

#4 2023-12-09 00:43:41

Kagurazaka Kenji
Member
Registered: 2023-12-06
Posts: 3

Re: [Solved] SSH Connection refused

-thc wrote:

Well - since your Arch VM has a virtual network adapter connected to a virtual (Hyper-V) switch - it depends on how this connection allows incoming packets.

I am pretty sure that the windows end has no problem since ssh worked before installation (booting from img). But still reset the adapter. The ip changed to

[user@ArchLinux ~]$ ip -brief address
lo          unknown          127.0.0.1/8 ::1/128
eth0        UP               127.22.33.66/20 fe80::8769:5dd:9980:3956/64

And surprisingly, ssh worked!

PS C:\Users\Administrator> ssh user@172.22.33.66
user@172.22.33.66's password:
Last login: Sat Dec  9 08:25:30 2023 from 172.22.32.1
[user@ArchLinux ~]$

Still pretty odd though previous adapter settings worked before installing arch(before disk partioning, grub, all the way to a clean disk). Figured that maybe installing Arch changed the ip or blocked connection? Curious about that smile

seth wrote:

You can feed output directly into a pastebn service (1st link below) oir redirect it into a file and eg. usb-walk that to a system w/ gui and internet.

Wasn't expecting sshd to be the cause, most options are in default:

==> /etc/ssh/sshd_config <==
# Include drop-in configurations
Include /etc/ssh/sshd_config.d/*.conf

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/sbin:/usr/local/bin:/usr/bin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile	.ssh/authorized_keys

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
#KbdInteractiveAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the KbdInteractiveAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via KbdInteractiveAuthentication may bypass
# the setting of "PermitRootLogin prohibit-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and KbdInteractiveAuthentication to 'no'.
#UsePAM no

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# override default of no subsystems
Subsystem	sftp	/usr/lib/ssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#	X11Forwarding no
#	AllowTcpForwarding no
#	PermitTTY no
#	ForceCommand cvs server

==> /etc/ssh/sshd_config.d <==

==> /etc/ssh/sshd_config.d/99-archlinux.conf <==
# sshd_config defaults on Arch Linux
KbdInteractiveAuthentication no
UsePAM yes
PrintMotd no
ping 192.168.71.11

would be way more relevant.

On Windows it gives me a Connection Blocked before resetting adapter.
Now it works with

PS C:\Users\Administrator> ping 172.22.33.66

Pinging 172.22.33.66 with 32 bytes of data:
Reply from 172.22.33.66: bytes=32 time<1ms TTL=64
Reply from 172.22.33.66: bytes=32 time=1ms TTL=64
Reply from 172.22.33.66: bytes=32 time=1ms TTL=64
Reply from 172.22.33.66: bytes=32 time<1ms TTL=64

Ping statistics for 172.22.33.66:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 1ms, Average = 0ms

And from the linux end to ping windows, connection is cut.Don't whether it is fine or not.

[user@ArchLinux ~]$ ping 172.29.176.1
PING 172.29.176.1 (172.29.176.1) 56(84) bytes of data.
^C
--- 172.29.176.1 ping statistics ---
13 packets transmitted, 0 received, 100% packet loss, time 12155ms

Still thanks! The problem should be solved now.

Offline

Board footer

Powered by FluxBB