Reputation: 223
I'm trying to simulate a little network of 3 machines using QEMU where a machine (deb1) is directly connected with the host and the other 2 machines (deb2, deb3):
Host
|
-----------deb1-----------
| |
deb2 deb3
deb1 is connected to 2 different networks, one (vlan 1) connects deb1 with the host, on the other one (vlan 2) will connect deb1 with the two other machines, so deb1 must listen from the port 1234:
kvm -hda deb1.img -m 256 \
-net nic,vlan=1 -net user,vlan=1 -net nic,vlan=2,macaddr=52:54:00:12:34:57 \
-net socket,vlan=2,listen=localhost:1234
deb2 and deb3 both must be connected to deb1, the only difference is their mac address:
deb2:
kvm -hda deb2.img -m 256 -net nic,vlan=2,macaddr=52:54:00:12:34:01 \
-net socket,vlan=2,connect=localhost:1234
deb3:
kvm -hda deb3.img -m 256 -net nic,vlan=2,macaddr=52:54:00:12:34:02 \
-net socket,vlan=2,connect=localhost:1234
Once the three machines are started I just set their ip address:
deb1:
ifconfig eth1 192.168.10.2
deb2:
ifconfig eth0 192.168.10.3
deb3:
ifconfig eth0 192.168.10.4
Here the problem:
the connection between deb1
and deb2
works perfectly,
but not the one between deb1
and deb3
. When I shutdown deb2
then the connection between deb1
and deb3
start to works. It looks like deb1
is not able to listen at the same time deb2
and deb3
.
What am I doing wrong?
I actually followed what is written in this guide (look at the section 4.2 Guest-only network: "When you want to use more than three guest OSes, just connect to the one. Use different macaddr.") and this article
Upvotes: 1
Views: 1532
Reputation: 314
-net socket,{listen|connect}=...
is only suitable for 1:1 connections.
netstat -anp46|grep qemu
shows that there is no connection between qemu of deb3 and deb1.
Use -net socket,mcast=...
instead.
Upvotes: 2