我的本地网络中有两台 Ubuntu 机器 A 和 B。
计算机 B 有一个通过 KVM 设置的 openmediavault 实例。
计算机 B 的 IP 地址为 192.168.177.58,openmediavault 实例提供了一个服务,我可以在浏览器中通过以下地址访问该服务http://192.168.122.153:3670。
我无法在 A 的浏览器中访问该地址;但可以在 B 的浏览器中访问。
我如何从A的浏览器访问openmediavault实例的服务?
这是我的网络设置:
在计算机B的控制台中,我可以看到:
$ sudo ufw status
Status: inactive
在计算机A的控制台中显示:
$ sudo ufw status
Status: active
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
3389/tcp ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
3389/tcp (v6) ALLOW Anywhere (v6)
机器A的输出ip r
是:
$ ip r
default via 192.168.177.1 dev wlan0 proto dhcp metric 600
169.254.0.0/16 dev wlan0 scope link metric 1000
192.168.7.0/24 dev vmnet1 proto kernel scope link src 192.168.7.1
192.168.95.0/24 dev vmnet8 proto kernel scope link src 192.168.95.1
192.168.177.0/24 dev wlan0 proto kernel scope link src 192.168.177.21 metric 600
对于机器B:
$ ip r
default via 192.168.177.1 dev enp1s0 proto dhcp metric 100
169.254.0.0/16 dev virbr0 scope link metric 1000
192.168.100.0/24 dev virbr1 proto kernel scope link src 192.168.100.1 linkdown
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1
192.168.177.0/24 dev enp1s0 proto kernel scope link src 192.168.177.70 metric 100
在KVM的网络部分可以看到如下设置:
并可以添加一个新的网络适配器,但我不确定这是否有帮助:
A 上的输出ip addr show
:
$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
link/ether 28:d2:44:b7:53:7b brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether e8:2a:ea:b6:41:bc brd ff:ff:ff:ff:ff:ff
inet 192.168.177.21/24 brd 192.168.177.255 scope global dynamic noprefixroute wlan0
valid_lft 846831sec preferred_lft 846831sec
inet6 fe80::ea2a:eaff:feb6:41bc/64 scope link noprefixroute
valid_lft forever preferred_lft forever
4: vmnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000
link/ether 00:50:56:c0:00:01 brd ff:ff:ff:ff:ff:ff
inet 192.168.7.1/24 brd 192.168.7.255 scope global vmnet1
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fec0:1/64 scope link
valid_lft forever preferred_lft forever
5: vmnet8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000
link/ether 00:50:56:c0:00:08 brd ff:ff:ff:ff:ff:ff
inet 192.168.95.1/24 brd 192.168.95.255 scope global vmnet8
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fec0:8/64 scope link
valid_lft forever preferred_lft forever
ip addr show
B上的输出:
$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 88:ae:dd:0f:f3:b5 brd ff:ff:ff:ff:ff:ff
inet 192.168.177.70/24 brd 192.168.177.255 scope global dynamic noprefixroute enp1s0
valid_lft 797182sec preferred_lft 797182sec
inet6 fe80::42ea:dead:571a:66aa/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: wlp0s20f3: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether f8:9e:94:e2:f5:c7 brd ff:ff:ff:ff:ff:ff
10: virbr1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:db:9f:16 brd ff:ff:ff:ff:ff:ff
inet 192.168.100.1/24 brd 192.168.100.255 scope global virbr1
valid_lft forever preferred_lft forever
19: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 52:54:00:85:b6:9e brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
22: vnet13: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master virbr0 state UNKNOWN group default qlen 1000
link/ether fe:54:00:e4:1b:11 brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fee4:1b11/64 scope link
valid_lft forever preferred_lft forever
答案1
根据其路由表,“A”访问 192.168.122.0/24 的唯一方式是通过默认路由 (192.168.177.1)。 假设默认路由器没有 192.168.122.0/24 的路由
我无法告诉您如何解决这个问题,因为您没有提供有关物理网络如何与 IP 子网对齐的任何详细信息。
一个非常丑陋(且危险)的黑客行为是在 B 上启用路由,并在 A 上通过 192.168.177.58 添加到 192.168.122.0/24 的路由