mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Merge pull request #1940 from holta/dhcp-ip-or-fallback-to-static-ip
Ethernet DHCP IP (for field updates) then fallback to Static IP (for offline schools)
This commit is contained in:
commit
b3d61118bc
6 changed files with 62 additions and 10 deletions
|
@ -6,6 +6,15 @@
|
||||||
# ports_externally_visible: 3
|
# ports_externally_visible: 3
|
||||||
# https://github.com/iiab/iiab/wiki/IIAB-Networking#firewall-iptables
|
# https://github.com/iiab/iiab/wiki/IIAB-Networking#firewall-iptables
|
||||||
|
|
||||||
|
# Ethernet - IF NECESSARY, CUSTOMIZE THESE 4+1 VARS IN /etc/iiab/local_vars.yml
|
||||||
|
# See "How do I set a static IP address?" for Ethernet, in http://FAQ.IIAB.IO
|
||||||
|
# wan_ip: dhcp # wan_ip: 192.168.1.99
|
||||||
|
# wan_netmask: # wan_netmask: 255.255.255.0
|
||||||
|
# wan_gateway: # wan_gateway: 192.168.1.254
|
||||||
|
# wan_nameserver: # wan_nameserver: 192.168.1.254
|
||||||
|
# wan_try_dhcp_before_static_ip: True # Facilitate field updates w/ cablemodems
|
||||||
|
# Details @ roles/network/templates/network/dhcpcd.conf.j2 for /etc/dhcpcd.conf
|
||||||
|
|
||||||
# Wi-Fi - IF NECESSARY, CUSTOMIZE THESE 6 VARIABLES IN /etc/iiab/local_vars.yml
|
# Wi-Fi - IF NECESSARY, CUSTOMIZE THESE 6 VARIABLES IN /etc/iiab/local_vars.yml
|
||||||
# host_country_code: US
|
# host_country_code: US
|
||||||
# host_ssid: "Internet in a Box"
|
# host_ssid: "Internet in a Box"
|
||||||
|
|
|
@ -39,16 +39,19 @@ slaac private
|
||||||
|
|
||||||
# IIAB
|
# IIAB
|
||||||
|
|
||||||
# always support Ethernet-to-Internet on RPi (avoid "denyinterfaces eth0")
|
# Always (try) to run DHCP client on RPi's Ethernet port, for in-field
|
||||||
|
# "cablemodems" used by many non-technical operators, who want Zero-Hassle
|
||||||
|
# Updates. This means AVOIDING "denyinterfaces eth0" below:
|
||||||
{% if is_rpi and hostapd_enabled %}
|
{% if is_rpi and hostapd_enabled %}
|
||||||
denyinterfaces {% if discovered_wireless_iface != "none" %} {{ discovered_wireless_iface }} {% endif %}
|
denyinterfaces{% if discovered_wireless_iface != "none" %} {{ discovered_wireless_iface }}{% endif %}
|
||||||
{% elif is_rpi %}
|
{% elif is_rpi %}
|
||||||
#denyinterfaces {% if discovered_wireless_iface != "none" %} {{ discovered_wireless_iface }} {% endif %}
|
#denyinterfaces{% if discovered_wireless_iface != "none" %} {{ discovered_wireless_iface }}{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
denyinterfaces {% if iiab_wireless_lan_iface is defined %} {{ iiab_wireless_lan_iface }} {% endif %} {% if iiab_wired_lan_iface is defined %} {{ iiab_wired_lan_iface }} {% endif %}
|
denyinterfaces{% if iiab_wireless_lan_iface is defined %} {{ iiab_wireless_lan_iface }}{% endif %}{% if iiab_wired_lan_iface is defined %} {{ iiab_wired_lan_iface }}{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# {% if iiab_lan_iface != "br0" %} {{ iiab_lan_iface }} {% endif %} #}
|
# FYI this 'denyinterfaces' line (here in /etc/dhcpcd.conf) is commented out by
|
||||||
|
# /usr/bin/iiab-hotspot-off, and uncommented by /usr/bin/iiab-hotspot-on
|
||||||
|
|
||||||
{% if dhcpcd_result == "enabled" and iiab_lan_iface != "none" %}
|
{% if dhcpcd_result == "enabled" and iiab_lan_iface != "none" %}
|
||||||
interface {{ iiab_lan_iface }}
|
interface {{ iiab_lan_iface }}
|
||||||
|
@ -56,10 +59,24 @@ static ip_address={{ lan_ip }}/19
|
||||||
static domain_name_servers=127.0.0.1
|
static domain_name_servers=127.0.0.1
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
# IIAB static IP configuration:
|
# IIAB static IP configuration, possibly trying DHCP first
|
||||||
{% if wan_ip != "dhcp" %}
|
{% if wan_ip != "dhcp" %}
|
||||||
|
{% if wan_try_dhcp_before_static_ip %}
|
||||||
|
profile static_eth0
|
||||||
|
static ip_address={{ wan_ip }}/24
|
||||||
|
static routers={{ wan_gateway }}
|
||||||
|
static domain_name_servers={{ wan_nameserver }}
|
||||||
|
|
||||||
|
# Check for DHCP on the wire first (for occasional field updates of IIAB, e.g.
|
||||||
|
# Ethernet cable to a "cablemodem") before falling back to the above Static IP
|
||||||
|
# (e.g. IIAB as 192.168.1.99 in Chiapas, Mexico where schools have typically
|
||||||
|
# hard-coded their student PC's as 192.168.1.1, 192.168.1.2, 192.168.1.3, etc).
|
||||||
|
interface {{ iiab_wan_iface }}
|
||||||
|
fallback static_eth0
|
||||||
|
{% else %}
|
||||||
interface {{ iiab_wan_iface }}
|
interface {{ iiab_wan_iface }}
|
||||||
static ip_address={{ wan_ip }}/24
|
static ip_address={{ wan_ip }}/24
|
||||||
static routers={{ wan_gateway }}
|
static routers={{ wan_gateway }}
|
||||||
static domain_name_servers={{ wan_nameserver }}
|
static domain_name_servers={{ wan_nameserver }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
|
@ -160,10 +160,15 @@ wondershaper_enabled: False
|
||||||
# The following 2 override the detection when not "auto"
|
# The following 2 override the detection when not "auto"
|
||||||
user_wan_iface: auto
|
user_wan_iface: auto
|
||||||
user_lan_iface: auto
|
user_lan_iface: auto
|
||||||
wan_ip: dhcp
|
|
||||||
wan_netmask:
|
# Ethernet - IF NECESSARY, CUSTOMIZE THESE 4+1 VARS IN /etc/iiab/local_vars.yml
|
||||||
wan_gateway:
|
# See "How do I set a static IP address?" for Ethernet, in http://FAQ.IIAB.IO
|
||||||
wan_nameserver:
|
wan_ip: dhcp # wan_ip: 192.168.1.99
|
||||||
|
wan_netmask: # wan_netmask: 255.255.255.0
|
||||||
|
wan_gateway: # wan_gateway: 192.168.1.254
|
||||||
|
wan_nameserver: # wan_nameserver: 192.168.1.254
|
||||||
|
wan_try_dhcp_before_static_ip: True # Facilitate field updates w/ cablemodems
|
||||||
|
# Details @ roles/network/templates/network/dhcpcd.conf.j2 for /etc/dhcpcd.conf
|
||||||
|
|
||||||
|
|
||||||
# Parameters for Aggregate Roles
|
# Parameters for Aggregate Roles
|
||||||
|
|
|
@ -40,6 +40,13 @@ host_channel: 6
|
||||||
hostapd_secure: False
|
hostapd_secure: False
|
||||||
hostapd_password: changeme
|
hostapd_password: changeme
|
||||||
|
|
||||||
|
# See "How do I set a static IP address?" for Ethernet, in http://FAQ.IIAB.IO
|
||||||
|
wan_ip: dhcp # wan_ip: 192.168.1.99
|
||||||
|
wan_netmask: # wan_netmask: 255.255.255.0
|
||||||
|
wan_gateway: # wan_gateway: 192.168.1.254
|
||||||
|
wan_nameserver: # wan_nameserver: 192.168.1.254
|
||||||
|
wan_try_dhcp_before_static_ip: True # Facilitate field updates w/ cablemodems
|
||||||
|
|
||||||
# Enable "campus access" to ~10 common IIAB services like Kiwix (3000), KA Lite
|
# Enable "campus access" to ~10 common IIAB services like Kiwix (3000), KA Lite
|
||||||
# (8008) and Calibre (8010 or 8080) etc, on the WAN side of your IIAB server.
|
# (8008) and Calibre (8010 or 8080) etc, on the WAN side of your IIAB server.
|
||||||
# Only 1 of the 6 lines below should be uncommented:
|
# Only 1 of the 6 lines below should be uncommented:
|
||||||
|
|
|
@ -40,6 +40,13 @@ host_channel: 6
|
||||||
hostapd_secure: False
|
hostapd_secure: False
|
||||||
hostapd_password: changeme
|
hostapd_password: changeme
|
||||||
|
|
||||||
|
# See "How do I set a static IP address?" for Ethernet, in http://FAQ.IIAB.IO
|
||||||
|
wan_ip: dhcp # wan_ip: 192.168.1.99
|
||||||
|
wan_netmask: # wan_netmask: 255.255.255.0
|
||||||
|
wan_gateway: # wan_gateway: 192.168.1.254
|
||||||
|
wan_nameserver: # wan_nameserver: 192.168.1.254
|
||||||
|
wan_try_dhcp_before_static_ip: True # Facilitate field updates w/ cablemodems
|
||||||
|
|
||||||
# Enable "campus access" to ~10 common IIAB services like Kiwix (3000), KA Lite
|
# Enable "campus access" to ~10 common IIAB services like Kiwix (3000), KA Lite
|
||||||
# (8008) and Calibre (8010 or 8080) etc, on the WAN side of your IIAB server.
|
# (8008) and Calibre (8010 or 8080) etc, on the WAN side of your IIAB server.
|
||||||
# Only 1 of the 6 lines below should be uncommented:
|
# Only 1 of the 6 lines below should be uncommented:
|
||||||
|
|
|
@ -40,6 +40,13 @@ host_channel: 6
|
||||||
hostapd_secure: False
|
hostapd_secure: False
|
||||||
hostapd_password: changeme
|
hostapd_password: changeme
|
||||||
|
|
||||||
|
# See "How do I set a static IP address?" for Ethernet, in http://FAQ.IIAB.IO
|
||||||
|
wan_ip: dhcp # wan_ip: 192.168.1.99
|
||||||
|
wan_netmask: # wan_netmask: 255.255.255.0
|
||||||
|
wan_gateway: # wan_gateway: 192.168.1.254
|
||||||
|
wan_nameserver: # wan_nameserver: 192.168.1.254
|
||||||
|
wan_try_dhcp_before_static_ip: True # Facilitate field updates w/ cablemodems
|
||||||
|
|
||||||
# Enable "campus access" to ~10 common IIAB services like Kiwix (3000), KA Lite
|
# Enable "campus access" to ~10 common IIAB services like Kiwix (3000), KA Lite
|
||||||
# (8008) and Calibre (8010 or 8080) etc, on the WAN side of your IIAB server.
|
# (8008) and Calibre (8010 or 8080) etc, on the WAN side of your IIAB server.
|
||||||
# Only 1 of the 6 lines below should be uncommented:
|
# Only 1 of the 6 lines below should be uncommented:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue