这是我在遵循中列出的说明时遇到的问题Asghar Ghori 的 RHEL 8 RHSCA 培训手册。我要使用 VirtualBox 设置 RHEL 虚拟机并将 Putty 连接到它,但是当我这样做时,我遇到连接超时。在第 14 页讨论 VirtualBox 中的虚拟机设置时,“您可能必须...将网络适配器连接到网络下的桥接适配器,以便与 Windows 主机和 Internet 进行双向通信。”
我的 RHEL-VM1 设置如下所示。我将网络适配器 1 从 NAT 更改为桥接。
在第 24 页上提供有关 RHEL 安装的说明时,“转到 IPv4 设置并从“方法”下拉列表中选择“手动”。单击“添加”并输入地址 192.168.0.110、网络掩码 24 和网关 192.168.0.1。”
由于我已经完成安装,因此我可以在下面显示 RHEL VM 网络设置。
根据第 32 页的后续说明,我尝试在主机上使用 Putty 通过以下设置连接到 RHEL VM:
我做错了什么?
根据要求,在Windows主机中打印路由结果。
C:\Users\Sam>route print
===========================================================================
Interface List
9...a8 a1 59 67 74 a4 ......Killer E3100G 2.5 Gigabit Ethernet Controller
15...0a 00 27 00 00 0f ......VirtualBox Host-Only Ethernet Adapter
16...00 ff 8c 98 24 ac ......Private Internet Access Network Adapter
19...84 1b 77 7d 7d 15 ......Microsoft Wi-Fi Direct Virtual Adapter
12...86 1b 77 7d 7d 14 ......Microsoft Wi-Fi Direct Virtual Adapter #2
20...84 1b 77 7d 7d 14 ......Killer(R) Wi-Fi 6 AX1650x 160MHz Wireless Network Adapter (200NGW)
13...84 1b 77 7d 7d 18 ......Bluetooth Device (Personal Area Network)
1...........................Software Loopback Interface 1
===========================================================================
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 10.0.0.1 10.0.0.118 25
10.0.0.0 255.255.255.0 On-link 10.0.0.118 281
10.0.0.118 255.255.255.255 On-link 10.0.0.118 281
10.0.0.255 255.255.255.255 On-link 10.0.0.118 281
127.0.0.0 255.0.0.0 On-link 127.0.0.1 331
127.0.0.1 255.255.255.255 On-link 127.0.0.1 331
127.255.255.255 255.255.255.255 On-link 127.0.0.1 331
192.168.56.0 255.255.255.0 On-link 192.168.56.1 281
192.168.56.1 255.255.255.255 On-link 192.168.56.1 281
192.168.56.255 255.255.255.255 On-link 192.168.56.1 281
224.0.0.0 240.0.0.0 On-link 127.0.0.1 331
224.0.0.0 240.0.0.0 On-link 192.168.56.1 281
224.0.0.0 240.0.0.0 On-link 10.0.0.118 281
255.255.255.255 255.255.255.255 On-link 127.0.0.1 331
255.255.255.255 255.255.255.255 On-link 192.168.56.1 281
255.255.255.255 255.255.255.255 On-link 10.0.0.118 281
===========================================================================
Persistent Routes:
None
IPv6 Route Table
===========================================================================
Active Routes:
If Metric Network Destination Gateway
9 281 ::/0 fe80::10:18ff:fe41:84aa
1 331 ::1/128 On-link
9 281 2601:446:480:db60::/64 On-link
9 281 2601:446:480:db60::1e0b/128
On-link
9 281 2601:446:480:db60:59c8:ac69:ffc7:e87f/128
On-link
9 281 2601:446:480:db60:85d7:342d:e5e5:4049/128
On-link
15 281 fe80::/64 On-link
9 281 fe80::/64 On-link
15 281 fe80::856a:3f4f:d390:4a0e/128
On-link
9 281 fe80::85d7:342d:e5e5:4049/128
On-link
1 331 ff00::/8 On-link
15 281 ff00::/8 On-link
9 281 ff00::/8 On-link
===========================================================================
Persistent Routes:
None
Windows主机上ipconfig/all的结果:
C:\Users\Sam>ipconfig/all
Windows IP Configuration
Host Name . . . . . . . . . . . . : DESKTOP-6KK2N8R
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : hsd1.mn.comcast.net
Ethernet adapter Ethernet:
Connection-specific DNS Suffix . : hsd1.mn.comcast.net
Description . . . . . . . . . . . : Killer E3100G 2.5 Gigabit Ethernet Controller
Physical Address. . . . . . . . . : A8-A1-59-67-74-A4
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IPv6 Address. . . . . . . . . . . : 2601:446:480:db60::1e0b(Preferred)
Lease Obtained. . . . . . . . . . : Wednesday, June 22, 2022 1:33:08 PM
Lease Expires . . . . . . . . . . : Friday, July 8, 2022 3:42:39 AM
IPv6 Address. . . . . . . . . . . : 2601:446:480:db60:85d7:342d:e5e5:4049(Preferred)
Temporary IPv6 Address. . . . . . : 2601:446:480:db60:59c8:ac69:ffc7:e87f(Preferred)
Link-local IPv6 Address . . . . . : fe80::85d7:342d:e5e5:4049%9(Preferred)
IPv4 Address. . . . . . . . . . . : 10.0.0.118(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : Wednesday, June 22, 2022 1:33:07 PM
Lease Expires . . . . . . . . . . : Friday, July 8, 2022 6:33:14 AM
Default Gateway . . . . . . . . . : fe80::10:18ff:fe41:84aa%9
10.0.0.1
DHCP Server . . . . . . . . . . . : 10.0.0.1
DHCPv6 IAID . . . . . . . . . . . : 346595673
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-28-03-01-9E-A8-A1-59-67-74-A4
DNS Servers . . . . . . . . . . . : 2001:558:feed::1
2001:558:feed::2
75.75.75.75
75.75.76.76
NetBIOS over Tcpip. . . . . . . . : Enabled
Ethernet adapter VirtualBox Host-Only Network:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : VirtualBox Host-Only Ethernet Adapter
Physical Address. . . . . . . . . : 0A-00-27-00-00-0F
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::856a:3f4f:d390:4a0e%15(Preferred)
IPv4 Address. . . . . . . . . . . : 192.168.56.1(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
DHCPv6 IAID . . . . . . . . . . . : 772407335
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-28-03-01-9E-A8-A1-59-67-74-A4
DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
fec0:0:0:ffff::2%1
fec0:0:0:ffff::3%1
NetBIOS over Tcpip. . . . . . . . : Enabled
Unknown adapter Local Area Connection:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Private Internet Access Network Adapter
Physical Address. . . . . . . . . : 00-FF-8C-98-24-AC
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Wireless LAN adapter Local Area Connection* 9:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter
Physical Address. . . . . . . . . : 84-1B-77-7D-7D-15
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Wireless LAN adapter Local Area Connection* 10:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter #2
Physical Address. . . . . . . . . : 86-1B-77-7D-7D-14
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Wireless LAN adapter Wi-Fi:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . : hsd1.mn.comcast.net
Description . . . . . . . . . . . : Killer(R) Wi-Fi 6 AX1650x 160MHz Wireless Network Adapter (200NGW)
Physical Address. . . . . . . . . : 84-1B-77-7D-7D-14
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Ethernet adapter Bluetooth Network Connection:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Bluetooth Device (Personal Area Network)
Physical Address. . . . . . . . . : 84-1B-77-7D-7D-18
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
答案1
从网络命令的输出来看,您的 Windows 计算机似乎使用 10.0.0.0/24 作为网络,而不是您的指南假设的 192.168.0.0/24。如果您将所有位置的 192.168.0.110 更改为 10.0.0.110(VM nerwork 配置和 putty 命令),那么这应该会启用连接。
背景
网络路由表视窗世界的一侧设置为将您希望到达 Redhat VM 的数据包发送到路由器,然后发送到 comcast,这会正确地丢弃它们,因为它们来自 RFC1918 保留网络。为您的虚拟机提供 LAN 上的地址将使数据包进入虚拟机。
答案2
我没有声誉点可以作为评论询问,这就是我写这个作为答案的原因。只要 ssh 服务器在 Redhat 虚拟机中运行,就有可能出错的一件事是您在 Redhat 中设置的手动 IP 地址。您需要查看物理机的网络掩码和 IP 地址并进行相应设置。如果您的 IP 地址类似于 192.168.1.xxx,您应该在虚拟机中添加 IP 地址 192.168.1.yyy。否则,您应该添加从您的网络到 192.168.0.0/24 的适当路由。