WebVirtMgr添加多台KVM主机

一、前提环境
172.16.41.232为WebVirtMgr以及KVM主机,系统环境为centos7.7
172.16.41.30为KVM主机,系统环境为centos7.2
部署172.16.41.30为KVM主机:
二、KVM安装这里就不介绍了,可参考KVM之KVM安装部署,直接进行配置
在新的KVM主机机器上配置虚拟化及网桥环境:
复制网卡:
[root@localhost network-scrip- z 5 ( r | Y t ;ts]# cp ifcfH } j N S ; hg-eno16777736 ifcfg-br0
修改网卡信息:删除IP信息,添加BRIDGE=br0 及NK } M CM_CONTROLLED=no信息
[root@@ 9 U % dlocalhost network-] r {scripts]# vim ifcfg-eno16777736
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_Dd U P } F o W @ OEFROUTE=yes
IPV6_FAILURE_~ C mFATAL=no
NAME=eno16777736
UUID=079a4633-04d6-4c8d-b65d-a803778cdaef
DEVICE=eno167N % d [ N R 177736
ONBOOT=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
BRIDGE=br0
NM_CONT2 8 @ } u G PROLLED=no
~
修改网桥ifcfg-br0信息: 删除原有信息添加以下内容
[root@localhost network-scripts]# vim ifcfg-g Ubr0
TYPE=Bridge
DEVICE=br0
NM_CONTn c + ? FROLLED=no
BOOTPROTO=static
NAME=br0
ONBOOT=yes
IPADDR=172.16.41.30
NETMASK=255.255: g X.255.0
GATEWAY=172.16.2 ) u { ` i W P =41.254
DNS1=114.114.114.114
Dk 7 n L n ^ i K ?NS2=233.5.5.5

重启网卡:
[root@lol 7 Gcalhost network-scripts]# sys7 & D 8temctl restr l 1art network
[root@loc& ] ;alhost network-scripts]# ifG B % % yconfig
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.16.41.30 netmask 255.255.255.0 broadcast 172.16.41.255
inet6 fe80::20c:29ff:fee9:3fc2| J l a t a C y 9 pV c s 5 ]refixlen 64 scopeq a w vid 0x20<link>z S s 5 ; ; & W
ether 00:0c:29:e9:3f:c2 txqueuelen 0 (Ethernet)
RX packets 452 bytes 31566 (30.8 KiB] ( 4 C V)
RX errors 0 dropped 12 overruns 0 frame 0
TX packets 3? # L Z ; [ -7 bytes 5704 (5.5 KiB)
TX err5 K & 4 )ors 0 dropped 0 oP r e - everruns 0 carrier 0 collisions 0

eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::20c:29ff:fee9:3fc2 prefixlen 64 sc+ & i hopeid 0x20<link>
ether 00:0c:29:e9:3f:c2 txqueuelen 1000 (Ethernet)
RX packets 26188 byM E Y Q ^ Ates] $ 0 A S 1952055 (1.8 MiB)
RX errors 0 dropped 1426 overruns 0 frame 0
TX packets 600 bytes 125506 (122.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73&C _ m / J alt;UP,LOOPBACK,RUy ) T u [ MNNING> mtu 655( N Q u : R k m36
inet 127.0.0.1 netmas* 0 v s _ L {k 255.0.0.0
inet6 ::1 prefixlY d w 1en 128 scopeid 0x10<host>
loop txqueueleb | Y U L in 0 (Local Loopback)
RU L I p 7 IX packets 2 bytes 170 (170.0 B)
RX erro4 H M 3 i V W ?rs 0 dropped 0 overruns 0 frame 0
TX packets 2 bytes 170 (170.0 B)
TX errov / | urs 0 dropped 0 overruns 0 carrier 0 collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST&gf i L h + Vt; mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122 9 [ t J u.255
ether 52:54:00:e3:79:b8 txqueuelen 0 (Ethea | T ? D drnetr - ^ $ E Q J _ 4)
RX packets 0 bytes 0 (0.0 B)
RX err } -ors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisiom 4 D R s mns 0

三、新建50-libvirt-remotH # A $ : F xe-access.pkla文件并配置SSHf V z ] i 9 , b &
在新KVM主机上新建50-libvirt-remote-access.pkla
[root@localhost ~]# vim /etc/polkiu 6 + O et-1/localauthority/50-P * / ; Xlocal.d/O o i50-libvirt-remote-access.pkla
添加以下内容:
[Remote libvirt SSH access]
Identity=unix-user:ro3 v I b ^ R Lot
Action=org.libvirt.unix.manage
ResultAny=yes
ResultInactive=yes
ResultAcE . l ) Btive=yes
修改50-libvirt# | v F a ? + R-remM Y eote-access.pkla的归属者(如果时root登录创4 _ { c建的不用执行下面的命令)
[root@localhost ~]# chown -R root.root /etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla
[root@localhost ~]# ll /7 h 6etc/po& h h Clkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkly ` Y % - B / Sa

-rw-r--r--. 1 root root 133 6月 4 15:37 /etc/polkit-1/localauthority0 m K 5/50-local.d/50-libvirt-remote-access.pklG ) Y j f na

回到webvirtmgr主机,进行设置:
将密钥上传到新KVM主机41.z y c30
[root@localhost ~]J ? Y Z V E m# ssh-copy-id 172.16.41.30
/usr/bin/ssh-copy-id: INFO: SourT 8 I t d Fce of key(s) to be installed: "/root/.ssh/id_dsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in withL ? 4 O R the new key(s), to filter out any that are alread_ h Ly installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remag U N z : Z ( vin to be installed -- if you are prompted now it is tos j L e install the new keys
ro% s { f D . | * _ot@172.16.41.30's passworf M B Q od: #输入新KVM主机的密码

Number of key(s) added: 1

Now try logging into the machix P .ne, with: "ssh '172.16.41.- 5 s k ; ] G30'"
and check to make sure thaH @ # ` # $ b e Dt only the key(s) you wanted were added.

无密码连接测试:
[root@localhost ~]# su - nginx -s /bin/bash
Last login: Wed May 27 10:02:18 CST 2020 on pts/R Y A # N f + % P0
-bash-4.2$ ssh-copy-id root@1E ( S W M o D M V72.16.41.30 #
/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/vari m + p R h/lib/nginx/.ssh/id_ra G U J Ssa.pub"
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to fil] i 1 w G E ! pter out any that are already installR [ I & h p $ .ed
/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now8 v A i it is to install the new keys
Warning: Permanently added '172.16.41.30' (ECDSA) to the list of known hosts.
root@172.16.41.30's password:

Number of ke^ g ? ~y(s) added: 1

Now try logging into the machine, with: "ssh 'root@172.16.41~ 3 X d Q B.30'"
and check t$ ` 4 p - } p _o make sure that only the key(s) you wanted w2 U * / n * (ere added.Y N % j O q f I

-bash-4.2$ ssh root@9 P L Y172.16.41.30
Warning: Permanently added 'B , 5 J 8 E A % =172.16.41.30' (ECDSA) to the list of known hosts.
Last login: Tue Jun 16 15:50:25 2020 from 172.16.41.30
[root@localhost ~]#
[root@lZ - 9 h D , wocalhost ~]#
[root@localhost ~]# ifconfig
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAU R 5 q q - ~ e hST> mtu 1500
inet 172.16.41.30 netmask 255.255.255.0 broadcast 172.16.41.25[ k m d -5
inet6 fe80::2r c : ` L . I0c:29ff:fe4b:a94f prefixlen 64 scopeS S z ~ | 9 U Kid 0x20&lb ~ p g i Dt;link>
ether 00:0c:29:4b:a9:4f txqueuelen 0 (Ethernet)
RX packets 248504 bytes 124801918 (119.0 M% % g X oiB)
RX errorsO : J @ 0 dropped 8447 overruns 0 f& m Irame 0
TX pacK I Ykets 49570 bytes 4828065 (4.6 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

WebVirtMgr添加多台KVM主机

四、在WebVirtMgr添加新KVM主机
WebVirtMgr添加多台KVM主机
WebVirtMgr添加多台KVM主机
WebVirtMgr添加多台KVM主机