36 lines
1.3 KiB
Django/Jinja
36 lines
1.3 KiB
Django/Jinja
{# Append DHCPv4 agents #}
|
|
{# Create a program entry for each DHCP relay agent instance #}
|
|
{% for vlan_name in vlan_list %}
|
|
{% if VLAN and vlan_name in VLAN and VLAN[vlan_name]['dhcp_servers'] %}
|
|
{% for dhcp_server in VLAN[vlan_name]['dhcp_servers'] %}
|
|
{% if dhcp_server | ipv4 %}
|
|
{% set _dummy = relay_for_ipv4.update({'flag': True}) %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% if relay_for_ipv4.flag %}
|
|
{% set _dummy = relay_for_ipv4.update({'flag': False}) %}
|
|
[program:isc-dhcpv4-relay-{{ vlan_name }}]
|
|
{# We treat this VLAN as a downstream interface (-id), as we only want to listen for requests #}
|
|
command=/usr/sbin/dhcrelay -d -m discard -a %%h:%%p %%P --name-alias-map-file /tmp/port-name-alias-map.txt -id {{ vlan_name }}
|
|
{#- We treat all other interfaces as upstream interfaces (-iu), as we only want to listen for replies #}
|
|
{% for (name, prefix) in VLAN_INTERFACE %}
|
|
{% if prefix | ipv4 and name != vlan_name %} -iu {{ name }}{% endif -%}
|
|
{% endfor %}
|
|
{% for (name, prefix) in INTERFACE %}
|
|
{% if prefix | ipv4 %} -iu {{ name }}{% endif -%}
|
|
{% endfor %}
|
|
{% for (name, prefix) in PORTCHANNEL_INTERFACE %}
|
|
{% if prefix | ipv4 %} -iu {{ name }}{% endif -%}
|
|
{% endfor %}
|
|
{% for dhcp_server in VLAN[vlan_name]['dhcp_servers'] %} {{ dhcp_server }}{% endfor %}
|
|
|
|
priority=3
|
|
autostart=false
|
|
autorestart=false
|
|
stdout_logfile=syslog
|
|
stderr_logfile=syslog
|
|
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|