0

I am having a UDP issue with the following bridging setup (Linux 5.11.6):

(let ns${i} denote namespaces and left${i}/right${i} be veth pairs)

ns1{right1(x.x.x.1)---}---ns2{---left1::bridge(x.x.x.2)::right2---}--ns3{---left2(x.x.x.3)}

ie: there are three namespaces linked by pairs of veth interfaces and in the middle namespace left1 and right2 are subjugated under a bridge.

Now, when I setup a udp sender inside of namespace 3 sending to x.x.x.1 & x.x.x.2 and setup a listener inside of ns2 on the bridge, everything works fine and packets are received (on x.x.x.2). But, if I start another listener on x.x.x.1, suddenly both listeners no longer receive any messages. Does anyone know what is going on here? Let me know if there is any additional information that might be helpful.

1
  • 2
    Could you give the exact commands you are using for your setup so it can be reproduced?
    – A.B
    Mar 18, 2021 at 15:42

1 Answer 1

0

In case anyone stumbles across this:

The issue was that the veth pairs were all defaulting to the same mac addresss, causing general confusion when routing packets across the bridges. My, now working, setup is generated by the following script (note: the random mac addresses to prevent conflict).

#!/usr/bin/perl
use strict;
use warnings;
use v5.32;

my @nodes;
my @ifaces;
my $num_nodes = 7;

sub rand_mac {
    my $mac = "200";
    $mac .= sprintf( "%x", rand 16 ) for 1 .. 9;
    $mac =~ s/(..)/$1:/g;
    return $mac =~ s/:$//r;
}

foreach ( 1 .. $num_nodes ) {
    my $n = "ns$_";
    qx/ip netns add $n/;
    push @nodes, $n;
}

foreach my $i (1 .. ($num_nodes + 1) ) {
    my ( $lnode,  $rnode )  = ( $nodes[ $i - 1 ], $nodes[$i] );
    my ( $left,   $right )  = ( "right", "left" );    # INDEED
    my ( $l_mac,  $r_mac )  = ( rand_mac(), rand_mac() );
   
    say "init $left ($lnode: $l_mac) -- $right ($rnode: $r_mac)";

    qx/ip link add $left type veth peer name $right/;
    qx/ip link set $left netns $lnode/;
    qx/ip link set $right netns $rnode/;
    qx/ip netns exec $lnode ip link set $left address $l_mac/;
    qx/ip netns exec $rnode ip link set $right address $r_mac/;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.