2 qemu hosts connect to each other in CentOS

1. Boot 2 qemu hosts with the following commands:
"
qemu-system-x86_64 -smp 4 -hda ubuntu1604-svr-1.img -m 4G -device virtio-net,netdev=br1 -netdev tap,id=br1,ifname=tap0,script=no,downscript=no -vnc :1 &
qemu-system-x86_64 -smp 4 -hda ubuntu1604-svr-2.img -m 4G -device virtio-net,netdev=br1 -netdev tap,id=br1,ifname=tap1,script=no,downscript=no -vnc :2 &
"

2. 2 NICs are generated, one is tap0, the other is tap1. With the following commands, the 2 NICs are added to br0.
"
brctl addif br0 tap0
brctl addif br0 tap1
ip link set tap0 up
ip link set tap1 up
ip link set br0 up
ip addr add 1292.168.1.1/24 dev br0
"

3. In the 2 qemu hosts, 192.168.1.2/24 is assigned to one host, 192.168.1.3/24 is assigned to the other host.

Then the 2 qemu hosts can communicate with each other.
 

发布了234 篇原创文章 · 获赞 12 · 访问量 24万+

猜你喜欢

转载自blog.csdn.net/mounter625/article/details/103649350