# Generated by IIAB
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# iiab_network_mode is {{ gui_desired_network_role }}

{% if discovered_wireless_iface != 'none' %}
auto {{ discovered_wireless_iface }}
iface {{ discovered_wireless_iface }} inet manual
{% endif %}

{% if iiab_network_mode == "Appliance"  %}
#################   APPLIANCE #########################
auto {{ discovered_wan_iface }}
#  if gui_static_wan == true  dhcpcd.conf will be modified
iface {{ discovered_wan_iface }} inet manual

{% elif iiab_network_mode == "Gateway"  %}
#################   GATEWAY   #########################
auto br0
iface br0 inet static
    bridge_ports {% if discovered_wireless_iface != "none" %} {{ discovered_wireless_iface }} {% endif %} {% if discovered_lan_iface != "none" %} {{ discovered_lan_iface }} {% endif %}

    bridge_maxwait 0
    address {{ lan_ip }}
    netmask {{ lan_netmask }}
    dns-nameservers {{ lan_ip }}
# change for debian 9, let dhcpcd.conf set the static ip
#  if gui_static_wan == True
auto {{ discovered_wan_iface }}
iface {{ discovered_wan_iface }} inet manual

{% else  %} {# end of iiab_network_mode == Gateway #}

#################   LANCONTROLLER   ###################
auto br0
iface br0 inet static
    bridge_ports {% if discovered_wireless_iface != "none" %} {{ discovered_wireless_iface }} {% endif %} {% if discovered_wan_iface != "none" %} {{ discovered_wan_iface }} {% endif %}

    bridge_maxwait 0
    address {{ lan_ip }}
    netmask {{ lan_netmask }}
    gateway {{ lan_ip }}
    dns-nameservers {{ lan_ip }}
    dns-search {{ iiab_domain }}
    post-up systemctl restart dhcpd && systemctl restart hostapd
{% endif %}
