I installed the latest CentOS 7 version 1611 on a Hyper-V VM with static IP. Network and firewall seem to be set up correctly. Now I am trying to simply log into it remotely from Putty. I get "Connection refused" right away.
As a comparison, I also installed Ubuntu Server separately in the same network with same configuration. I have no problem there.
To troubleshoot, I tried the following 6 things. I am a Linux newbie. I really hope someone can detect something wrong in my outputs below or suggest a new solution.
(1) While being logged into the CentOS VM directly, I watched log with following command before trying to connect with Putty.
tail -f /var/log/messages
However, no messages were registered.
(2) /etc/resolv.conf file has the following content.
# Generated by NetworkManager
nameserver 192.168.1.125
nameserver 75.75.75.75
nameserver 75.75.75.76
The first IP is the IP of DNS server (a Windows 2012 R2 Active Directory Domain Controller with DNS), the last 2 are DNS IPs of ISP. From CentOS VM, pinging to other computers with either IP or fully qualified name works fine. Pinging from other computers into CentOS VM also works using IP or fully qualified name.
(3) curl works fine
curl google.com
Gets me some html data.
(4) Firewall seems to indicate "ssh" is allowed in.
firewall-cmd --list-all
outputs the following (as you can see "ssh" is included in the services)
public (active)
target: default
icmp-block-inversion: no
interfaces: eth0
sources:
services: dhcpv6-client ssh
ports:
protocols:
masquerade: no
forward-ports:
sourceports:
icmp-blocks:
rich rules:
(5) Status of sshd seems to be up and running
service sshd status
outputs the following.
Redirecting to /bin/systemctl status sshd.service
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2017-03-26 23:49:44 EDT; 1h 18min ago
Docs: man:sshd(8)
man:sshd_config(5)
Process: 959 ExecStart=/usr/sbin/sshd $OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 970 (sshd)
CGroup: /system.slice/sshd.service
└─970 /usr/sbin/sshd
Mar 26 23:49:44 localhost.localdomain systemd[1]: Starting OpenSSH server daemon...
Mar 26 23:49:44 localhost.localdomain systemd[1]: PID file /var/run/sshd.pid not readable (yet?) after start.
Mar 26 23:49:44 localhost.localdomain sshd[970]: Server listening on 0.0.0.0 port 22.
Mar 26 23:49:44 localhost.localdomain sshd[970]: Server listening on :: port 22.
Mar 26 23:49:44 localhost.localdomain systemd[1]: Started OpenSSH server daemon.
(6) /etc/ssh/sshd_config has the following content
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
SyslogFacility AUTHPRIV
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication yes
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
GSSAPICleanupCredentials no
UsePAM yes
X11Forwarding yes
UsePrivilegeSeparation sandbox # Default for new installations.
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS
Subsystem sftp /usr/libexec/openssh/sftp-server
Output of netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
tcp 0 0 localhost:smtp 0.0.0.0:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
tcp6 0 0 localhost:smtp [::]:* LISTEN
udp 0 0 localhost:323 0.0.0.0:*
udp6 0 0 localhost:323 [::]:*
raw6 0 0 [::]:ipv6-icmp [::]:* 7
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ACC ] STREAM LISTENING 9730 /run/systemd/journal/stdout
unix 2 [ ACC ] STREAM LISTENING 16151 /var/run/dbus/system_bus_socket
unix 2 [ ACC ] STREAM LISTENING 20503 public/flush
unix 2 [ ACC ] STREAM LISTENING 20518 public/showq
unix 2 [ ACC ] STREAM LISTENING 20472 public/pickup
unix 2 [ ACC ] STREAM LISTENING 20478 public/cleanup
unix 2 [ ACC ] STREAM LISTENING 20481 public/qmgr
unix 2 [ ACC ] STREAM LISTENING 14233 /run/lvm/lvmetad.socket
unix 2 [ ACC ] SEQPACKET LISTENING 14243 /run/udev/control
unix 2 [ ACC ] STREAM LISTENING 20500 private/verify
unix 2 [ ACC ] STREAM LISTENING 20506 private/proxymap
unix 2 [ ACC ] STREAM LISTENING 20509 private/proxywrite
unix 2 [ ACC ] STREAM LISTENING 20512 private/smtp
unix 2 [ ACC ] STREAM LISTENING 20515 private/relay
unix 2 [ ACC ] STREAM LISTENING 20521 private/error
unix 2 [ ACC ] STREAM LISTENING 20524 private/retry
unix 2 [ ACC ] STREAM LISTENING 20527 private/discard
unix 2 [ ACC ] STREAM LISTENING 20530 private/local
unix 2 [ ACC ] STREAM LISTENING 20533 private/virtual
unix 2 [ ACC ] STREAM LISTENING 20536 private/lmtp
unix 2 [ ACC ] STREAM LISTENING 20539 private/anvil
unix 2 [ ACC ] STREAM LISTENING 20542 private/scache
unix 2 [ ACC ] STREAM LISTENING 14016 /run/systemd/private
unix 2 [ ACC ] STREAM LISTENING 20485 private/tlsmgr
unix 2 [ ACC ] STREAM LISTENING 20488 private/rewrite
unix 2 [ ACC ] STREAM LISTENING 20491 private/bounce
unix 2 [ ACC ] STREAM LISTENING 20494 private/defer
unix 2 [ ACC ] STREAM LISTENING 20497 private/trace
unix 2 [ ACC ] STREAM LISTENING 14044 /run/lvm/lvmpolld.socket
netstat -I
.Kernel Interface table
Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 1500 8920 0 13 0 518 0 0 0 BMRU
lo 65536 72 0 0 0 72 0 0 0 LRU
netstat -l
above. Thanks.systemd-analyze blame
shows 21 seconds on Kdump, 5 seconds on NetworkManager! I don't know the significance of this but that seems to indicate network performance issues, right? The system is very slow indeed with ping or curl or when trying to install packages. Not sure if this is connected to my original issue of SSH not working. I have none of these issues with Ubuntu Server VM configured the same way. Thanks, I could use any help :)