虚拟网络编辑器:
本机网卡两个dns分别为:
202.96.128.86
202.96.134.133
新建虚拟机:
如下虚拟机位置建议不要放在C盘
虚拟机配置:
启动模板机,安装centos 7.2
用root账号密码123456登录
关闭防火墙 systemctldisablefirewalld 关闭防火墙开机启动 systemctlstopfirewalld 关闭selinux sed-i's#SELINUX=enforcing#SELINUX=disabled#g'/etc/selinux/config
ip a最后一个网卡为vmnet8网卡
[root@localhost~]#ipa 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:eno16777736:<BROADCAST,MULTICAST,LOWER_UP>mtu1500qdiscpfifo_faststateUPqlen1000 link/ether00:0c:29:19:ce:56brdff:ff:ff:ff:ff:ff 3:eno33554960:<BROADCAST,LOWER_UP>mtu1500qdiscpfifo_faststateUPqlen1000 link/ether00:0c:29:19:ce:60brdff:ff:ff:ff:ff:ff 4:eno50332184:<BROADCAST,LOWER_UP>mtu1500qdiscpfifo_faststateUPqlen1000 link/ether00:0c:29:19:ce:6abrdff:ff:ff:ff:ff:ff inet10.0.0.100/24brd10.0.0.255scopeglobaleno50332184 valid_lftforeverpreferred_lftforever inet6fe80::20c:29ff:fe19:ce6a/64scopelink valid_lftforeverpreferred_lftforever
vmnet8网卡配置为如下:(DNS是通过宿主网卡属性信息或者ipconfig /all查到的)
[root@localhost~]#vim/etc/sysconfig/network-scripts/ifcfg-eno50332184 TYPE=Ethernet BOOTPROTO=static DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=no IPV6INIT=no NAME=eno50332184 UUID=51b49bab-01b5-4464-b86d-5975c8cee453 DEVICE=eno50332184 ONBOOT=yes IPADDR=10.0.0.100 NETMASK=255.255.255.0 GATEWAY=10.0.0.2 DNS1=202.96.128.86 DNS2=202.96.134.133
网卡vmnet1和vmnet2不要配置网关和DNS
修改完后重启网卡:
[root@localhost~]#systemctlrestartnetwork
重启后直接用SecureCRT登录模板机后,再进行如下操作:
vmnet1网卡配置如下:
[root@localhost~]#vi/etc/sysconfig/network-scripts/ifcfg-eno16777736 TYPE=Ethernet BOOTPROTO=static DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=no IPV6INIT=no NAME=eno16777736 UUID=316f6b4d-a4e4-48ba-8b66-e178c98ead5f DEVICE=eno16777736 ONBOOT=yes IPADDR=10.1.1.120 NETMASK=255.255.255.0
vmnet2网卡配置如下:
[root@localhost~]#vi/etc/sysconfig/network-scripts/ifcfg-eno33554960 TYPE=Ethernet BOOTPROTO=static DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=no IPV6INIT=no NAME=eno33554960 UUID=1ec0daa5-ebde-42d6-b26f-9484ac1f39eb DEVICE=eno33554960 ONBOOT=yes IPADDR=10.2.2.120 NETMASK=255.255.255.0
重启网卡
[root@localhost~]#systemctlrestartnetwork [root@localhost~]#ipa 1:lo:<LOOPBACK,LOWER_UP>mtu1500qdiscpfifo_faststateUPqlen1000 link/ether00:0c:29:19:ce:56brdff:ff:ff:ff:ff:ff inet10.1.1.120/24brd10.1.1.255scopeglobaleno16777736 valid_lftforeverpreferred_lftforever inet6fe80::20c:29ff:fe19:ce56/64scopelink valid_lftforeverpreferred_lftforever 3:eno33554960:<BROADCAST,LOWER_UP>mtu1500qdiscpfifo_faststateUPqlen1000 link/ether00:0c:29:19:ce:60brdff:ff:ff:ff:ff:ff inet10.2.2.120/24brd10.2.2.255scopeglobaleno33554960 valid_lftforeverpreferred_lftforever inet6fe80::20c:29ff:fe19:ce60/64scopelink valid_lftforeverpreferred_lftforever 4:eno50332184:<BROADCAST,LOWER_UP>mtu1500qdiscpfifo_faststateUPqlen1000 link/ether00:0c:29:19:ce:6abrdff:ff:ff:ff:ff:ff inet10.0.0.100/24brd10.0.0.255scopeglobaleno50332184 valid_lftforeverpreferred_lftforever inet6fe80::20c:29ff:fe19:ce6a/64scopelink valid_lftforeverpreferred_lftforever
看是否可以访问外网:ping 网关和外网baidu网址
[root@localhost~]#ping-c410.0.0.2 PING10.0.0.2(10.0.0.2)56(84)bytesofdata. 64bytesfrom10.0.0.2:icmp_seq=1ttl=128time=1.69ms 64bytesfrom10.0.0.2:icmp_seq=2ttl=128time=0.645ms 64bytesfrom10.0.0.2:icmp_seq=3ttl=128time=0.552ms 64bytesfrom10.0.0.2:icmp_seq=4ttl=128time=1.09ms ---10.0.0.2pingstatistics--- 4packetstransmitted,4received,0%packetloss,time3040ms rttmin/avg/max/mdev=0.552/0.996/1.695/0.452ms [root@localhost~]#ping-c4baidu.com PINGbaidu.com(123.125.114.144)56(84)bytesofdata. 64bytesfrom123.125.114.144:icmp_seq=1ttl=128time=123ms 64bytesfrom123.125.114.144:icmp_seq=2ttl=128time=37.9ms 64bytesfrom123.125.114.144:icmp_seq=3ttl=128time=37.3ms 64bytesfrom123.125.114.144:icmp_seq=4ttl=128time=38.7ms ---baidu.compingstatistics--- 4packetstransmitted,time3030ms rttmin/avg/max/mdev=37.357/59.400/123.520/37.023ms
安装常用的基础包:
[root@localhost~]#yuminstallvimnet-toolswgettreetelnetdos2unixsysstatlrzszncnmap-y
修改主机名:
例如把默认主机名localhost.localdomain修改为oldboy,修改完后直接重启系统。
[root@localhost~]#vi/etc/hostname
重启后直接关机做个快照,快照名:模板机,
一定不要执行yumupdate-y&&reboot 否则会升级到更高的版本。
openstack ocata版本对centos 7.2以上的版本兼容性比较差,只建议用centos 7.2版本。
这里没有设置centos base源和epel源,如要设置,可以设置阿里云的yum源。