虛擬網絡編輯器:linux
本機網卡兩個dns分別爲:vim
202.96.128.86
202.96.134.133
centos
新建虛擬機:bash
以下虛擬機位置建議不要放在C盤網絡
虛擬機配置:dom
啓動模板機,安裝centos 7.2 編輯器
用root帳號密碼123456登陸ide
關閉防火牆 systemctl disable firewalld 關閉防火牆開機啓動 systemctl stop firewalld 關閉selinux sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
ip a最後一個網卡爲vmnet8網卡oop
[root@localhost ~]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 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: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:19:ce:56 brd ff:ff:ff:ff:ff:ff 3: eno33554960: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:19:ce:60 brd ff:ff:ff:ff:ff:ff 4: eno50332184: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:19:ce:6a brd ff:ff:ff:ff:ff:ff inet 10.0.0.100/24 brd 10.0.0.255 scope global eno50332184 valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:fe19:ce6a/64 scope link valid_lft forever preferred_lft forever
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 ~]# systemctl restart network
重啓後直接用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 ~]# systemctl restart network [root@localhost ~]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 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: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:19:ce:56 brd ff:ff:ff:ff:ff:ff inet 10.1.1.120/24 brd 10.1.1.255 scope global eno16777736 valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:fe19:ce56/64 scope link valid_lft forever preferred_lft forever 3: eno33554960: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:19:ce:60 brd ff:ff:ff:ff:ff:ff inet 10.2.2.120/24 brd 10.2.2.255 scope global eno33554960 valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:fe19:ce60/64 scope link valid_lft forever preferred_lft forever 4: eno50332184: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:19:ce:6a brd ff:ff:ff:ff:ff:ff inet 10.0.0.100/24 brd 10.0.0.255 scope global eno50332184 valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:fe19:ce6a/64 scope link valid_lft forever preferred_lft forever
看是否能夠訪問外網:ping 網關和外網baidu網址
[root@localhost ~]# ping -c4 10.0.0.2 PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data. 64 bytes from 10.0.0.2: icmp_seq=1 ttl=128 time=1.69 ms 64 bytes from 10.0.0.2: icmp_seq=2 ttl=128 time=0.645 ms 64 bytes from 10.0.0.2: icmp_seq=3 ttl=128 time=0.552 ms 64 bytes from 10.0.0.2: icmp_seq=4 ttl=128 time=1.09 ms --- 10.0.0.2 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3040ms rtt min/avg/max/mdev = 0.552/0.996/1.695/0.452 ms [root@localhost ~]# ping -c4 baidu.com PING baidu.com (123.125.114.144) 56(84) bytes of data. 64 bytes from 123.125.114.144: icmp_seq=1 ttl=128 time=123 ms 64 bytes from 123.125.114.144: icmp_seq=2 ttl=128 time=37.9 ms 64 bytes from 123.125.114.144: icmp_seq=3 ttl=128 time=37.3 ms 64 bytes from 123.125.114.144: icmp_seq=4 ttl=128 time=38.7 ms --- baidu.com ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3030ms rtt min/avg/max/mdev = 37.357/59.400/123.520/37.023 ms
安裝經常使用的基礎包:
[root@localhost ~]# yum install vim net-tools wget tree telnet dos2unix sysstat lrzsz nc nmap -y
修改主機名:
例如把默認主機名localhost.localdomain修改成oldboy,修改完後直接重啓系統。
[root@localhost ~]# vi /etc/hostname
重啓後直接關機作個快照,快照名:模板機,
必定不要執行yum update -y && reboot 不然會升級到更高的版本。
openstack ocata版本對centos 7.2以上的版本兼容性比較差,只建議用centos 7.2版本。
這裏沒有設置centos base源和epel源,如要設置,能夠設置阿里雲的yum源。