# iiab_network_mode is {{ iiab_network_mode  }}
# gui_desired_network_role is {{ gui_desired_network_role }}

{% if iiab_network_mode != "Appliance"  %}
#################   LANCONTROLLER   ###################
auto br0
{% if dhcpcd_result == "enabled" %}
iface br0 inet manual
{% else %}
iface br0 inet static
{% endif %}
    bridge_ports {% if iiab_wireless_lan_iface is defined %}{{ iiab_wireless_lan_iface }} {% endif %}{% if iiab_wired_lan_iface is defined %}{{ iiab_wired_lan_iface }}{% endif %}

    bridge_maxwait 0
{% if dhcpcd_result != "enabled" %}
    address {{ lan_ip }}
    netmask {{ lan_netmask }}
{% endif %}
    dns-nameservers 127.0.0.1
    dns-search {{ iiab_domain }}
{% endif %}
{# end LANCONTROLLER #}

{% if iiab_network_mode != "LanController"  %}
#################   GATEWAY or APPLIANCE #########################
# start dhcp clients
{% if dhcpcd_result == "enabled" or wan_in_interfaces %}
# client or user defined
{% endif %}
{% if dhcpcd_result != "enabled" and not wan_in_interfaces and wan_ip == "dhcp" %}
#cover butt
auto {{ iiab_wan_iface }}
iface {{ iiab_wan_iface }} inet dhcp
{% endif %}
# end dhcp clients
# static wan
{% if wan_ip != "dhcp" and dhcpcd_result != "enabled" %}
auto {{ iiab_wan_iface }}
iface {{ iiab_wan_iface }} inet static
    address {{ wan_ip }}
    netmask {{ wan_netmask }}
    gateway {{ wan_gateway }}
    dns-nameservers 127.0.0.1 {{ wan_nameserver }}
    dns-search {{ iiab_domain }}
{% endif %} {# end of static_wan #}

{% endif %} {# end of iiab_network_mode != LanController #}
