I was doing an experiment about linux bridge and my network topology is like:
As you can see, there are two hosts located in a LAN, Host1(10.74.68.58) and Host2(10.74.68.47). On Host1, I created a bridge br0 and assigned an IP for it (192.168.3.101). Then I attached eth0 to the bridge:
[[email protected]:~] # bridge link
2: eth0 state UP : <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 master br0 state forwarding priority 32 cost 2
I set the default route as br0 and it is ok to ping 10.74.68.47
:
[[email protected]:~] # ip r
default dev br0 scope link
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.42.1
192.168.3.0/24 dev br0 proto kernel scope link src 192.168.3.101
But things became unexplainable when I set default route to eth0 :
[[email protected]:~] # ip r
default dev eth0 scope link
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.42.1
192.168.3.0/24 dev br0 proto kernel scope link src 192.168.3.101
When eth0 is the default route interface, I try to ping host2 in two different ways:
1, ping 10.74.68.47
Failed. After I checked tcpdump file (captured on interface br0), I found that br0 only received ARP response. So there is no ARP info on interface eth0, thus it can not get the mac of host2. I think this is the right behaviour, is my understanding right?
2, Then I tried ping -I br0 10.74.68.47
I wanted to use -I option to steer clear of default route, but also failed. After I check the tcpdump file (captured on interface br0), I found there is already a pair of icmp echo request and echo reply packet. This confused me a lot. Now that br0 have received echo reply, why can't I ping to host2 successfully?
[[email protected]:~] # ping -I br0 10.74.68.47
2 packets transmitted, 0 received, 100% packet loss, time 1006ms
Can you guys give me some pointers?