dhcpd 回复未到达最终客户端。
背景: 房屋网络:
107.nn.164.89 - 连接互联网
192.168.100.0/24 - 内部 LAN1
192.168.1.254/30 - 曼卡夫的网关
曼卡夫:
192.168.1.253/30 - 通往房屋的网关
192.168.200.254/24 - 曼卡夫本地 LAN1
mancave dhcrelay 向在 house lan1 上运行的 dhcp 服务器发送请求(该服务器也在 1.254/30 上侦听)
house dhcp 对这些请求做出答复。
我可以在 1.253 上看到来自房屋的回复,并且 dhcrelay 将其发送到 200.0/24 网络;至少我是这么认为的。
200.0/24 网络显示请求已发出,没有任何返回。
如果我手动设置 IP、网关等,我可以从 mancave 中的 200.0/24 网络冲浪(或其他)。
dhcrelay、route、tcpdump 如下:
darouter 是家庭网络
[root@darouter named]# tcpdump -i ens2 -nn port 67 or port 68
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens2, link-type EN10MB (Ethernet), capture size 262144 bytes
07:10:26.347170 IP 192.168.1.253.67 > 192.168.1.254.67: BOOTP/DHCP, Request from 00:e8:fb:00:67:37, length 548
07:10:26.347488 IP 192.168.1.254.67 > 192.168.200.254.67: BOOTP/DHCP, Reply, length 310
07:10:34.427024 IP 192.168.1.253.67 > 192.168.1.254.67: BOOTP/DHCP, Request from 00:e8:fb:00:67:37, length 548
07:10:34.427282 IP 192.168.1.254.67 > 192.168.200.254.67: BOOTP/DHCP, Reply, length 310
dacave 是 mancave 网络;第一个是 1.253/30 净值
[root@dacave ~]# tcpdump -i enp3s0 -nn port 67 or port 68
dropped privs to tcpdump
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on enp3s0, link-type EN10MB (Ethernet), capture size 262144 bytes
09:09:45.827122 IP 192.168.1.253.67 > 192.168.1.254.67: BOOTP/DHCP, Request from 00:e8:fb:00:67:37, length 548
09:09:45.827647 IP 192.168.1.254.67 > 192.168.200.254.67: BOOTP/DHCP, Reply, length 310
09:09:53.906938 IP 192.168.1.253.67 > 192.168.1.254.67: BOOTP/DHCP, Request from 00:e8:fb:00:67:37, length 548
09:09:53.907477 IP 192.168.1.254.67 > 192.168.200.254.67: BOOTP/DHCP, Reply, length 310
^C
4 packets captured
200.0/24 网:
[root@dacave ~]# tcpdump -i enp5s0 -nn port 67 or port 68
dropped privs to tcpdump
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on enp5s0, link-type EN10MB (Ethernet), capture size 262144 bytes
09:09:45.827036 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:e8:fb:00:67:37, length 548
09:09:53.906885 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:e8:fb:00:67:37, length 548
^C
2 packets captured
dhcrelay 配置:
[root@dacave ~]# show dhc
206: 82462 ? Ss 0:00 /usr/sbin/dhcrelay -d --no-pid 192.168.1.254 -i enp5s0
曼卡夫路线-n
[root@dacave ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.254 0.0.0.0 UG 100 0 0 enp3s0
192.168.1.252 0.0.0.0 255.255.255.252 U 100 0 0 enp3s0
192.168.200.0 0.0.0.0 255.255.255.0 U 101 0 0 enp5s0
[root@dacave ~]#
房屋路线-n
[root@darouter named]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 107.nn.164.89 0.0.0.0 UG 100 0 0 enp2s0f0
0.0.0.0 192.168.1.253 0.0.0.0 UG 101 0 0 ens2
107.nn.164.88 0.0.0.0 255.255.255.252 U 100 0 0 enp2s0f0
192.168.1.252 0.0.0.0 255.255.255.252 U 100 0 0 ens2
192.168.100.0 0.0.0.0 255.255.255.0 U 100 0 0 enp2s0f1
192.168.200.0 192.168.1.254 255.255.255.0 UG 0 0 0 ens2
[root@darouter named]#
正如您所看到的,200.0/24 网络上没有返回任何回复。
我是否缺少路线?
哦,防火墙是敞开的(输入、输出和转发接受)。我已尝试 'iptables -t nat -A POSTROUTING -o enp3s0 -j SNAT to 192.168.1.253 并已将 SNAT 行全部删除。
无法将 dhcrelay 放入“标签”中 - 为什么有人需要 300 名代表才能做到这一点?
icarus:在 dhcrelay 启动中尝试了 -m 转发 - 没有看到区别。跟踪返回页面的东西。我不熟悉该命令,--help 对我没有帮助。我可以 grep 某些内容或设置一些命令行开关来提供帮助吗?我确实注意到在启动过程中,dhcrelay 打印的最后一条消息是“已删除所有功能”。如果你知道,那意味着什么?
另外,将 -v 添加到 tcpdump 行会产生:
dropped privs to tcpdump
tcpdump: listening on enp3s0, link-type EN10MB (Ethernet), capture size 262144 bytes
09:49:42.961047 IP (tos 0x0, ttl 64, id 4, offset 0, flags [DF], proto UDP (17), length 576)
192.168.1.253.67 > 192.168.1.254.67: BOOTP/DHCP, Request from 00:e8:fb:00:67:37, length 548, hops 1, xid 0xdf341d5f, secs 3, Flags [none]
Gateway-IP 192.168.200.254
Client-Ethernet-Address 00:e8:fb:00:67:37
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Discover
MSZ Option 57, length 2: 548
Requested-IP Option 50, length 4: 192.168.200.101
Lease-Time Option 51, length 4: 4294967295
Parameter-Request Option 55, length 14:
Subnet-Mask, Default-Gateway, Domain-Name-Server, Hostname
Domain-Name, RP, TTL, BR
MD, Router-Discovery, Static-Route, YD
YS, NTP
Vendor-Class Option 60, length 23: "Linux 2.4.20-uc0 armv3l"
Client-ID Option 61, length 7: ether 00:e8:fb:00:67:37
09:49:42.961603 IP (tos 0x0, ttl 64, id 37859, offset 0, flags [DF], proto UDP (17), length 338)
192.168.1.254.67 > 192.168.200.254.67: BOOTP/DHCP, Reply, length 310, hops 1, xid 0xdf341d5f, secs 3, Flags [none]
Your-IP 192.168.200.10
Gateway-IP 192.168.200.254
Client-Ethernet-Address 00:e8:fb:00:67:37
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Offer
Server-ID Option 54, length 4: 192.168.1.254
Lease-Time Option 51, length 4: 86400
Subnet-Mask Option 1, length 4: 255.255.255.0
Default-Gateway Option 3, length 4: 192.168.200.254
Domain-Name-Server Option 6, length 4: 192.168.1.254
Hostname Option 12, length 6: "UpEast"
Domain-Name Option 15, length 14: "todhackett.com"
BR Option 28, length 4: 255.255.255.255
NTP Option 42, length 4: 192.168.1.254
^C
2 packets captured
如果有帮助的话。
成功了。 dhcrelay 手册指出,您将端口设置为侦听 dhcp 请求,而我则将 1.252/30 排除在外,因为那里只有 2 个 IP。好的,所以我有时会短路的大脑认为确实有 dhcp 回复消息进来,所以我也将 1.252/30 接口设置为在线
dhcrelay -d --no-pid -i enp5s0 -i enp3s0 192.168.1.254
一切都很棒!感谢您的回复!