From db1fa162e10cb5b70afa282d70dafeae7da9cd21 Mon Sep 17 00:00:00 2001 From: A Holt Date: Tue, 3 Sep 2019 14:36:43 -0400 Subject: [PATCH] rm arping; create var wan_try_dhcp_before_static_ip --- .../network/templates/network/dhcpcd.conf.j2 | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/roles/network/templates/network/dhcpcd.conf.j2 b/roles/network/templates/network/dhcpcd.conf.j2 index 0d9654509..eaeda072e 100644 --- a/roles/network/templates/network/dhcpcd.conf.j2 +++ b/roles/network/templates/network/dhcpcd.conf.j2 @@ -39,11 +39,6 @@ slaac private # IIAB -# How many seconds to wait for DHCP (e.g. from cablemodem) before IIAB's -# Ethernet falls back to Static IP below (e.g. for Mexican schools with -# Static IP-based Ethernet networks) -timeout {{ dhcp_timeout }} - # Always support Ethernet-to-Internet on RPi, to facilitate field updates # (avoid "denyinterfaces eth0" below!) {% if is_rpi and hostapd_enabled %} @@ -62,20 +57,18 @@ static ip_address={{ lan_ip }}/19 static domain_name_servers=127.0.0.1 {% endif %} -# IIAB static IP configuration, alongside optional DHCP & link-local +# IIAB static IP configuration, possibly trying DHCP first {% if wan_ip != "dhcp" %} -profile {{ wan_gateway }} +profile static_eth0 static ip_address={{ wan_ip }}/24 static routers={{ wan_gateway }} static domain_name_servers={{ wan_nameserver }} -{% if wan_can_use_dhcp_ip %} +{% if wan_try_dhcp_before_static_ip %} +# Check for DHCP on the wire first (for occasional field updates of IIAB, +# e.g. using "cablemodem" Ethernet ports) before falling back to above Static +# IP (e.g. 192.168.1.99 in Chiapas, Mexico) as used for everyday classrooms. interface {{ iiab_wan_iface }} -{% if not wan_link_local %} -arping 192.0.2.1 # Set Ethernet IP per "cablemodem" DHCP, if DHCP's on wire (after arp request to non-existent IP 192.0.2.1 fails on purpose, per RFC5737) -fallback {{ wan_gateway }} # If DHCP not detected after {{ dhcp_timeout }} seconds, set Ethernet Static IP per above "profile {{ wan_gateway }}" -{% else %} -arping {{ wan_gateway }} # Perform up to 3 steps: 1. arp (if detected, set Ethernet Static IP per "profile {{ wan_gateway }}") 2. Set Ethernet IP per "cablemodem" DHCP, if DHCP's on wire 3. If nec, set Ethernet IP to a link-local address (169.254.x.y) -{% endif %} +fallback static_eth0 {% endif %} {% endif %}