mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
modify dhcpcd.conf for gui static changes
This commit is contained in:
parent
8b1de75192
commit
be5e3e131a
3 changed files with 78 additions and 28 deletions
|
@ -31,6 +31,10 @@
|
|||
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
|
||||
|
|
58
roles/network/templates/network/dhcpcd.conf
Normal file
58
roles/network/templates/network/dhcpcd.conf
Normal file
|
@ -0,0 +1,58 @@
|
|||
# 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
|
||||
|
||||
# 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
|
|
@ -1,34 +1,28 @@
|
|||
# Generated by IIAB
|
||||
# This file describes the network interfaces available on your system
|
||||
# and how to activate them. For more information, see interfaces(5).
|
||||
|
||||
source /etc/network/interfaces.d/*
|
||||
|
||||
# The loopback network interface
|
||||
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 %}
|
||||
# {% if gui_static_wan == false %} dhcpcd.conf will be modified
|
||||
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 #}
|
||||
# {% 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
|
||||
|
@ -39,18 +33,12 @@ iface br0 inet static
|
|||
address {{ lan_ip }}
|
||||
netmask {{ lan_netmask }}
|
||||
dns-nameservers {{ lan_ip }}
|
||||
{% if gui_static_wan == false %}
|
||||
# change for debian 9, let dhcpcd.conf set the static 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 %} # gui_static_wan_ip is set -- dhcpcd.conf will be modified
|
||||
|
||||
{% else %} {# end of iiab_network_mode == Gateway #}
|
||||
|
||||
################# LANCONTROLLER ###################
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue