Page MenuHomeVyOS Platform

interface virtual-etherne - error when it doesn't use a peer
Closed, ResolvedPublic

Description

there is an issues when trying to add a new interfaces , but it's possible that the remote peer isn't present on same devices or namespace ,so we have this limitation , eg :

vyos@rt-1# set int virtual-ethernet veth1000 address 192.168.10.10/24
[edit]
vyos@rt-1# commit
[ interfaces virtual-ethernet veth1000 ]
Remote peer name must be set for "veth1000"!

however , it's possible to configure or use , perhaps , peer remote is not present in this device (it may be in a namespace or different VM) e.g

sudo ip link add veth1 type veth peer name veth2
sudo ip link set dev veth2 up
sudo ip link set dev veth1 up
sudo ip link add link veth1 veth1.100 type vlan proto 802.1ad id 100
sudo ip link set dev veth1.100 up
sudo ip addr add 1.1.1.4/24 dev veth1.100

Details

Difficulty level
Unknown (require assessment)
Version
VyOS 1.4-rolling-202305061637
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Event Timeline

It is a part of T3829
We should find a solution to check if the interface "neighbor" is in a separate netns. For now, we don't do this check.
veth pair should be in the local router only, VRF or NETNS and it won't work between 2 separate routers or 2 VMs.

Without this check, the router tries to create a new vethpair which already exists.

And our scripts don't check/apply commands in netns for now
For example there is a PoC with dumy interfaces

set netns name ns01
set netns name ns02
set interfaces dummy dum0 netns ns01
commit


set interfaces dummy dum0 description foo
commit

First commit will add dum0 interface to netns ns01

The second commit will fail, as router doesn't see the dummy interface (in this case in default netns), it tries to create a new dummy interface and move it to netns ns01 again

vyos@r14# set interfaces dummy dum0 description foo
[edit]
vyos@r14# commit
[ interfaces dummy dum0 ]
VyOS had an issue completing a command.

Report time:      2023-05-24 09:39:05
Image version:    VyOS 1.4-rolling-202305210317
Release train:    current

Built by:         [email protected]
Built on:         Sun 21 May 2023 03:17 UTC
Build UUID:       e6255891-3418-4fee-956d-7ae72dd875b8
Build commit ID:  ee81a8a182c0e0

Architecture:     x86_64
Boot via:         installed image
System type:      KVM guest

Hardware vendor:  QEMU
Hardware model:   Standard PC (Q35 + ICH9, 2009)
Hardware S/N:     
Hardware UUID:    4d6f4d29-1ae8-446f-8d2b-3decd9da64c7

Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/interfaces-dummy.py", line 73, in <module>
    apply(c)
  File "/usr/libexec/vyos/conf_mode/interfaces-dummy.py", line 64, in apply
    d.update(dummy)
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/interface.py", line 1413, in update
    self.set_netns(config.get('netns', ''))
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/interface.py", line 552, in set_netns
    self.set_interface('netns', netns)
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/control.py", line 183, in set_interface
    return self._set_command(self.config, name, value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/control.py", line 110, in _set_command
    return self._command_set[name].get('format', lambda _: _)(self._cmd(cmd))
                                                              ^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/vyos/ifconfig/control.py", line 52, in _cmd
    return cmd(command, self.debug)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/vyos/util.py", line 161, in cmd
    raise OSError(code, feedback)
FileNotFoundError: [Errno 2] failed to run command: ip link set dev dum0 netns ns01
returned: 
exit code: 2

noteworthy:
cmd 'ip link set dev dum0 netns ns01'
returned (out):

returned (err):
RTNETLINK answers: File exists

[[interfaces dummy dum0]] failed
Commit failed
[edit]
vyos@r14#

Thanks Viacheslav , for this clarification . Veths /Netns are strong powerful , using this technology we can use to join different hypervisor or bridge technology . leave some example namespaces /veth / bridging.

https://linux-blog.anracom.com/2017/11/21/fun-with-veth-devices-linux-bridges-and-vlans-in-unnamed-linux-network-namespaces-v/

part of the brainstorming when we rethink these characteristics.

Viacheslav claimed this task.