-1

i have a linux VM with 2 interfaces, eth0 has mgmt IP and eth1 has configuration as below ip netns exec eng51 ifconfig eth1.51 Link encap:Ethernet HWaddr 52:54:00:bd:68:c3 inet addr:51.51.1.10 Bcast:51.51.1.255 Mask:255.255.255.0

ip netns exec eng52 ifconfig eth1.52 Link encap:Ethernet HWaddr 52:54:00:bd:68:c3 inet addr:51.51.2.10 Bcast:51.51.2.255 Mask:255.255.255.0

ip netns exec eng522 ifconfig eth1.522 Link encap:Ethernet HWaddr 52:54:00:bd:68:c3 inet addr:51.51.2.10 Bcast:51.51.2.255 Mask:255.255.255.0

ip netns exec eng511 ifconfig eth1.511 Link encap:Ethernet HWaddr 52:54:00:bd:68:c3 inet addr:51.51.1.10 Bcast:51.51.1.255 Mask:255.255.255.0

So I have a script which uses tcp protocol and i need to simultaneously send traffic

from eng51[51.51.1.10 vlan-id 51] to eng52[ 51.51.2.10 vlan-id 52] and i use same script to send traffic from eng52[ 51.51.1.10 vlan-id 511] to eng522 [51.51.2.10 vlan-id 522]

I run the script under name different namespaces: ip netns exec eng51 python client.py 51.51.2.10 ip netns exec eng511 python client.py 51.51.2.10

inside client.py i bind the source port to be always 63999 and i have a HTTPserver running on port 8000 for both namespaces eng52 and eng522 sock.bind(('0.0.0.0',63999))

the reason i am binding source port to 63999 is I need source-Address,destination,address,source port, destination port and protocol to be same in both traffic sessions

the problem I face is even though I run this script under different namespaces, the source port is not considered unique. I am unable to run the script under different namespaces at the same time[ due to usage of same port 63999]

0

So I got this working by simply using multiple interfaces, mapping each interface of a VM to a namespace. And then I was able to use source port 63999 at the same time in 2 simultaneous sessions

ip netns eng51 ifconfig eth1.51 Link encap:Ethernet HWaddr 52:54:00:bd:68:c3 inet addr:51.51.1.10 Bcast:51.51.1.255 Mask:255.255.255.0

ip netns exec eng52 ifconfig eth2.52 Link encap:Ethernet HWaddr 52:54:00:bd:68:c3 inet addr:51.51.2.10 Bcast:51.51.2.255 Mask:255.255.255.0

ip netns exec eng522 ifconfig eth3.522 Link encap:Ethernet HWaddr 52:54:00:bd:68:c3 inet addr:51.51.2.10 Bcast:51.51.2.255 Mask:255.255.255.0

ip netns exec eng511 ifconfig eth4.511 Link encap:Ethernet HWaddr 52:54:00:bd:68:c3 inet addr:51.51.1.10 Bcast:51.51.1.255 Mask:255.255.255.0

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.