NIC is Down if namespace is added
by chakka.lokesh from LinuxQuestions.org on (#5FXE3)
I have the following NIC with me.
https://www.broadcom.com/products/et...nic-ocp/p2100g
As I am working on a R&D Project, I have looped back both the slots. where I will be sending on one slot and receiving on another slot.
As both are in same machine/card, I am trying to create namespace using the following:
Code:ip netns add sr0
ip netns exec sr0 ip link set dev lo up
ip link set ens3f0np0 netns sr0
ip netns exec sr0 ip addr add 10.10.10.10/24 dev ens3f0np0
ip netns exec sr0 ip link set dev ens3f0np0 up
ip netns exec sr0 ip addr showOutput I am seeing is :
Code:1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
3: ens3f0np0: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether bc:97:e1:ce:84:f0 brd ff:ff:ff:ff:ff:ff
altname enp131s0f0np0
inet 10.10.10.10/24 scope global ens3f0np0
valid_lft forever preferred_lft foreverCode:ip netns add sr1
ip netns exec sr1 ip link set dev lo up
ip link set ens3f1np1 netns sr1
ip netns exec sr1 ip addr add 10.10.10.11/24 dev ens3f1np1
ip netns exec sr1 ip link set dev ens3f1np1 up
ip netns exec sr1 ip addr showOutput I am seeing is :
Code:1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
6: ens3f1np1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWNgroup default qlen 1000
link/ether bc:97:e1:ce:84:f1 brd ff:ff:ff:ff:ff:ff
altname enp131s0f1np1
inet 10.10.10.11/24 scope global ens3f1np1
valid_lft forever preferred_lft foreverI am seeing both the slots are down, not visible if I do ifconfig
But slots are working fine if I remove the namespaces, and trying sending/receiving packets using
Code:const int sock = socket( PF_PACKET, SOCK_RAW, htons(ETH_P_ALL) );
struct sockaddr_ll my_addr =
{
.sll_family = AF_PACKET,
.sll_protocol = htons(ETH_P_ALL),
.sll_ifindex = if_nametoindex( write_card )
};
bind( sock, (struct sockaddr *)&my_addr, sizeof(struct sockaddr_ll) );can someone help me in understanding why the slots are down if added to namespace, how to make them up, send and receive packets using iperf


https://www.broadcom.com/products/et...nic-ocp/p2100g
As I am working on a R&D Project, I have looped back both the slots. where I will be sending on one slot and receiving on another slot.
As both are in same machine/card, I am trying to create namespace using the following:
Code:ip netns add sr0
ip netns exec sr0 ip link set dev lo up
ip link set ens3f0np0 netns sr0
ip netns exec sr0 ip addr add 10.10.10.10/24 dev ens3f0np0
ip netns exec sr0 ip link set dev ens3f0np0 up
ip netns exec sr0 ip addr showOutput I am seeing is :
Code:1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
3: ens3f0np0: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether bc:97:e1:ce:84:f0 brd ff:ff:ff:ff:ff:ff
altname enp131s0f0np0
inet 10.10.10.10/24 scope global ens3f0np0
valid_lft forever preferred_lft foreverCode:ip netns add sr1
ip netns exec sr1 ip link set dev lo up
ip link set ens3f1np1 netns sr1
ip netns exec sr1 ip addr add 10.10.10.11/24 dev ens3f1np1
ip netns exec sr1 ip link set dev ens3f1np1 up
ip netns exec sr1 ip addr showOutput I am seeing is :
Code:1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
6: ens3f1np1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWNgroup default qlen 1000
link/ether bc:97:e1:ce:84:f1 brd ff:ff:ff:ff:ff:ff
altname enp131s0f1np1
inet 10.10.10.11/24 scope global ens3f1np1
valid_lft forever preferred_lft foreverI am seeing both the slots are down, not visible if I do ifconfig
But slots are working fine if I remove the namespaces, and trying sending/receiving packets using
Code:const int sock = socket( PF_PACKET, SOCK_RAW, htons(ETH_P_ALL) );
struct sockaddr_ll my_addr =
{
.sll_family = AF_PACKET,
.sll_protocol = htons(ETH_P_ALL),
.sll_ifindex = if_nametoindex( write_card )
};
bind( sock, (struct sockaddr *)&my_addr, sizeof(struct sockaddr_ll) );can someone help me in understanding why the slots are down if added to namespace, how to make them up, send and receive packets using iperf