In fact I have the following configuration:
extrouter(192.168.1.1) <- wifi -> [eth2 (192.168.1.11) Centos 6/6 based host br0 (172.22.5.254)]
br0 contains two tap interfaces (tap0/172.22.5.1 tap1/172.22.5.2) from virtual machines (kvm), the gw inside VMs is 172.22.5.254.
If only a single virtual machine is connected to br0 all works well. I cant ping from VM 192.168.1.1 and tcpdump for eth2 shows 192.168.1.11 as outgoing address, masquerading works as expected. But if I add the second VM (the order of VMs are not important) the outgoing address changes to the 172.22.5.254. After removing one of VM from the bridge all goes back and starts working again.
Bridge has its own mac address, so adding an interface shouldn't change anything.
Any ideas what may be wrong?
# brctl show br0 bridge name bridge id STP enabled interfaces br0 8000.026adbaf3564 no tap0 tap1 # netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 172.22.5.0 0.0.0.0 255.255.255.0 U 0 0 0 br0 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2 192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth2
Now I see why I get such outgoing address:
POSTR: IN= OUT=br0 PHYSIN=tap0 PHYSOUT=tap1 SRC=172.22.5.1 DST=192.168.1.1 LEN=84 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=ICMP TYPE=8 CODE=0 ID=59404 SEQ=1
It looks like routing issue. But where ...