Basic Info:
root@kvm-host1:~# hostname kvm-host1.ab.lab
root@kvm-host1:~# lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 9.4 (stretch) Release: 9.4 Codename: stretch
root@kvm-host1:~# cat /etc/resolv.conf nameserver 192.168.75.1 search ab.lab
root@kvm-host1:~# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.75.1 0.0.0.0 UG 0 0 0 ens3 192.168.75.0 0.0.0.0 255.255.255.0 U 0 0 0 ens3
root@kvm-host1:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 52:54:00:94:05:d7 brd ff:ff:ff:ff:ff:ff
inet 192.168.75.170/24 brd 192.168.75.155 scope global ens3
valid_lft forever preferred_lft forever
inet6 fe80::5054:ff:fe94:5d7/64 scope link
valid_lft forever preferred_lft forever
root@kvm-host1:~# cat /etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # allow-hotplug ens3 iface ens3 inet static address 192.168.75.170 network 192.168.75.0 netmask 255.255.255.0 broadcast 192.168.75.155 gateway 192.168.75.1 dns-nameservers 192.168.75.1
Check required CPU Flags ('vmx' for Intel or 'svm' for AMD):
root@kvm-host1:~# grep -e vmx -e svm /proc/cpuinfo flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl eagerfpu pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm kaiser tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust smep erms xsaveopt flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl eagerfpu pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm kaiser tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust smep erms xsaveopt flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl eagerfpu pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm kaiser tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust smep erms xsaveopt flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl eagerfpu pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm kaiser tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust smep erms xsaveopt
Install KVM:
root@kvm-host1:~# apt-get install qemu-kvm
Install 'bridge-utils' package:
root@kvm-host1:~# apt-get install bridge-utils
Check the installed packages:
root@kvm-host1:~# dpkg -l | grep qemu ii ipxe-qemu 1.0.0+git-20161027.b991c67-1 all PXE boot firmware - ROM images for qemu ii qemu-kvm 1:2.8+dfsg-6+deb9u3 amd64 QEMU Full virtualization on x86 hardware ii qemu-system-common 1:2.8+dfsg-6+deb9u3 amd64 QEMU full system emulation binaries (common files) ii qemu-system-x86 1:2.8+dfsg-6+deb9u3 amd64 QEMU full system emulation binaries (x86) ii qemu-utils 1:2.8+dfsg-6+deb9u3 amd64 QEMU utilities
root@kvm-host1:~# dpkg -l | grep kvm ii qemu-kvm 1:2.8+dfsg-6+deb9u3 amd64 QEMU Full virtualization on x86 hardware
root@kvm-host1:~# dpkg -l | grep bridge-utils ii bridge-utils 1.5-13+deb9u1 amd64 Utilities for configuring the Linux Ethernet bridge
Basic info about some main packages:
root@kvm-host1:~# dpkg -L qemu-system-common
root@kvm-host1:~# dpkg -L qemu-utils
root@kvm-host1:~# dpkg -L bridge-utils
Check if KVM module is loaded:
root@kvm-host1:~# lsmod | grep kvm kvm_intel 192512 0 kvm 593920 1 kvm_intel irqbypass 16384 1 kvm
Create Bridge
Network before
root@kvm-host1:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 52:54:00:94:05:d7 brd ff:ff:ff:ff:ff:ff
inet 192.168.75.170/24 brd 192.168.75.155 scope global ens3
valid_lft forever preferred_lft forever
inet6 fe80::5054:ff:fe94:5d7/64 scope link
valid_lft forever preferred_lft forever
root@kvm-host1:~# cat /etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # allow-hotplug ens3 iface ens3 inet static address 192.168.75.170 network 192.168.75.0 netmask 255.255.255.0 broadcast 192.168.75.155 gateway 192.168.75.1 dns-nameservers 192.168.75.1
root@kvm-host1:~# cp -av /etc/network/interfaces /root/orig_files/interfaces_before_bridge '/etc/network/interfaces' -> '/root/orig_files/interfaces_before_bridge'
After Bridge:
root@kvm-host1:~# cat /etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # Static network configuration #allow-hotplug ens3 #iface ens3 inet static # address 192.168.75.170 # network 192.168.75.0 # netmask 255.255.255.0 # broadcast 192.168.75.155 # gateway 192.168.75.1 # dns-nameservers 192.168.75.1 # br0 will be using ens3 allow-hotplug ens3 iface ens3 inet static auto br0 iface br0 inet static address 192.168.75.170 network 192.168.75.0 netmask 255.255.255.0 broadcast 192.168.75.155 gateway 192.168.75.1 dns-nameservers 192.168.75.1 #Bridge configuration bridge_ports ens3 bridge_stp off bridge_maxwait 0 bridge_fd 0
Reboot and check results:
root@kvm-host1:~# reboot
root@kvm-host1:~# ip a 1: lo:mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens3: mtu 1500 qdisc pfifo_fast master br0 state UP group default qlen 1000 link/ether 52:54:00:94:05:d7 brd ff:ff:ff:ff:ff:ff 3: br0: mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 52:54:00:94:05:d7 brd ff:ff:ff:ff:ff:ff inet 192.168.75.170/24 brd 192.168.75.155 scope global br0 valid_lft forever preferred_lft forever inet6 fe80::5054:ff:fe94:5d7/64 scope link valid_lft forever preferred_lft forever
root@kvm-host1:~# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.75.1 0.0.0.0 UG 0 0 0 br0 192.168.75.0 0.0.0.0 255.255.255.0 U 0 0 0 br0
root@kvm-host1:~# brctl show bridge name bridge id STP enabled interfaces br0 8000.5254009405d7 no ens3
Install required packages to manage VMs from GUI and CLI:
root@kvm-host1:~# apt-get install virt-manager
root@kvm-host1:~# apt-get install virtinst
root@kvm-host1:~# dpkg -L virt-manager | grep bin /usr/bin /usr/bin/virt-manager
root@kvm-host1:~# dpkg -L virtinst | grep bin /usr/bin /usr/bin/virt-clone /usr/bin/virt-convert /usr/bin/virt-install /usr/bin/virt-xml
No comments:
Post a Comment