[root@488dacbfe771 /]# ip netns add newns [root@488dacbfe771 /]# ip netns exec newns ip link set dev lo up [root@488dacbfe771 /]# ip link add veth0 type veth peer name veth1 [root@488dacbfe771 /]# ip link set veth1 netns newns [root@488dacbfe771 /]# ip netns exec newns ifconfig veth1 10.1.1.1/24 up [root@488dacbfe771 /]# ifconfig veth0 10.1.1.2/24 up [root@488dacbfe771 /]# ping -c 1 -I veth0 10.1.1.1 PING 10.1.1.1 (10.1.1.1) from 10.1.1.2 veth0: 56(84) bytes of data. 64 bytes from 10.1.1.1: icmp_seq=1 ttl=64 time=0.035 ms
--- 10.1.1.1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.035/0.035/0.035/0.000 ms [root@488dacbfe771 /]# [root@488dacbfe771 /]# ip link add name br0 type bridge [root@488dacbfe771 /]# ip link set br0 up [root@488dacbfe771 /]# ip link set dev veth0 master br0 [root@488dacbfe771 /]# [root@488dacbfe771 /]# ping -c 1 -I veth0 10.1.1.1 PING 10.1.1.1 (10.1.1.1) from 10.1.1.2 veth0: 56(84) bytes of data. ^C --- 10.1.1.1 ping statistics --- 1 packets transmitted, 0 received, 100% packet loss, time 0ms
[root@488dacbfe771 /]# ip addr del 10.1.1.2/24 dev veth0 [root@488dacbfe771 /]# ip addr add 10.1.1.2/24 dev br0 [root@488dacbfe771 /]# ping -c 1 -I br0 10.1.1.1 PING 10.1.1.1 (10.1.1.1) from 10.1.1.2 br0: 56(84) bytes of data. 64 bytes from 10.1.1.1: icmp_seq=1 ttl=64 time=0.040 ms
--- 10.1.1.1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms [root@488dacbfe771 /]# [root@488dacbfe771 /]# ip link set dev eth0 master br0 [root@488dacbfe771 /]# ifconfig eth0 promisc [root@488dacbfe771 /]# ping -c 1 -I br0 1.2.3.102 PING 1.2.3.102 (1.2.3.102) from 1.2.3.101 br0: 56(84) bytes of data. 64 bytes from 1.2.3.102: icmp_seq=1 ttl=64 time=0.024 ms