Page MenuHomeVyOS Platform

set ip route 0.0.0.0/0 dhcp-interface eth0
Closed, ResolvedPublicBUG

Description

Hello!

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 0.0.0.0/0 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/dhclient_eth0.lease (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.

Details

Difficulty level
Unknown (require assessment)
Version
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.
https://github.com/vyos/vyatta-cfg-system/blob/current/scripts/vyatta-dhcp-helper.pl#L21

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# 
root@r2-roll:/home/vyos# sudo file /var/lib/dhcp/dhclient_eth0.lease
/var/lib/dhcp/dhclient_eth0.lease: ASCII text
root@r2-roll:/home/vyos#

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.

PR https://github.com/vyos/vyatta-cfg-system/pull/128

vyos@r2-roll# set protocols static route 0.0.0.0/0 dhcp-interface eth0
[edit]
vyos@r2-roll# commit
[edit]
vyos@r2-roll#

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>* 0.0.0.0/0 [1/0] via 192.168.122.1, eth0, 00:00:23
S   0.0.0.0/0 [210/0] via 192.168.122.1, 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.