OpenStack for icehouse的自动化安装脚本——创建GRE网络实例



#===============================================================
#
#Create Network Instance OS Env——GRE
#
#===============================================================

export ext_net_name=Ext-Net
export ext_subnet_name=Ext-subNet
export ext_net_start_ip=192.168.13.91
export ext_net_end_ip=192.168.13.99
export ext_net_gateway=192.168.12.254
export ext_net_dns_nameserver=XXXXXXXXX(自己修改)
export ext_net_range=192.168.12.0/23
export admin_pass=admin4smtest
export controller=192.168.3.180


#执行之前Source admin
    export OS_USERNAME=admin
	echo $OS_USERNAME
	export OS_PASSWORD=$admin_pass
	echo $OS_PASSWORD
	export OS_TENANT_NAME=admin
	echo $OS_TENANT_NAME
	export OS_AUTH_URL=http://$controller:35357/v2.0
	echo $OS_AUTH_URL

#Create external Net
neutron net-create $ext_net_name --provider:network_type gre --provider:segmentation_id 1 --router:external true

#Create external subnet
neutron subnet-create --allocation-pool start=$ext_net_start_ip,end=$ext_net_end_ip --gateway $ext_net_gateway --dns-nameserver $ext_net_dns_nameserver  Ext-Net $ext_net_range --enable_dhcp=False  --name $ext_subnet_name

export tenant_name=demo
export tenant_subnet_name=demo-subNet
export tenant_user=demo
export tenant_user_pass=demo
export tenant_net_name=demo-Net
export tenant_net_range=10.1.0.0/24
export tenant_virtual_route_name=tenant-demo-R1


#Create tenant
keystone tenant-create --name $tenant_name

#Create tenant_user
keystone user-create --name=$tenant_user --pass=$tenant_user_pass --tenant-id $tenant_name [email protected]

#Create tenant Net
neutron --os-tenant-name $tenant_name  --os-username $tenant_user --os-password $tenant_user_pass  --os-auth-url=http://localhost:5000/v2.0 net-create $tenant_net_name

#Create tenant subNet
neutron --os-tenant-name $tenant_name --os-username $tenant_user --os-password $tenant_user_pass  --os-auth-url=http://localhost:5000/v2.0 subnet-create $tenant_net_name  $tenant_net_range --name $tenant_subnet_name

#Create tenant Virtual Route
neutron --os-tenant-name $tenant_name --os-username $tenant_user --os-password $tenant_user_pass   --os-auth-url=http://localhost:5000/v2.0 router-create $tenant_virtual_route_name

#Add Route Interface
tenant_subnet_id=`neutron subnet-list | grep $tenant_subnet_name | awk '{print $2}'`

tenant_virtual_route_id=`neutron router-list | grep $tenant_virtual_route_name | awk '{print $2}'`

neutron router-interface-add $tenant_virtual_route_id $tenant_subnet_id

#Add GateWay to Route
neutron router-gateway-set $tenant_virtual_route_name $ext_net_name


你可能感兴趣的:(OpenStack for icehouse的自动化安装脚本——创建GRE网络实例)