linux - How can I connect Open vSwitch port and virtual ethernet interface? -
what want send packet server through open vswitch in bare metal pc, not on 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
, did below commands.
- create ovs bridge
ovs-vsctl add-br br0
- make eth0 ovs port
ovs-vsctl add-port br0 eth0
- create veth link
ip link add veth1 type veth peer name veth2 ifconfig veth1 ifconfig veth2
- finally, set client arp table statically because ovs port (eth0) cannot send arp reply
after that, tried tcp connection between client , server.
i checked syn packet of client sent veth2. however, server cannot receive packet.
i cannot guess wrong , how can make above environment.
i found solution.
by using network namespace, 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/
- create ovs bridge
ovs-vsctl add-br br0
- make eth0 ovs port
ovs-vsctl add-port br0 eth0
- create veth link
ip link add veth1 type veth peer name veth2
- create network namespace
ip netns add ns1 ip link set veth2 ns1
- set ip , mac of veth2 in ns1 of eth0
after doing that, can below structure
server pc ------------------------------- | ----------------------- | | | ns1 | | | | ------ | | | | |server| | | | | ------ | | | | veth2|(192.168.0.157) | | | ----------------------- | | | | | | | | |veth1 | | ----------- | | | ovs (br0) | | | ----------- | | eth0|(192.168.0.157) | -----------|------------------- | ------|-------- | client pc | ---------------
Comments
Post a Comment