centos7.3 kvm console下安装网络安装centos7.3

前端之家收集整理的这篇文章主要介绍了centos7.3 kvm console下安装网络安装centos7.3前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
PRE-INSTALL

kvm相关安装包及其作用
qemu-kvm主要的KVM程序包
python-virtinst创建虚拟机所需要的命令行工具和程序库
virt-managerGUI虚拟机管理工具
virt-top虚拟机统计命令
virt-viewerGUI连接程序,连接到已配置好的虚拟机
libvirtC语言工具包,提供libvirt服务
libvirt-client为虚拟客户机提供的C语言工具包
virt-install基于libvirt服务的虚拟机创建命令
bridge-utils创建和管理桥接设备的工具

INSTALL


[root@master~]#yuminstallbridge-utilstunctlvirt-managervirt-viewerkvmkmod-kvmqemulibvirtpython-virtinstacpid-y

#查看是否加载kvm模块
[root@master~]#lsmod|grepkvm
kvm_intel1385670
kvm4411191kvm_intel
#如果没有这两条,可以用"modprobekvm"加载;
#相关命令"insmod;rmmod;modinfo"

#启动libvirtd
[root@master~]#systemctlstartlibvirtd;systemctlenablelibvirtd
[root@master~]#systemctllist-unit-files|greplibvirtd
libvirtd.serviceenabled


NETWORKCONFIGURATION

#修改网卡文件ens33
[root@master~]#cd/etc/sysconfig/network-scripts/
[root@masternetwork-scripts]#echo"BRIDGE=br0">>ifcfg-ens33#在ifcfg-e**原网卡文件增加"BRIDGE=br0"

#新建网桥文件ifcfg-br0(网桥名称),增加内容如下
[root@masternetwork-scripts]#viifcfg-br0
*************************************************
DEVICE=br0
TYPE="Bridge"#大小写敏感,所以必须是Bridge
BOOTPROTO="dhcp"
ONBOOT="yes"
DELAY="0"
STP="yes"#这一行是来启动STP,和brctl命令行出来的结果有关
*************************************************

#重启NetworkManager及network服务:
[root@masternetwork-scripts]#systemctlrestartNetworkManager
#当你手动修改了网卡文件后,需要重启NetworkManager服务来重新接管网络配置
#网卡配置文件和NetworkManager配置冲突时,解决方案:{1、重启NetworkManager;2、关闭NetworkManager}

[root@masternetwork-scripts]#systemctlrestartnetwork
[root@masternetwork-scripts]#ipa#ip命令用来查看和管理ip信息
1:lo:<LOOPBACK,UP,LOWER_UP>mtu65536qdiscnoqueuestateUNKNOWN
link/loopback00:00:00:00:00:00brd00:00:00:00:00:00
inet127.0.0.1/8scopehostlo
valid_lftforeverpreferred_lftforever
inet6::1/128scopehost
valid_lftforeverpreferred_lftforever
2:ens33:<BROADCAST,MULTICAST,LOWER_UP>mtu1500qdiscpfifo_fastmasterbr0stateUPqlen1000
link/ether00:0c:29:61:5c:1dbrdff:ff:ff:ff:ff:ff
3:virbr0:<NO-CARRIER,BROADCAST,UP>mtu1500qdiscnoqueuestateDOWN
link/ether52:54:00:b6:45:5bbrdff:ff:ff:ff:ff:ff
inet192.168.122.1/24brd192.168.122.255scopeglobalvirbr0
valid_lftforeverpreferred_lftforever
4:virbr0-nic:<BROADCAST,MULTICAST>mtu1500qdiscpfifo_fastmastervirbr0stateDOWNqlen500
link/ether52:54:00:b6:45:5bbrdff:ff:ff:ff:ff:ff
6:br0:<BROADCAST,LOWER_UP>mtu1500qdiscnoqueuestateUP
link/ether00:0c:29:61:5c:1dbrdff:ff:ff:ff:ff:ff
inet192.168.0.170/24brd192.168.0.255scopeglobaldynamicbr0
valid_lft11979secpreferred_lft11979sec
inet6fe80::20c:29ff:fe61:5c1d/64scopelink
valid_lftforeverpreferred_lftforever
7:vnet0:<BROADCAST,LOWER_UP>mtu1500qdiscpfifo_fastmasterbr0stateUNKNOWNqlen500
link/etherfe:54:00:cb:63:b2brdff:ff:ff:ff:ff:ff
inet6fe80::fc54:ff:fecb:63b2/64scopelink
valid_lftforeverpreferred_lftforever

#查看网桥连接
[root@masternetwork-scripts]#brctlshow#brctl是一个网桥连接管理命令
bridgenamebridgeidSTPenabledinterfaces#如果上面不设置STP=yes,这里就会显示no
br08000.000c29615c1dyesens33
vnet0
virbr08000.525400b6455byesvirbr0-nic


CLOSESELINUX

[root@masternetwork-scripts]#setenforce0
[root@masternetwork-scripts]#getenforce
Permissive
[root@masternetwork-scripts]#vi/etc/selinux/config
******************************************
SELINUX=permissive#修改配置文件使其永久生效
******************************************


CREATEAVM

[root@master~]#mkdir-p/data/kvm
[root@master~]#virt-install--networkbridge=br0--namecentos73--ram2048--vcpus1--diskpath=/data/kvm/centos73.img,size=16--graphicsnone--location'http://mirrors.163.com/centos/7.3.1611/os/x86_64/'--extra-args="console=tty0console=ttyS0,115200"
#详细每个参数的意义可以查看扩展资料
#安装过程会让你选择textmode还是vnc,选择textmode继续安装吧
#如果网络会有问题的话,尽量选择用--cdrom/path/to/centos7.iso
#virt-install--networkbridge=br0--namecentos73--ram2048--vcpus1--diskpath=/data/kvm/centos73.img,115200"

猜你在找的CentOS相关文章