# create ns1, ns2ip netns add ns1
ip netns add ns2
# create veth1, veth2ip link add veth1 type veth peer name veth2
# set veth1 for ns1, set veth2 for ns2ip link set dev veth1 netns ns1
ip link set dev veth2 netns ns2
# set veth1 ip, set veth2 ipip netns exec ns1 ip addr add 172.16.0.1/24 dev veth1
ip netns exec ns2 ip addr add 172.16.0.2/24 dev veth2
# set veth1 up, set veth2 upip netns exec ns1 ip link set dev veth1 up
ip netns exec ns2 ip link set dev veth2 up
# show ip addressip netns exec ns1 ip addr
ip netns exec ns2 ip addr
# test for ping ip netns exec ns1 ping 172.16.0.2
ip netns exec ns2 ping 172.16.0.1
# recovery all setting ip netns delete ns1
ip netns delete ns2
# create ns1ip netns add ns1
# create veth0, veth1ip link add veth0 type veth peer name veth1
# create bridge0ip link add bridge0 type bridge
# set veth1 for ns1ip link set dev veth1 netns ns1
# set veth0 for bridge0ip link set dev veth0 master bridge0
# set veth0 ip addressip addr add 172.16.0.1/24 dev veth0
# set bridge0 ip addressip addr add 172.16.0.0/24 dev bridge0
# set veth1 ip addressip netns exec ns1 ip addr add 172.16.0.2/24 dev veth1
# set veth0, veth1, bridge0 upip link set dev veth0 up
ip link set dev bridge0 up
ip netns exec ns1 ip link set dev veth1 up
# delete veth0 routeip route del 172.16.0.0/24 dev veth0
# show ip addressip addr
ip netns exec ns1 ip addr
# test for ping ping 172.16.0.2
ip netns exec ns1 ping 172.16.0.1
# recovery all setting ip netns del ns1
ip link del bridge0