summaryrefslogtreecommitdiff
path: root/data/templates/dhcp-client/override.conf.j2
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-08-04 20:13:29 +0200
committerChristian Breunig <christian@breunig.cc>2023-08-04 20:13:29 +0200
commit782e400d6f276a8a4ee51c92f02e01e7695f55fb (patch)
tree437c5311d9a3f64d9f10c2c582ceeed9dc8b82de /data/templates/dhcp-client/override.conf.j2
parent292b064d743522d11179bd3cd91a08731380f3a9 (diff)
downloadvyos-1x-782e400d6f276a8a4ee51c92f02e01e7695f55fb.tar.gz
vyos-1x-782e400d6f276a8a4ee51c92f02e01e7695f55fb.zip
dhcp: T5428: client renewal fails when running inside VRF
vyos@vyos# run show vrf MGMT processes 2282 sshd There is no dhclient process running in given VRF. dhclient complains it can not send out packets via the given interface (as it's not bound to that VRF) Aug 02 20:29:54 dhclient[1686]: send_packet: Network is unreachable Aug 02 20:29:54 dhclient[1686]: send_packet: please consult README file regarding broadcast address. Aug 02 20:29:54 dhclient[1686]: dhclient.c:3001: Failed to send 300 byte long packet over fallback interface.
Diffstat (limited to 'data/templates/dhcp-client/override.conf.j2')
-rw-r--r--data/templates/dhcp-client/override.conf.j215
1 files changed, 15 insertions, 0 deletions
diff --git a/data/templates/dhcp-client/override.conf.j2 b/data/templates/dhcp-client/override.conf.j2
new file mode 100644
index 000000000..fcb23cb52
--- /dev/null
+++ b/data/templates/dhcp-client/override.conf.j2
@@ -0,0 +1,15 @@
+### Autogenerated by interface.py ###
+{% set vrf_command = 'ip vrf exec ' ~ vrf ~ ' ' if vrf is vyos_defined else '' %}
+{% set if_metric = '-e IF_METRIC=' ~ dhcp_options.default_route_distance if dhcp_options.default_route_distance is vyos_defined else '' %}
+{% set dhclient_options = '-d -nw -cf /var/lib/dhcp/dhclient_' ~ ifname ~ '.conf -pf /var/lib/dhcp/dhclient_' ~ ifname ~ '.pid -lf /var/lib/dhcp/dhclient_' ~ ifname ~ '.leases ' ~ if_metric %}
+
+[Unit]
+ConditionPathExists={{ isc_dhclient_dir }}/dhclient_%i.conf
+
+[Service]
+ExecStart=
+ExecStart={{ vrf_command }}/sbin/dhclient -4 {{ dhclient_options }} {{ ifname }}
+ExecStop=
+ExecStop={{ vrf_command }}/sbin/dhclient -4 {{ dhclient_options }} {{ ifname }} -r
+WorkingDirectory={{ isc_dhclient_dir }}
+PIDFile={{ isc_dhclient_dir }}/dhclient_%i.pid