# generated by XSCE
# gui_desired_network_role is {{ gui_desired_network_role }}

# we always want the wireless to be configured (and under bridge)
auto {{ discovered_wireless_iface }}
iface {{ discovered_wireless_iface }} inet manual
   pre-up   ifconfig $IFACE up
   pre-down ifconfig $IFACE down

{% if gui_desired_network_role == "Appliance"  %}
#################   APPLIANCE #########################
auto {{ discovered_wan_iface }}
{% if gui_static_wan == false %}
iface {{ discovered_wan_iface }} inet dhcp
    pre-up ip link set br0 down && brctl delbr br0
{% else %} # gui_static_wan_ip is set
iface {{ discovered_wan_iface }} inet static
#    pre-up ip link set br0 down && brctl delbr br0
    address {{ gui_static_wan_ip }}
    netmask {{ gui_static_wan_netmask }}
    gateway {{ gui_static_wan_gateway }}
    dns-nameservers {{ gui_static_wan_nameserver }}
{% endif %} {# end of static_wan #}
{% elif gui_desired_network_role == "Gateway"  %}
#################   GATEWAY   #########################
auto br0
iface br0 inet static
    bridge_ports {{ discovered_wireless_iface }}
    address {{ lan_ip }}
    netmask {{ lan_netmask }}
    dns-nameservers {{ lan_ip }}
    dns-search {{ iiab_domain }}
auto {{ discovered_wan_iface }}
{% if gui_static_wan == false %}
allow-hotplug {{ discovered_wan_iface }}
iface {{ discovered_wan_iface }} inet manual
   pre-up   ifconfig $IFACE up
   pre-down ifconfig $IFACE down
{% else %} # gui_static_wan_ip is set
iface {{ discovered_wan_iface }} inet static
    address {{ gui_static_wan_ip }}
    netmask {{ gui_static_wan_netmask }}
    gateway {{ gui_static_wan_gateway }}
    dns-nameservers {{ gui_static_wan_nameserver }}
    dns-search {{ iiab_domain }}
    post-up systemctl restart dhcpd && systemctl restart hostapd
   {% endif %}
{% else  %} {# end of gui_desired_network_role == Gateway #}

#################   LANCONTROLLER   ###################
auto br0
iface br0 inet static
    bridge_ports {{ discovered_wan_iface }} {{ discovered_wireless_iface }}
    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 %}
