summaryrefslogtreecommitdiff
path: root/data/templates/dhcp-client/ipv4.j2
blob: 77905e0542461a6f94feaae32a5424f0bcc2e2ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
### Autogenerated by interface.py ###

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
timeout 60;
retry 60;
initial-interval 2;

interface "{{ ifname }}" {
    send host-name "{{ dhcp_options.host_name }}";
{% if dhcp_options.client_id is vyos_defined %}
{%     set client_id = dhcp_options.client_id %}
{#   Use HEX representation of client-id as it is send in MAC-address style using hex characters. #}
{#   If not HEX, use double quotes ASCII format #}
{%     if not client_id.split(':') | length >= 3 %}
{%         set client_id = '"' ~ dhcp_options.client_id ~ '"' %}
{%     endif %}
    send dhcp-client-identifier {{ client_id }};
{% endif %}
{% if dhcp_options.vendor_class_id is vyos_defined %}
{%     set vendor_class_id = dhcp_options.vendor_class_id %}
{#   Use HEX representation of client-id as it is send in MAC-address style using hex characters. #}
{#   If not HEX, use double quotes ASCII format #}
{%     if not vendor_class_id.split(':') | length >= 3 %}
{%         set vendor_class_id = '"' ~ dhcp_options.vendor_class_id ~ '"' %}
{%     endif %}
    send vendor-class-identifier {{ vendor_class_id }};
{% endif %}
{% if dhcp_options.user_class is vyos_defined %}
{%     set user_class = dhcp_options.user_class %}
{#   Use HEX representation of client-id as it is send in MAC-address style using hex characters. #}
{#   If not HEX, use double quotes ASCII format #}
{%     if not user_class.split(':') | length >= 3 %}
{%         set user_class = '"' ~ dhcp_options.user_class ~ '"' %}
{%     endif %}
    send user-class {{ user_class }};
{% endif %}
    # The request statement causes the client to request that any server responding to the
    # client send the client its values for the specified options.
    request subnet-mask, broadcast-address,{{ " routers," if dhcp_options.no_default_route is not vyos_defined }} domain-name-servers,
        rfc3442-classless-static-routes, domain-name, interface-mtu;

    # The require statement lists options that must be sent in order for an offer to be
    # accepted. Offers that do not contain all the listed options will be ignored!
    require subnet-mask;
{% if dhcp_options.reject is vyos_defined %}
    # Block addresses coming from theses dhcp servers if configured.
    reject {{ dhcp_options.reject | join(', ') }};
{% endif %}
}