Sample Header Ad - 728x90

Why two bridged veth cannot ping each other?

3 votes
1 answer
3547 views
I need to set up a network environment where two veth interfaces is attached to one bridge and they need to be able to communicate with each other. So I execute the following commands in a clean ubuntu shell:
# Create Two veth and attach them to the bridge
sudo ip link add veth0 type veth peer name veth0p
sudo ip link add veth1 type veth peer name veth1p
sudo brctl addbr br0
sudo brctl addif br0 veth0p
sudo brctl addif br0 veth1p

# Set links up
sudo ip link set veth0 up
sudo ip link set veth1 up
sudo ip link set veth0p up
sudo ip link set veth1p up
sudo ip link set br0 up

# Give each veth an IP address
sudo ip addr add 10.0.0.1/24 dev veth0
sudo ip addr add 10.0.0.2/24 dev veth1

# Try to ping one from the other
ping 10.0.0.1 -I veth1
The ping does not work. Could anyone help me on this? What should I do to make veth0 and veth2 being able to ping each other? The output of the ip r s is:
default via 192.168.0.1 dev ens160 proto dhcp src 192.168.0.119 metric 100 
10.0.0.0/24 dev veth0 proto kernel scope link src 10.0.0.1 
10.0.0.0/24 dev veth1 proto kernel scope link src 10.0.0.2 
192.168.0.0/24 dev ens160 proto kernel scope link src 192.168.0.119 
192.168.0.1 dev ens160 proto dhcp scope link src 192.168.0.119 metric 100
The purpose of this is to put those two veth interfaces into a VXLAN overlay network later. But for development purpose, I want to test the bridge and the two interfaces without the VXLAN been set up at this point. (But even though there is no VXLAN set up, they should be able to ping each other as long as they are on the same bridge right?) Thank you!
Asked by Entropy Xu (31 rep)
Jun 24, 2021, 06:15 AM
Last activity: Oct 24, 2021, 04:30 PM