Page MenuHomeVyOS Platform

DHCP and Static IPs on Same Interface
Open, Requires assessmentPublicFEATURE REQUEST

Description

In VyOS, when attempting to assign both a static and DHCP address to an interface, the following is received:

vyos@cr01a-vyos# set interfaces bonding bond0 vif 20 address 192.168.100.2/24
[edit]
vyos@cr01a-vyos# show interfaces bonding bond0 vif 20
 address dhcp
+address 192.168.100.2/24
 description "DL: L::cr01a-vyos.int bond0.20 | R::ir01.int Po5.20"
 ipv6 {
     dup-addr-detect-transmits 0
 }
 mac 52:54:00:bb:99:6a
 mtu 1500
[edit]
vyos@cr01a-vyos# commit
[ interfaces bonding bond0 vif 20 ]


[ interfaces bonding bond0 vif 20 address 192.168.100.2/24 ]


[ interfaces bonding bond0 ]
Can't configure both static IPv4 and DHCP address on the same interface

[[interfaces bonding bond0]] failed
Commit failed

From a technical standpoint, this is entirely possible:

vyos@cr01a-vyos# sudo ip a add 192.168.100.2/24 dev bond0.20 
[edit]
vyos@cr01a-vyos# ping 192.168.100.1
PING 192.168.100.1 (192.168.100.1) 56(84) bytes of data.
64 bytes from 192.168.100.1: icmp_seq=1 ttl=64 time=2.64 ms
64 bytes from 192.168.100.1: icmp_seq=2 ttl=64 time=1.62 ms
64 bytes from 192.168.100.1: icmp_seq=3 ttl=64 time=1.67 ms
64 bytes from 192.168.100.1: icmp_seq=4 ttl=64 time=1.29 ms
^C
--- 192.168.100.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 8ms
rtt min/avg/max/mdev = 1.286/1.802/2.638/0.506 ms
vyos@cr01a-vyos# ip a show bond0.20
7: bond0.20@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 52:54:00:bb:99:6a brd ff:ff:ff:ff:ff:ff
    inet 1.2.3.4/18 brd 255.255.255.255 scope global dynamic bond0.20
       valid_lft 26321sec preferred_lft 26321sec
    inet 192.168.100.2/24 scope global bond0.20
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:febb:996a/64 scope link 
       valid_lft forever preferred_lft forever

Why is this prevented in the configuration? Can we remove the error and allow it?

Details

Difficulty level
Easy (less than an hour)
Version
1.3
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible

Event Timeline

trae32566 updated the task description. (Show Details)
trae32566 updated the task description. (Show Details)
trae32566 changed Difficulty level from Unknown (require assessment) to Easy (less than an hour).
trae32566 changed Version from - to 1.3.
jjakob added a subscriber: jjakob.Apr 13 2020, 11:26 AM

This is a old quirk that's long known (probably was already reported) and
can be worked around by adding a pseudo-ethernet interface with the DHCP
client on it.

Apr 13, 2020 8:15:55 AM trae32566 (Trae E Santiago)
<phabricator@mg.vyos.io>:

trae32566 changed Difficulty level from Unknown (require assessment) to

Easy (less than an hour).

trae32566 changed Version from - to 1.3.

TASK DETAIL
https://phabricator.vyos.net/T2281

EMAIL PREFERENCES
https://phabricator.vyos.net/settings/panel/emailpreferences/

To: trae32566
Cc: Active contributors, Maintainers, trae32566, teadur, jack9603301,

hard, pa4ka, jestabro, Alfa80, dongjunbo, hexes, pasik

Shouldn't it be fixed at some point though? I mean is there a reason this should stay something that has to be worked around?