systemd-networkd 未收到 dhcp 请求

systemd-networkd 未收到 dhcp 请求

主机,容器:fc21

$ systemctl start systemd-networkd.service
$ systemd-nspawn -b -D `pwd` -M m1  --private-network --network-veth

... 在容器中:

$ systemctl start systemd-networkd.service
$ ip addr
2: host0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether c6:a1:72:9b:16:08 brd ff:ff:ff:ff:ff:ff
    inet 169.254.215.78/16 brd 169.254.255.255 scope link host0
       valid_lft forever preferred_lft forever
    inet6 fe80::c4a1:72ff:fe9b:1608/64 scope link 
       valid_lft forever preferred_lft forever

-> 容器仅获取一个 ipv4LL 地址,而不是一个好看的 dhcp 分配的地址。

为什么 ?

在主机上tcpdump -i v1-m1根据 systemd-networkd 对接口 host0 的默认配置,显示来自 m1 容器的 DHCP 请求:

$ sudo tcpdump -i ve-m1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ve-m1, link-type EN10MB (Ethernet), capture size 262144 bytes
11:57:18.768736 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from c6:a1:72:9b:16:08 (oui Unknown), length 271
11:57:19.757532 ARP, Request who-has 169.254.215.78 tell 0.0.0.0, length 28

在主机上,systemd-networkd 的 strace 显示它正在监听 UDP DHCP 服务器端口从不读取它:

socket(PF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 12
setsockopt(12, SOL_IP, IP_TOS, [192], 4) = 0
setsockopt(12, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
setsockopt(12, SOL_IP, IP_PKTINFO, [1], 4) = 0
setsockopt(12, SOL_SOCKET, SO_BROADCAST, [1], 4) = 0
bind(12, {sa_family=AF_INET, sin_port=htons(67), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
epoll_ctl(3, EPOLL_CTL_ADD, 12, {EPOLLIN, {u32=2522795824, u64=139692039130928}}) = 0
writev(2, [{"DHCP SERVER: STARTED", 20}, {"\n", 1}], 2) = 21

我检查了没有其他进程在监听同一个 udp 端口​​:

$ lsof |grep -i udp |grep -i bootps
systemd-n 16276       systemd-network   12u     IPv4             265473       0t0        UDP *:bootps

现在我的调试技巧已经到了极限。我的问题是:我该如何进一步调试?即有没有办法获取有关 dhcp 请求可能在哪里丢失以及原因的信息?

答案1

尝试以下命令:

$ systemctl stop firewalld.service

相关内容