Skip to content

[BUG] netlab capture is broken for network namespaces #2870

@DanPartelly

Description

@DanPartelly

Describe the bug

I stumbled upn this one because Edgeshark's capture plugging is broken with Wireshark 4.6.1, so I needed another way.

Netlab capture expects a valid node and interface name to be able to capture from said interface.

netlab capture r1 Ethernet0/2
Starting packet capture on r1/Ethernet0/2: sudo ip netns exec clab-vpn-r1 tcpdump -i Ethernet0/2 --immediate-mode -l -vv
tcpdump: Ethernet0/2: No such device exists
(No such device exists)
netlab capture r1 Ethernet0-2
[FATAL]   capture: Invalid interface name Ethernet0-2 for node r1 (device iol)
[HINT]    Use "netlab report --node r1 addressing" to display valid interface names and their descriptions

The problem is containerlab sets the aliases like "Ethernet0-2" on the interfaces. This name is not a valid interface name for netlab (it also won't accept "eth2").

Linux kernel won't accept a "/" in the interface name

#sudo ip link property add dev enp13s0 altname Ethernet0/1
[sudo] password for root: 
Error: argument "Ethernet0/1" is wrong: not a valid altname
#sudo ip link property add dev enp13s0 altname Ethernet0-1
#ip link

2: enp13s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether xxxxxx  brd ff:ff:ff:ff:ff:ff
    altname enxxxxxxxx
    altname Ethernet0-1

Please see the aliases set by clab:

#sudo ip netns exec clab-vpn-r1 bash -i
# ip addr

13: eth1@if14: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9500 qdisc noqueue state UP group default 
    link/ether aa:c1:ab:31:1c:83 brd ff:ff:ff:ff:ff:ff link-netns clab-vpn-isp_a
    altname Ethernet0-1
    inet6 fe80::a8c1:abff:fe31:1c83/64 scope link proto kernel_ll 


Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions