我正在尝试从我的 ubuntu VM2 到 ubuntu VM1 的 ssh。Ping 正常工作,ssh 处于活动状态,ufw 也处于活动状态。但是 ssh 命令超时。
Machine2 的状态如下:
osboxes@osboxes:~/virt-utils$ ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.12 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::b5a8:7e0f:1980:254f prefixlen 64 scopeid 0x20<link>
ether 08:00:27:31:40:2c txqueuelen 1000 (Ethernet)
RX packets 388285 bytes 563502310 (563.5 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 99408 bytes 10177352 (10.1 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 2009 bytes 281204 (281.2 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2009 bytes 281204 (281.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
osboxes@osboxes:~/virt-utils$ sudo ufw status
[sudo] password for osboxes:
Status: active
osboxes@osboxes:~/virt-utils$ service sshd status
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled;
Active: active (running) since Sun 2019-11-17 12:41:19 ES
Docs: man:sshd(8)
man:sshd_config(5)
Process: 29449 ExecStartPre=/usr/sbin/sshd -t (code=exited
Main PID: 29466 (sshd)
Tasks: 1 (limit: 4544)
Memory: 1.2M
CGroup: /system.slice/ssh.service
└─29466 /usr/sbin/sshd -D
Nov 17 12:41:19 osboxes systemd[1]: Starting OpenBSD Secure
Nov 17 12:41:19 osboxes sshd[29466]: Server listening on 0.0
Nov 17 12:41:19 osboxes sshd[29466]: Server listening on ::
Nov 17 12:41:19 osboxes systemd[1]: Started OpenBSD Secure S
lines 1-16/16 (END)
osboxes@osboxes:~/virt-utils$
有人请指导我如何解决这个问题。我在所有虚拟机上使用桥接网络。
祖尔菲。
要允许 ssh,请运行
这将允许 ssh (22) 的默认端口。
有关更多信息,DigitalOcean 有一个相当好的 UFW 指南。