mirror of
https://github.com/iiab/iiab.git
synced 2025-02-14 20:22:08 +00:00
Merge branch 'master' of https://github.com/iiab/iiab
This commit is contained in:
commit
153b38bf8e
5 changed files with 123 additions and 62 deletions
|
@ -29,9 +29,13 @@
|
|||
gui_desired_network_role: "lan_controller"
|
||||
when: not gui_desired_network_role is defined
|
||||
|
||||
- name: Copy the bridge script -- was in interfaces.d/
|
||||
- name: Recover from putting config in /etc/network/interfaces
|
||||
template: dest=/etc/network/interfaces
|
||||
src=network/interfaces.j2
|
||||
|
||||
- name: Copy the bridge script
|
||||
template: dest=/etc/network/interfaces.d/iiab
|
||||
src=network/iiab.j2
|
||||
register: interface
|
||||
|
||||
- name: start up the dhcpcd service
|
||||
|
|
|
@ -27,9 +27,17 @@
|
|||
gui_desired_network_role: "LanController"
|
||||
when: not gui_desired_network_role is defined
|
||||
|
||||
- name: Copy the network config script -- previously in /etc/network/interfaces.d/br0
|
||||
- name: Rewrite the /etc/network/interfaces file which we currupted
|
||||
template: dest=/etc/network/interfaces
|
||||
src=network/interfaces.j2
|
||||
|
||||
- name: Supply our own dhcpcd.conf
|
||||
template: dest=/etc/dhcpcd.conf
|
||||
src=network/dhcpcd.conf
|
||||
|
||||
- name: Copy the network config script
|
||||
template: dest=/etc/network/interfaces.d/iiab
|
||||
src=network/iiab.j2
|
||||
register: interface
|
||||
|
||||
- name: If this was a change, things need to shift
|
||||
|
|
61
roles/network/templates/network/dhcpcd.conf
Normal file
61
roles/network/templates/network/dhcpcd.conf
Normal file
|
@ -0,0 +1,61 @@
|
|||
# A sample configuration for dhcpcd.
|
||||
# See dhcpcd.conf(5) for details.
|
||||
|
||||
# Allow users of this group to interact with dhcpcd via the control socket.
|
||||
#controlgroup wheel
|
||||
|
||||
# Inform the DHCP server of our hostname for DDNS.
|
||||
hostname
|
||||
|
||||
# Use the hardware address of the interface for the Client ID.
|
||||
clientid
|
||||
# or
|
||||
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
|
||||
# Some non-RFC compliant DHCP servers do not reply with this set.
|
||||
# In this case, comment out duid and enable clientid above.
|
||||
#duid
|
||||
|
||||
# Persist interface configuration when dhcpcd exits.
|
||||
persistent
|
||||
|
||||
# Rapid commit support.
|
||||
# Safe to enable by default because it requires the equivalent option set
|
||||
# on the server to actually work.
|
||||
option rapid_commit
|
||||
|
||||
# A list of options to request from the DHCP server.
|
||||
option domain_name_servers, domain_name, domain_search, host_name
|
||||
option classless_static_routes
|
||||
# Most distributions have NTP support.
|
||||
option ntp_servers
|
||||
# Respect the network MTU. This is applied to DHCP routes.
|
||||
option interface_mtu
|
||||
|
||||
# A ServerID is required by RFC2131.
|
||||
require dhcp_server_identifier
|
||||
|
||||
# Generate Stable Private IPv6 Addresses instead of hardware based ones
|
||||
slaac private
|
||||
|
||||
# don't let dhcpcd mess with IIAB LAN
|
||||
denyinterfaces br0 wlan0
|
||||
|
||||
# Example static IP configuration:
|
||||
{% if gui_static_wan == true %}
|
||||
interface {{ discovered_wan_iface }}
|
||||
# strange that dhcpcd does not have a netmask option -- hardcode it FIXME
|
||||
static ip_address={{ gui_static_wan_ip }}/24
|
||||
static routers={{ gui_static_wan_gateway }}
|
||||
domain_name_servers= {{ gui_static_wan_nameserver }}
|
||||
{% endif %}
|
||||
|
||||
# It is possible to fall back to a static IP if DHCP fails:
|
||||
# define static profile
|
||||
#profile static_eth0
|
||||
#static ip_address=192.168.1.23/24
|
||||
#static routers=192.168.1.1
|
||||
#static domain_name_servers=192.168.1.1
|
||||
|
||||
# fallback to static profile on eth0
|
||||
#interface eth0
|
||||
#fallback static_eth0
|
48
roles/network/templates/network/iiab.j2
Normal file
48
roles/network/templates/network/iiab.j2
Normal file
|
@ -0,0 +1,48 @@
|
|||
# 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 %}
|
||||
|
|
@ -7,63 +7,3 @@ source /etc/network/interfaces.d/*
|
|||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
# iiab_network_mode is {{ gui_desired_network_role }}
|
||||
{% if discovered_wireless_iface != 'none' %}
|
||||
# we always want the wireless to be configured (and under bridge) if it exists
|
||||
auto {{ discovered_wireless_iface }}
|
||||
iface {{discovered_wireless_iface }} inet manual
|
||||
pre-up ifconfig $IFACE up
|
||||
pre-down ifconfig $IFACE down
|
||||
{% endif %}
|
||||
|
||||
{% if iiab_network_mode == "Appliance" %}
|
||||
################# APPLIANCE #########################
|
||||
auto {{ discovered_wan_iface }}
|
||||
{% if gui_static_wan == false %}
|
||||
iface {{ discovered_wan_iface }} inet manual
|
||||
{% 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 }}
|
||||
{% endif %} {# end of static_wan #}
|
||||
{% 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 }}
|
||||
{% if gui_static_wan == false %}
|
||||
auto {{ discovered_wan_iface }}
|
||||
iface {{ discovered_wan_iface }} inet manual
|
||||
{% 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 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 %}
|
||||
|
||||
|
|
Loading…
Reference in a new issue