1

Edit: More information about my setup as requested in the comments: My system consists of three network cards: enp1s0, interface1 and interface2.

enp1s0 is the motherboard integrated NIC, connected to the internet.

interface1 and interface2 are two other NICs (with two ports, but only the first one of each one is used) that are connected to a second, LAN only network. They are both connected to the same switch, same VLAN, same subnet.

The result of ip -d link show is:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 promiscuity 0 addrgenmode eui64 
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 2c:27:d7:19:dd:97 brd ff:ff:ff:ff:ff:ff promiscuity 0 addrgenmode none 
3: interface1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 1000
    link/ether 00:20:fc:32:31:36 brd ff:ff:ff:ff:ff:ff promiscuity 0 addrgenmode eui64 
4: interface1-2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 1000
    link/ether 00:20:fc:32:31:38 brd ff:ff:ff:ff:ff:ff promiscuity 0 addrgenmode eui64 
5: interface2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 1000
    link/ether 00:20:fc:32:60:12 brd ff:ff:ff:ff:ff:ff promiscuity 0 addrgenmode eui64 
6: interface2-2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 1000
    link/ether 00:20:fc:32:60:14 brd ff:ff:ff:ff:ff:ff promiscuity 0 addrgenmode eui64 

I'm exploring A.B's comment in this question as a workaround to my issue. As a summary, so you don't have to read that whole question: I try to setup two NICs, interface1 and interface2, in two separate network namespaces to handle IGMP queries and report independently on each card even though the two cards are connected to the same network.

My question has to do with the setup of the namespaces. Here is how I do it:

# Add a new namespace named interface1Namespace
sudo ip netns add interface1Namespace
# Add a new namespace named interface2Namespace
sudo ip netns add interface2Namespace

# Check that both namespaces exist
ip netns list

# Set interface1 to be in the interface1Namespace namespace
sudo ip link set interface1 netns interface1Namespace
# Set interface2 to be in the interface2Namespace namespace
sudo ip link set interface2 netns interface2Namespace

# Give interface1 an IP address.
sudo ip -n interface1Namespace addr add 25.25.40.116/24 dev interface1
# Give interface2 an IP address.
sudo ip -n interface2Namespace addr add 25.25.40.134/24 dev interface2

# Bring up loopback inside the interface1Namespace namespace
sudo ip netns exec interface1Namespace ip link set dev lo up
# Bring up loopback inside the interface2Namespace namespace
sudo ip netns exec interface2Namespace ip link set dev lo up

# Bring up interface1 inside the interface1Namespace namespace
sudo ip netns exec interface1Namespace ip link set dev interface1 up
# Bring up interface2 inside the interface2Namespace namespace
sudo ip netns exec interface2Namespace ip link set dev interface2 up

# Check that the interface1 interface is working in the interface1Namespace namespace
sudo ip netns exec interface1 ifconfig
# Check that the interface2 interface is working in the interface2Namespace namespace
sudo ip netns exec interface2 ifconfig

# Add default gateway for the interface1Namespace namespace
sudo ip netns exec interface1Namespace ip route add default via 25.25.40.1 dev interface1
# Add default gateway for the interface2Namespace namespace
sudo ip netns exec interface2Namespace ip route add default via 25.25.40.1 dev interface2

# Check that the interface1Namespace route table has the default gateway
sudo ip netns exec interface1Namespace ip route show
# Check that the interface2Namespace route table has the default gateway
sudo ip netns exec interface2Namespace ip route show

Here's the output:

interface1Namespace
interface2Namespace
interface1 Link encap:Ethernet  HWaddr 00:20:fc:32:31:36  
          inet addr:25.25.40.116  Bcast:0.0.0.0  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:47434 errors:0 dropped:5 overruns:0 frame:0
          TX packets:54 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4374863 (4.3 MB)  TX bytes:8324 (8.3 KB)

interface2 Link encap:Ethernet  HWaddr 00:20:fc:32:60:12  
          inet addr:25.25.40.134  Bcast:0.0.0.0  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:44231 errors:0 dropped:7 overruns:0 frame:0
          TX packets:172 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4067463 (4.0 MB)  TX bytes:25394 (25.3 KB)

default via 25.25.40.1 dev interface1 linkdown 
25.25.40.0/24 dev interface1  proto kernel  scope link  src 25.25.40.116 linkdown 
default via 25.25.40.1 dev interface2 linkdown 
25.25.40.0/24 dev interface2  proto kernel  scope link  src 25.25.40.134

If I run:

sudo ip netns exec interface1Namespace ip -d link show interface1

It outputs:

3: interface1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
    link/ether 00:20:fc:32:31:36 brd ff:ff:ff:ff:ff:ff promiscuity 0 addrgenmode eui64 

If I run:

sudo ip netns exec interface2Namespace ip -d link show interface2

It outputs:

5: interface2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
    link/ether 00:20:fc:32:60:12 brd ff:ff:ff:ff:ff:ff promiscuity 0 addrgenmode eui64 

And if I try to ping 25.25.40.1 on either namespace, I get no answer. What am I missing?

I find it also weird that the routing table for interface2 does not report linkdown on 25.25.40/24...

  • there's written "linkdown" which shouldn't happen. Can you add the output of ip -d link show interface1. Explaining how you created this interface would help too: is it an unplugged standard interface? Or it's veth (requires more config) or macvlan with its "master" down? – A.B May 27 at 12:25
  • I've added more information in the post as requested, both at the start to explain my setup and at the end. I don't use virtual interfaces because I figure I don't need to connect to the default routing table at all, the applications using interface1 and interface2 usually only need to know about the LAN. – PhilippeAtM May 27 at 13:14
  • sorry but it appears the -d option wasn't done, or output was cut. -d is to add details, especially telling if it's macvlan or something else. Anyway it's clear: network is down – A.B May 27 at 13:45
  • That is with the -d... the result without -d is: 3: interface1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000 link/ether 00:20:fc:32:31:36 brd ff:ff:ff:ff:ff:ff – PhilippeAtM May 27 at 14:13
  • ok please set the interfaces up and add the defautl route. the interfaces are down. also the carrier must be present too (else plug the cable etc) – A.B May 27 at 15:22

Your Answer

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

Browse other questions tagged or ask your own question.