前言:
现时小伙伴们对“centos73网卡配置文件”大约比较注重,各位老铁们都需要剖析一些“centos73网卡配置文件”的相关资讯。那么小编也在网摘上汇集了一些有关“centos73网卡配置文件””的相关资讯,希望看官们能喜欢,各位老铁们一起来了解一下吧!一、环境配置要求
Openstack云平台搭建需要两个节点(虚拟机):controller(控制节点)、compute(计算节点)。两节点的操作系统均为CentOS 7。
controller节点
一块250G的硬盘网卡1:192.168.1.31网卡2:192.168.2.31
compute节点
一块250G的硬盘一块100G的硬盘网卡1:192.168.1.33网卡2:192.168.2.33
Openstack搭建需用到CentOS 7版本镜像和chinaskills_cloud_iaas.iso镜像:
CentOS 7镜像下载(这里用了清华大学的镜像,会快些):
chinaskills_cloud_iaas.iso镜像网盘下载:
二、基础环境搭建
本教程的虚拟机基于VMware的vSphere平台创建和管理。
controller节点
安装一台controller节点虚拟机
controller节点虚拟机基本硬件配置:CentOS 7、两张网卡、一块硬盘250G。controller虚拟机CentOS 7系统安装过程这里不赘述,需自行安装。以下是已经安装好了
设置controller节点主机名(设置完重启生效)
[root@localhost ~]# hostnamectl set-hostname controller[root@localhost ~]# reboot
配置controller节点网络
查看网卡配置文件,应有两个网卡的配置文件:ens192和ens224为两张网卡的配置文件
[root@controller ~]# cd /etc/sysconfig/network-scripts/[root@controller network-scripts]# lsifcfg-ens192 ifdown-eth ifdown-ppp ifdown-tunnel ifup-ippp ifup-post ifup-TeamPort network-functions-ipv6ifcfg-ens224 ifdown-ippp ifdown-routes ifup ifup-ipv6 ifup-ppp ifup-tunnelifcfg-lo ifdown-ipv6 ifdown-sit ifup-aliases ifup-isdn ifup-routes ifup-wirelessifdown ifdown-isdn ifdown-Team ifup-bnep ifup-plip ifup-sit init.ipv6-globalifdown-bnep ifdown-post ifdown-TeamPort ifup-eth ifup-plusb ifup-Team network-functions
网卡1配置(ens192):
[root@controller network-scripts]# vi ifcfg-ens192TYPE="Ethernet"PROXY_METHOD="none"BROWSER_ONLY="no"BOOTPROTO="static"DEFROUTE="yes"IPV4_FAILURE_FATAL="no"IPV6INIT="yes"IPV6_AUTOCONF="yes"IPV6_DEFROUTE="yes"IPV6_FAILURE_FATAL="no"IPV6_ADDR_GEN_MODE="stable-privacy"NAME="ens192"UUID="085d4149-ee2e-475c-9c73-4f27763f7ebd"DEVICE="ens192"ONBOOT="yes"IPADDR="192.168.1.31"PREFIX="24"GATEWAY="192.168.1.1"DNS1="8.8.8.8"IPV6_PRIVACY="no"
网卡2配置(ens224):
[root@controller network-scripts]# vi ifcfg-ens224TYPE="Ethernet"PROXY_METHOD="none"BROWSER_ONLY="no"BOOTPROTO="static"DEFROUTE="yes"IPV4_FAILURE_FATAL="no"IPV6INIT="yes"IPV6_AUTOCONF="yes"IPV6_DEFROUTE="yes"IPV6_FAILURE_FATAL="no"IPV6_ADDR_GEN_MODE="stable-privacy"NAME="ens224"UUID="4d99b545-4667-33cb-ab94-cd6ad5d41379"DEVICE="ens224"ONBOOT="yes"IPADDR="192.168.2.31"PREFIX="24"GATEWAY="192.168.2.1"DNS1="8.8.8.8"IPV6_PRIVACY="no"
重启网卡、重启系统
[root@controller network-scripts]# service network restart[root@controller network-scripts]# reboot
compute节点
安装一台compute节点虚拟机
compute节点虚拟机基本硬件配置:CentOS 7、两张网卡、两块硬盘分别为:250G、100GB。compute虚拟机CentOS 7系统安装过程这里不赘述,需自行安装。以下是已经安装好了的(安装CentOS 7系统的过程中,选择安装在250G的硬盘上)。
配置compute节点主机名(重启系统生效)
[root@localhost ~]# hostnamectl set-hostname compute[root@localhost ~]# reboot
配置compute节点网络
查看网卡配置文件,应有两个网卡的配置文件:ens192和ens224为两张网卡的配置文件
[root@compute ~]# cd /etc/sysconfig/network-scripts/[root@compute network-scripts]# lsifcfg-ens192 ifdown-eth ifdown-ppp ifdown-tunnel ifup-ippp ifup-post ifup-TeamPort network-functions-ipv6ifcfg-ens224 ifdown-ippp ifdown-routes ifup ifup-ipv6 ifup-ppp ifup-tunnelifcfg-lo ifdown-ipv6 ifdown-sit ifup-aliases ifup-isdn ifup-routes ifup-wirelessifdown ifdown-isdn ifdown-Team ifup-bnep ifup-plip ifup-sit init.ipv6-globalifdown-bnep ifdown-post ifdown-TeamPort ifup-eth ifup-plusb ifup-Team network-functions
网卡1配置(ens192):
[root@compute network-scripts]# vi ifcfg-ens192TYPE="Ethernet"PROXY_METHOD="none"BROWSER_ONLY="no"BOOTPROTO="static"DEFROUTE="yes"IPV4_FAILURE_FATAL="no"IPV6INIT="yes"IPV6_AUTOCONF="yes"IPV6_DEFROUTE="yes"IPV6_FAILURE_FATAL="no"IPV6_ADDR_GEN_MODE="stable-privacy"NAME="ens192"UUID="085d4149-ee2e-475c-9c73-4f27763f7ebd"DEVICE="ens192"ONBOOT="yes"IPADDR="192.168.1.33"PREFIX="24"GATEWAY="192.168.1.1"DNS1="8.8.8.8"IPV6_PRIVACY="no"
网卡2配置(ens224):
[root@compute network-scripts]# vi ifcfg-ens224TYPE="Ethernet"PROXY_METHOD="none"BROWSER_ONLY="no"BOOTPROTO="static"DEFROUTE="yes"IPV4_FAILURE_FATAL="no"IPV6INIT="yes"IPV6_AUTOCONF="yes"IPV6_DEFROUTE="yes"IPV6_FAILURE_FATAL="no"IPV6_ADDR_GEN_MODE="stable-privacy"NAME="ens224"UUID="098d4149-ee2e-475c-9c73-4f27763f7ebd"DEVICE="ens224"ONBOOT="yes"IPADDR="192.168.2.33"PREFIX="24"GATEWAY="192.168.2.1"DNS1="8.8.8.8"IPV6_PRIVACY="no"
重启网卡、重启系统
[root@compute network-scripts]# service network restart[root@compute network-scripts]# reboot
三、安装Openstack
controller节点
上传镜像
上传CentOS 7镜像和chinaskills_cloud_iaas.iso镜像至controller节点。这里使用MobaXterm自带的工具上传。
[root@controller ~]# lsanaconda-ks.cfg CentOS-7-x86_64-DVD-1810.iso chinaskills_cloud_iaas.iso
关闭防火墙和SELinux
[root@controller /]# systemctl stop firewalld[root@controller /]# systemctl disable firewalld[root@controller /]# setenforce 0 # 临时[root@controller /]# getenforce # 查看状态Permissive[root@controller /]# vi /etc/selinux/config # 非临时# This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:# enforcing - SELinux security policy is enforced.# permissive - SELinux prints warnings instead of enforcing.# disabled - No SELinux policy is loaded.SELINUX=permissive# SELINUXTYPE= can take one of three values:# targeted - Targeted processes are protected,# minimum - Modification of targeted policy. Only selected processes are protected.# mls - Multi Level Security protection.SELINUXTYPE=targeted
挂载镜像
[root@controller ~]# mount -o loop CentOS-7-x86_64-DVD-1810.iso /mnt/[root@controller ~]# mkdir /opt/centos[root@controller ~]# cp -rf /mnt/* /opt/centos/[root@controller ~]# umount /mnt/[root@controller ~]# mount -o loop chinaskills_cloud_iaas.iso /mnt/[root@controller ~]# cp -rf /mnt/* /opt/[root@controller ~]# umount /mnt/
yum源文件处理
移除原yum源
[root@controller ~]# cd /etc/yum.repos.d/[root@controller yum.repos.d]# mv * /media/[root@controller yum.repos.d]# ls[root@controller yum.repos.d]#
配置安装Openstack的yum源文件
[root@controller yum.repos.d]# vi local.repo[centos]name=centosbaseurl=[iaas]name=iaasbaseurl=
清除yum源缓存,验证yum源仓库是否已加载,下载Openstack所需软件包。
[root@controller yum.repos.d]# yum clean all #清除yum缓存Loaded plugins: fastestmirrorCleaning repos: centos iaas[root@controller yum.repos.d]# yum repolist # 查看yum源仓库列表Loaded plugins: fastestmirrorDetermining fastest mirrorscentos | 3.6 kB 00:00iaas | 2.9 kB 00:00(1/3): centos/group_gz | 166 kB 00:00(2/3): centos/primary_db | 3.1 MB 00:00(3/3): iaas/primary_db | 1.4 MB 00:00repo id repo name statuscentos centos 4,021iaas iaas 3,232repolist: 7,253[root@controller yum.repos.d]# yum install -y vim vsftpd iaas-xiandian # 安装相关软件包
配置vsftpd
设置匿名访问
[root@controller yum.repos.d]# echo anon_root=/opt/ >> /etc/vsftpd/vsftpd.conf
重启ftp服务
[root@controller yum.repos.d]# systemctl restart vsftpd
设置ftp服务开机自启
[root@controller yum.repos.d]# systemctl enable vsftpd修改脚本
[root@controller yum.repos.d]# vim /etc/xiandian/openrc.sh
内容如下:
#--------------------system Config--------------------###Controller Server Manager IP. example:x.x.x.xHOST_IP=192.168.1.31 #controller节点的IP地址#Controller HOST Password. example:000000 HOST_PASS=000000#Controller Server hostname. example:controllerHOST_NAME=controller#Compute Node Manager IP. example:x.x.x.xHOST_IP_NODE=192.168.1.33 #compute节点的IP地址#Compute HOST Password. example:000000 HOST_PASS_NODE=000000#Compute Node hostname. example:computeHOST_NAME_NODE=compute#--------------------Chrony Config-------------------###Controller network segment IP. example:x.x.0.0/16(x.x.x.0/24)network_segment_IP=192.168.1.0/24 #controller节点所在的网段#--------------------Rabbit Config ------------------###user for rabbit. example:openstackRABBIT_USER=openstack#Password for rabbit user .example:000000RABBIT_PASS=000000#--------------------MySQL Config---------------------###Password for MySQL root user . exmaple:000000DB_PASS=000000#--------------------Keystone Config------------------###Password for Keystore admin user. exmaple:000000DOMAIN_NAME=demo ADMIN_PASS=000000DEMO_PASS=000000#Password for Mysql keystore user. exmaple:000000KEYSTONE_DBPASS=000000#--------------------Glance Config--------------------###Password for Mysql glance user. exmaple:000000GLANCE_DBPASS=000000#Password for Keystore glance user. exmaple:000000GLANCE_PASS=000000#--------------------Nova Config----------------------###Password for Mysql nova user. exmaple:000000NOVA_DBPASS=000000#Password for Keystore nova user. exmaple:000000NOVA_PASS=000000#--------------------Neturon Config-------------------###Password for Mysql neutron user. exmaple:000000NEUTRON_DBPASS=000000#Password for Keystore neutron user. exmaple:000000NEUTRON_PASS=000000#metadata secret for neutron. exmaple:000000METADATA_SECRET=000000#Tunnel Network Interface. example:x.x.x.xINTERFACE_IP=192.168.1.31 #本机IP地址#External Network Interface. example:eth1INTERFACE_NAME=eth1#External Network The Physical Adapter. example:providerPhysical_NAME=provider#First Vlan ID in VLAN RANGE for VLAN Network. exmaple:101minvlan=101#Last Vlan ID in VLAN RANGE for VLAN Network. example:200maxvlan=200#--------------------Cinder Config--------------------###Password for Mysql cinder user. exmaple:000000CINDER_DBPASS=000000#Password for Keystore cinder user. exmaple:000000CINDER_PASS=000000#Cinder Block Disk. example:md126p3BLOCK_DISK=sdb1 #compute节点的存储块#--------------------Swift Config---------------------###Password for Keystore swift user. exmaple:000000SWIFT_PASS=000000#The NODE Object Disk for Swift. example:md126p4.OBJECT_DISK=sdb2 #compute节点的存储块#The NODE IP for Swift Storage Network. example:x.x.x.x.STORAGE_LOCAL_NET_IP=192.168.1.33 #compute节点的IP地址#--------------------Heat Config----------------------###Password for Mysql heat user. exmaple:000000HEAT_DBPASS=000000#Password for Keystore heat user. exmaple:000000HEAT_PASS=000000#--------------------Zun Config-----------------------###Password for Mysql Zun user. exmaple:000000ZUN_DBPASS=000000#Password for Keystore Zun user. exmaple:000000ZUN_PASS=000000#Password for Mysql Kuryr user. exmaple:000000KURYR_DBPASS=000000#Password for Keystore Kuryr user. exmaple:000000KURYR_PASS=000000#--------------------Ceilometer Config----------------###Password for Gnocchi ceilometer user. exmaple:000000CEILOMETER_DBPASS=000000#Password for Keystore ceilometer user. exmaple:000000CEILOMETER_PASS=000000#--------------------AODH Config----------------###Password for Mysql AODH user. exmaple:000000AODH_DBPASS=000000#Password for Keystore AODH user. exmaple:000000AODH_PASS=000000#--------------------Barbican Config----------------###Password for Mysql Barbican user. exmaple:000000BARBICAN_DBPASS=000000#Password for Keystore Barbican user. exmaple:000000BARBICAN_PASS=000000
compute节点
关闭防火墙,selinux。与controller节点类似,这里不赘述。硬盘分区(100G)
查看硬盘是否存在
[root@compute ~]# lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsda 8:0 0 250G 0 disk├─sda1 8:1 0 1G 0 part /boot└─sda2 8:2 0 249G 0 part ├─centos-root 253:0 0 50G 0 lvm / ├─centos-swap 253:1 0 7.9G 0 lvm [SWAP] └─centos-home 253:2 0 191.1G 0 lvm /homesdb 8:16 0 100G 0 disksr0 11:0 1 4.3G 0 rom
对硬盘分区
[root@compute ~]# fdisk /dev/sdbWelcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.Device does not contain a recognized partition tableBuilding a new DOS disklabel with disk identifier 0xf55678e0.Command (m for help): nPartition type: p primary (0 primary, 0 extended, 4 free) e extendedSelect (default p):Using default response pPartition number (1-4, default 1):First sector (2048-209715199, default 2048):Using default value 2048Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199): +25GPartition 1 of type Linux and of size 25 GiB is setCommand (m for help): nPartition type: p primary (1 primary, 0 extended, 3 free) e extendedSelect (default p):Using default response pPartition number (2-4, default 2):First sector (52430848-209715199, default 52430848):Using default value 52430848Last sector, +sectors or +size{K,M,G} (52430848-209715199, default 209715199): +25GPartition 2 of type Linux and of size 25 GiB is setCommand (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.
检查分区是否成功
[root@compute ~]# lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsda 8:0 0 250G 0 disk├─sda1 8:1 0 1G 0 part /boot└─sda2 8:2 0 249G 0 part ├─centos-root 253:0 0 50G 0 lvm / ├─centos-swap 253:1 0 7.9G 0 lvm [SWAP] └─centos-home 253:2 0 191.1G 0 lvm /homesdb 8:16 0 100G 0 disk├─sdb1 8:17 0 25G 0 part└─sdb2 8:18 0 25G 0 partsr0 11:0 1 4.3G 0 rom
yum源文件处理
[root@compute ~]# cd /etc/yum.repos.d/[root@compute yum.repos.d]# mv * /media/[root@compute yum.repos.d]# ls[root@compute yum.repos.d]#
配置安装Openstack的yum源文件
[root@compute yum.repos.d]# vi local.repo[centos]name=centosbaseurl=[iaas]name=iaasbaseurl=
清除yum源缓存,验证yum源,下载所需软件包
[root@compute yum.repos.d]# yum clean allLoaded plugins: fastestmirrorCleaning repos: centos iaas[root@compute yum.repos.d]# yum repolistLoaded plugins: fastestmirrorDetermining fastest mirrorscentos | 3.6 kB 00:00iaas | 2.9 kB 00:00(1/3): centos/group_gz | 166 kB 00:00(2/3): centos/primary_db | 3.1 MB 00:00(3/3): iaas/primary_db | 1.4 MB 00:00repo id repo name statuscentos centos 4,021iaas iaas 3,232repolist: 7,253[root@compute yum.repos.d]# yum install -y vim iaas-xiandian
从controller节点复制脚本过来(如需输入密码,请输入密码)
[root@compute yum.repos.d]# scp 192.168.1.31:/etc/xiandian/openrc.sh /etc/xiandian/openrc.shroot@192.168.1.31's password:openrc.sh 100% 4204 198.2KB/s 00:00
修改compute节点的脚本
INTERFACE_IP=192.168.1.33
四、刷脚本
controller节点
[root@controller ~]# iaas-pre-host.sh #刷完该脚本需重启系统[root@controller ~]# reboot[root@controller ~]# iaas-install-mysql.sh[root@controller ~]# iaas-install-keystone.sh[root@controller ~]# source /etc/keystone/admin-openrc.sh #使环境生效[root@controller ~]# iaas-install-glance.sh[root@controller ~]# iaas-install-nova-controller.sh[root@controller ~]# iaas-install-neutron-controller.sh[root@controller ~]# iaas-install-dashboard.sh
compute节点
[root@compute ~]# iaas-pre-host.sh #刷完该脚本需重启系统[root@compute ~]# iaas-install-nova-compute.sh[root@compute ~]# iaas-install-neutron-compute.sh
五、登录Openstack云平台
浏览器访问地址
登录成功并看到以下画面,说明openstack已经搭建成功了。
标签: #centos73网卡配置文件