In the past, using qemu-kvm to run virtual machines is basically a nat method. virtual machines can access external networks and basically meet their own requirements, but they cannot access the virtual machines. Now, because we need to deploy the environment on the Virtual Machine for Virtual Network Management of openstack, we need the correct access between virtual machines and the ip address for external access.
Environment Configuration
Hardware: cpu dual-core, four threads, 8 GB memory
OS: ArchLinux 64
Note:: The NetworkManager service may make the bridge unable to run normally. Disable the NetworkManager service, systemctl disable NetworkManager, and systemctl stop NetworkManager before configuration.
Manually configure the bridge
- Install bridge-utils: pacman install bridge-utils
- First, change the ip address of the eth0 NIC: ifconfig eth0 0.0.0.0 (some system NICs may be named differently, such as em0 in pci operation)
- Nic binding: brctl addbr br0; brctl addif eth0; ifconfig br0 10.68.7.x up;
- /Etc/qemu-ifup: Add tap0 to the bridge
- /Etc/qemu-ifdown: delete tap0 from the bridge
- In some cases, you need to modify your route: route add default gw 10.68.7.x
- Modify the resolv. conf file (other systems may be resolv)
- Start qemu-system-x86_64 -- enable-kvm-net nic-net tap, ifname = tap0-vnc: 1-m 2048-smp 2-hda fedora. img
Configure the bridge through the configuration file
- Install bridge-utils: pacman install bridge-utils
- Modify the NIC configuration file/etc/network/bridge (Other Nic managers may be under/etc/sysconfig/network-scripts)
- /Etc/qemu-ifup: Add tap0 to the bridge
- /Etc/qemu-ifdown: delete tap0 from the bridge
- Start qemu-system-x86_64 -- enable-kvm-net nic-net tap, ifname = tap0-vnc: 1-m 2048-smp 2-hda fedora. img
The route After configuring ifconfig