Hi All ,
I am creating linux_based network namespaces using trex.
I understand one end of veth pair is within namespace and the other end is in default linux namespace .
My trex_cfg used interface named test .
- port_limit: 2
version : 2
#c : 3
interfaces: ['test', 'dummy']
stack : linux_based
low_end : true
low_end_core: 15
DPDK args
xx --lcores (0,1,2)@15 -n 4 --log-level 8 --main-lcore 0 --vdev=net_af_packet1000000,iface=test,blocksz=593920,framesz=9280,framecnt=256 --no-pci --no-huge -m 250 --legacy-mem
trex(service)>ns show-node -p 0 --mac 00:01:02:03:04:05
Setting port 0 in with namespace configuration [SUCCESS]
wait_for_async_results [SUCCESS]
{'nodes': [{'bpf': '',
'ether': {'src': '00:01:02:03:04:05'},
'ipv4': {'dst': '2.2.2.11', 'src': '2.2.2.110'},
'ipv6': {'enabled': False},
'is-shared-ns': False,
'is_bird': False,
'linux-ns': 'trex-a-0-1',
'linux-veth-external': 'trex-a-0-1-T',
'linux-veth-internal': 'trex-a-0-1-L',
'vlan': {'tags': [622], 'tpids': []},
'vlan_filter': 'no_tcp_udp'}]}
trex(service)>
On host :
38: trex-a-0-1-T@if37: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9280 qdisc noqueue state UP group default qlen 1000
link/ether fa:eb:bb:53:97:8d brd ff:ff:ff:ff:ff:ff link-netns trex-a-0-1
53: test: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 9000 qdisc mq state UP group default qlen 1000
link/ether 0e:05:9b:7f:72:89 brd ff:ff:ff:ff:ff:ff
altname enp108s0f0v20
inet6 fe80::c05:9bff:fe7f:7289/64 scope link
valid_lft forever preferred_lft forever
Inside namespace :
ip netns exec trex-a-0-1 ip addr show
37:
trex-a-0-1-L@if38: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9280 qdisc noqueue state UP group default qlen 1000
link/ether 00:01:02:03:04:05 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet
2.2.2.110/32 scope global trex-a-0-1-L
valid_lft forever preferred_lft forever
ip netns exec trex-a-0-1 ip route show
default via 2.2.2.11 dev trex-a-0-1-L
2.2.2.11 dev trex-a-0-1-L scope link
Can someone help me understand , how arp and ping works , when i try pinging 2.2.2.11 which is outside host and resides on DUT ?
How does that namespace know that the packets have to be routed through linux interface test ?
When i check trex_stack_linux_based.cpp, i see the veth being bound to a linux socket sockfd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));.Further i am unable to understand how routing takes place. Can someone please help me understand this?