1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-15 04:32:11 +00:00

rm arping; create var wan_try_dhcp_before_static_ip

This commit is contained in:
A Holt 2019-09-03 14:36:43 -04:00 committed by GitHub
parent af2c3508d7
commit db1fa162e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 <wan_gateway> (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 %}