DHCP 中继不会通过 VPN 向客户端发送响应

DHCP 中继不会通过 VPN 向客户端发送响应

我有一台机器(我们称之为设备),它与另一台机器(称之为网关)有 ipsec 连接(VPN)。该设备通过虚拟接口 vti0 隧道连接到网关,大部分情况下一切正常。在网关一侧,我有一个 dhcp 服务器,我已将其配置为将一个 ip(在网络 11.2.0.0/16 中)分配给设备上托管的虚拟机之一。通过设备上的 mgmt0 接口访问特定虚拟机。

设备的 vti0(172.13.14.2)===隧道===GW(192.168.122.2)

 vti0 ip is 172.13.14.2 
 mgmt0 ip is 11.2.0.1
 virtual machine MAC address is fa:16:3e:4f:e6:64

 DHCP Server ip 192.168.122.10
 GW ip 192.168.122.2

DHCP 服务器配置:

subnet 11.2.0.0 netmask 255.255.0.0 {
range 11.2.0.2 11.2.255.254;
option routers 11.2.0.1;
}


subnet 192.168.122.0 netmask 255.255.255.0 {
        option routers 192.168.122.2;
        option subnet-mask 255.255.255.0;
        range  192.168.122.11 192.168.122.255;
}


host mgmt-node {
         hardware ethernet fa:16:3e:4f:e6:64;
         fixed-address 11.2.0.2;
 }

因此,我在设备上设置了一个 DHCP 中继,它将 DHCP 请求发送到服务器,但不会发回响应。

DHCP 中继配置:

# What servers should the DHCP relay forward requests to?
SERVERS="dhcp-server"
# On what interfaces should the DHCP relay (dhrelay) serve DHCP requests?
INTERFACES="mgmt0 vti0"
# Additional options that are passed to the DHCP relay daemon?
OPTIONS=""

请求如下。

DHCPDISCOVER
Virtual machine request > Device relay
Device relay > GW
GW > DHCP Server

DHCPOFFER
DHCP Server > GW
GW > Device relay --- Stops

DHCP 服务器日志:

авг 08 10:07:40 dhcpserver-Standard-PC-i440FX-PIIX-1996 dhcpd[3328]: DHCPDISCOVER from fa:16:3e:4f:e6:64 via 11.2.0.1
авг 08 10:07:40 dhcpserver-Standard-PC-i440FX-PIIX-1996 dhcpd[3328]: DHCPOFFER on 11.2.0.2 to fa:16:3e:4f:e6:64 via 11.2.0.1

我最后能看到数据包的地方是设备的 vti0 接口正在接收数据包。

我从 journalctl 日志中看到 DHCP 中继显示:8 月 8 日 07:28:39 ipsec-client-automation sh[19208]: 将 fa:16:3e:4f:e6:64 的 BOOTREQUEST 转发到 192.168.122.10 8 月 8 日 07:28:39 ipsec-client-automation sh[19208]: 尝试解码纯 IP 的硬件标头 8 月 8 日 07:28:39 ipsec-client-automation dhcrelay[19208]: 尝试解码纯 IP 的硬件标头

我找不到任何关于“尝试解码纯 IP 的硬件标头”含义的信息,但它在那之后就停止了,而且我找不到 DHCP 中继的高级调试,有什么想法吗?

如果有人能给出任何建议,我将不胜感激。

答案1

因此错误出在 DHCP 中继配置中它应该是这样的:

# What servers should the DHCP relay forward requests to?
SERVERS="192.168.122.10"

# On what interfaces should the DHCP relay (dhrelay) serve DHCP requests?
INTERFACES="mgmt0"

# Additional options that are passed to the DHCP relay daemon?
#OPTIONS="-U 172.13.14.2%vti0"
OPTIONS="-U vti0"

唯一的区别是,在接口中应该只有请求的来源和用 -U 指定的选项

如果有人想知道原因:发生这种情况的原因是,如果没有 -U 选项,则 DHCP 请求的一部分 giaddrs 不会改变。giaddrs 是数据包应该发送到的下一个中继服务器的地址,因此如果没有设置,则不会路由到该服务器。

我错误地认为它正在到达中继器,它只是尝试从网关路由到它,而不知道如何找到它。

相关内容