Page MenuHomeVyOS Platform

Support veth interfaces to working with netns
Closed, ResolvedPublicFEATURE REQUEST

Description

Support virtual-ethernet vethX interfaces to working with netns (netowrk namespace)

Details

Version
-
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Feature (new functionality)

Event Timeline

Viacheslav changed the task status from Open to In progress.May 28 2023, 7:08 AM
Viacheslav claimed this task.
Viacheslav closed this task as Resolved.EditedSep 20 2023, 12:13 PM
Viacheslav moved this task from Backlog to Finished on the VyOS 1.4 Sagitta board.
set netns name mgmt
set interfaces virtual-ethernet veth1 address '10.0.0.0/31'
set interfaces virtual-ethernet veth1 peer-name 'veth10'
set interfaces virtual-ethernet veth10 address '10.0.0.1/31'
set interfaces virtual-ethernet veth10 netns 'mgmt'
set interfaces virtual-ethernet veth10 peer-name 'veth1'

Test:

vyos@r4:~$ ping 10.0.0.1
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.052 ms
64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=0.053 ms
^C
--- 10.0.0.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1026ms
rtt min/avg/max/mdev = 0.052/0.052/0.053/0.000 ms
vyos@r4:~$ 
vyos@r4:~$ sudo ip netns exec mgmt ip a
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
10: veth10@if11: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 4e:a4:aa:2a:27:74 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 10.0.0.1/31 scope global veth10
       valid_lft forever preferred_lft forever
    inet6 fe80::4ca4:aaff:fe2a:2774/64 scope link 
       valid_lft forever preferred_lft forever
vyos@r4:~$

Enter in netns

vyos@r4:~$ force netns mgmt 
vyos@r4(ns:mgmt):~$ 
vyos@r4(ns:mgmt):~$ show int
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface        IP Address                        S/L  Description
---------        ----------                        ---  -----------
lo               -                                 A/D  
veth10           10.0.0.1/31                       u/u  
vyos@r4(ns:mgmt):~$