如何使用它virt-install
来创建基本安装?
$ cat kvm/install_example
virt-install \
--name AsteriskNOW \
--ram=2048 \
--vcpus=2 \
--disk pool=default,size=30,bus=virtio,format=qcow2 \
--cdrom /home/thufir/Downloads/AsteriskNow-1013-current-64.iso \
--network bridge=kvmbr0,model=virtio \
--graphics vnc,listen=0.0.0.0,password=Qwerty1234 \
--boot cdrom,hd,menu=on
$ ./kvm/install_example
WARNING No operating system detected, VM performance may suffer. Specify an OS with --os-variant for optimal results.
Starting install...
Allocating 'AsteriskNOW.qcow2' | 30 GB 00:00:00
ERROR Cannot get interface MTU on 'kvmbr0': No such device
Removing disk 'AsteriskNOW.qcow2' | 0 B 00:00:00
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
virsh --connect qemu:///system start AsteriskNOW
otherwise, please restart your installation.
$ virsh --connect qemu:///system start AsteriskNOW
error: failed to get domain 'AsteriskNOW'
error: Domain not found: no domain with matching name 'AsteriskNOW'
我需要设置桥接吗?
$ virsh net-list --all
Name State Autostart Persistent
----------------------------------------------------------
default active yes yes
$ brctl show
bridge name bridge id STP enabled interfaces
docker0 8000.02429143faf6 no
virbr0 8000.52540020bae1 yes virbr0-nic
$ brctl show virbr0
bridge name bridge id STP enabled interfaces
virbr0 8000.52540020bae1 yes virbr0-nic
$ ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 0.0.0.0
ether 02:42:91:43:fa:f6 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eno1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether c8:9c:dc:28:86:ca txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 20 memory 0xfe700000-fe720000
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 11162 bytes 994283 (994.2 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 11162 bytes 994283 (994.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:20:ba:e1 txqueuelen 1000 (Ethernet)
RX packets 32 bytes 2988 (2.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 68 bytes 6154 (6.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlx74da3889c88b: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.5 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::cde:e1f7:5175:b3c0 prefixlen 64 scopeid 0x20<link>
ether 74:da:38:89:c8:8b txqueuelen 1000 (Ethernet)
RX packets 1188126 bytes 1537049311 (1.5 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 744516 bytes 72479274 (72.4 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
只有指南似乎假设我正在使用,eth0
而实际上它是wi-fi
.这会如何改变/etc/network/interfaces
?
$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
答案1
ERROR Cannot get interface MTU on 'kvmbr0': No such device
我通过重新启动 libvirt 守护进程解决了这个问题:
sudo systemctl restart libvirtd
对于较新的发行版的使用:libvirt。
答案2
改变
--network bridge=kvmbr0,model=virtio \
到:
--network bridge=virbr0,model=virtio \
正如您在ifconfig
命令输出中看到的那样。网桥应指向现有的虚拟接口。