Reputation: 195
What I want to do is send a packet to the server through the Open vSwitch in bare metal PC, not on the VM.
For doing that, I'm thinking of following structure.
Server PC ----------------------------- | ------ | | |SERVER| | | ------ | | |veth2 (192.168.0.152)| | | | | |veth1 | | ----------- | | | OVS (br0) | | | ----------- | | |eth0 (192.168.0.157) | -------|--------------------- | -------|-------- | Client PC | ----------------
For making above environment
, I did below commands.
ovs-vsctl add-br br0
ovs-vsctl add-port br0 eth0
ip link add veth1 type veth peer name veth2 ifconfig veth1 up ifconfig veth2 up
After that, I tried to do TCP connection between client and server.
I checked that SYN packet of client is sent to veth2. However, server cannot receive that packet.
I cannot guess what is wrong and how I can make above environment.
Upvotes: 2
Views: 9280
Reputation: 195
I found a solution.
By using a network namespace, I can make logical network stack.
http://man7.org/linux/man-pages/man8/ip-netns.8.html http://blog.scottlowe.org/2013/09/04/introducing-linux-network-namespaces/
ovs-vsctl add-br br0
ovs-vsctl add-port br0 eth0
ip link add veth1 type veth peer name veth2
ip netns add ns1 ip link set veth2 ns1
After doing that, I can get the below structure
Server PC ------------------------------- | ----------------------- | | | ns1 | | | | ------ | | | | |SERVER| | | | | ------ | | | | veth2|(192.168.0.157) | | | ----------------------- | | | | | | | | |veth1 | | ----------- | | | OVS (br0) | | | ----------- | | eth0|(192.168.0.157) | -----------|------------------- | ------|-------- | Client PC | ---------------
Upvotes: 6