From bbb8e190f1102e8c012533b706d56ace53f5cd79 Mon Sep 17 00:00:00 2001 From: Jonathan Calmels Date: Thu, 7 Dec 2017 22:15:10 -0800 Subject: [PATCH] lxc-net: add LXC_DHCP_PING boolean option Excerpt from dnsmasq(8): By default, the DHCP server will attempt to ensure that an address in not in use before allocating it to a host. It does this by sending an ICMP echo request (aka "ping") to the address in question. If it gets a reply, then the address must already be in use, and another is tried. This flag disables this check. This is useful if one expects all the containers to get an IP address from the LXC authoritative DHCP server and wants to speed up the process of getting a lease. Signed-off-by: Jonathan Calmels --- config/init/common/lxc-net.in | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/config/init/common/lxc-net.in b/config/init/common/lxc-net.in index a9683f29d..ddbd4aaab 100644 --- a/config/init/common/lxc-net.in +++ b/config/init/common/lxc-net.in @@ -16,6 +16,7 @@ LXC_NETWORK="10.0.3.0/24" LXC_DHCP_RANGE="10.0.3.2,10.0.3.254" LXC_DHCP_MAX="253" LXC_DHCP_CONFILE="" +LXC_DHCP_PING="true" LXC_DOMAIN="" LXC_IPV6_ADDR="" @@ -127,7 +128,12 @@ start() { fi done - dnsmasq $LXC_DHCP_CONFILE_ARG $LXC_DOMAIN_ARG -u ${DNSMASQ_USER} \ + LXC_DHCP_PING_ARG="" + if [ "x$LXC_DHCP_PING" = "xfalse" ]; then + LXC_DHCP_PING_ARG="--no-ping" + fi + + dnsmasq $LXC_DHCP_CONFILE_ARG $LXC_DOMAIN_ARG $LXC_DHCP_PING_ARG -u ${DNSMASQ_USER} \ --strict-order --bind-interfaces --pid-file="${varrun}"/dnsmasq.pid \ --listen-address ${LXC_ADDR} --dhcp-range ${LXC_DHCP_RANGE} \ --dhcp-lease-max=${LXC_DHCP_MAX} --dhcp-no-override \ -- 2.47.2