Page MenuHomeVyOS Platform

set ip route dhcp-interface eth0
Closed, ResolvedPublicBUG



When I first tried VyOS, it didn't automatically add a default route to the DHCP gateway on eth0 (WAN interface).
I thought I had to add it manually like on Cisco routers, but didn't read anything about it in the Quick start guide.
(Still not sure why it didn't add the route automatically, because when I reinstalled VyOS it did work as expected and added the route automatically without having to configure a static route.).

I found the following command:
set protocols static route dhcp-interface eth0

When I committed it, I got the message:
Grep: /var/lib/dhcp/dhclient_eth0_lease: no such file or directory.

After taking a look at the file, I found out the filename it looks for is incorrect. The actual filename is: /var/lib/dhcp/ (last is a dot instead of underscore).
When I created a temporary symlink to that file, it did work as expected and no complaints when committing, and also adding the route as expected.

I think the script (or system) that greps the lease file should reference to the correct filename, and then it should be solved.

Side note: Really loving VyOS so far, I'm currently testing it and I'm even considering switching from OpnSense to VyOS for my home router.


Difficulty level
Unknown (require assessment)
VyOS 1.3-rolling-202009151811
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Behavior change
Issue type
Bug (incorrect behavior)

Event Timeline

diekos updated the task description. (Show Details)

It looks like this code is to blame.

root@r2-roll:/home/vyos# sudo file /var/lib/dhcp/dhclient_eth0_lease
/var/lib/dhcp/dhclient_eth0_lease: cannot open `/var/lib/dhcp/dhclient_eth0_lease' (No such file or directory)
root@r2-roll:/home/vyos# sudo file /var/lib/dhcp/
/var/lib/dhcp/ ASCII text

I only know some python but that looks like the part that gets the gateway from the lease file.
My simple mind would say that the underscore needs to be replaced with a dot, but I have no idea if it really is that simple.


vyos@r2-roll# set protocols static route dhcp-interface eth0
vyos@r2-roll# commit

Show route

vyos@r2-roll:~$ show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

S>* [1/0] via, eth0, 00:00:23
S [210/0] via, eth0, 00:01:01

@diekos Will be fixed in the next rolling release, build after 23 Sep. Check, please.

Hi @Viacheslav,

I will test with the new release and report my results.
Thank you very much!

Hi @Viacheslav,

I saw that the new build was online, so I added the image, rebooted and tried to issue the command again.
Everything seems to work, no error when committing and the route is added.

I changed the status to Resolved. Thank you for resolving the issue!

erkin set Issue type to Bug (incorrect behavior).Aug 29 2021, 1:03 PM
erkin removed a subscriber: Active contributors.