# create a net and a subnet
i=1;
while [ $i -lt 51 ]; do
neutron net-create scalenet$i --shared;
j=0;
while [ $j -lt 4 ]; do
neutron subnet-create scalenet$i $i.$j.0.0/16;
j=$[$j+1];
done;
i=$[$i+1];
done
neutron --os-username admin net-list
openstack domain list admin_domain
openstack role assignment list --user admin --project scaleadmin10 --names
i=1;while [ $i -lt 201 ]; do openstack user create --domain admin_domain --password password$i scaleuser$i; i=$[$i+1]; done
i=1;while [ $i -lt 201 ]; do openstack role add --project scaleadmin$i --user admin admin; i=$[$i+1];echo "Added admin:admin user:role to project:scaleadmin$i"; done
openstack network create --provider-network-type flat --provider-physical-network datacentre public
openstack subnet create --network public --subnet-range 192.0.2.0/24 --allocation-pool start=192.0.2.50,end=192.0.2.240 --no-dhcp public-sub
glance image-create --name "ubuntu" --disk-format iso --container-format bare --file ubuntu-16.04.3-desktop-amd64.iso
nova flavor-create m1.medium auto 2048 20 4 --swap 2048 --is-public True
[heat-admin@overcloud-controller-0 ~]$ openstack network show public
+---------------------------+--------------------------------------+
| Field | Value |
+---------------------------+--------------------------------------+
| admin_state_up | UP |
| availability_zone_hints | |
| availability_zones | nova |
| created_at | 2017-11-02T11:48:11Z |
| description | |
| id | 797dd76d-aca0-4a4e-acb4-5c5b5efbe505 |
| ipv4_address_scope | None |
| ipv6_address_scope | None |
| is_default | False |
| mtu | 1496 |
| name | public |
| port_security_enabled | True |
| project_id | a5778a40001b49e3a6e21c11ebaaaaf8 |
| project_id | a5778a40001b49e3a6e21c11ebaaaaf8 |
| provider:network_type | flat |
| provider:physical_network | datacentre |
| provider:segmentation_id | None |
| qos_policy_id | None |
| revision_number | 6 |
| router:external | External |
| shared | False |
| status | ACTIVE |
| subnets | 2893960a-74a3-4582-8a50-dbd3a5795706 |
| tags | [] |
| updated_at | 2017-11-02T11:53:08Z |
+---------------------------+--------------------------------------+
[heat-admin@overcloud-controller-0 ~]$ openstack network show scalenet10
+---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
| admin_state_up | UP |
| availability_zone_hints | |
| availability_zones | nova |
| created_at | 2017-10-19T05:10:05Z |
| description | |
| id | aee32462-f555-4392-891f-7a4600946759 |
| ipv4_address_scope | None |
| ipv6_address_scope | None |
| mtu | 1446 |
| name | scalenet10 |
| port_security_enabled | True |
| project_id | a5778a40001b49e3a6e21c11ebaaaaf8 |
| project_id | a5778a40001b49e3a6e21c11ebaaaaf8 |
| provider:network_type | vxlan |
| provider:physical_network | None |
| provider:segmentation_id | 62 |
| qos_policy_id | None |
| revision_number | 11 |
| router:external | Internal |
| shared | True |
| status | ACTIVE |
| subnets | 3413e300-3b65-44ce-b351-8794bad587dd, 52fb1ef6-e47e-449c-a556-a371226eb830, 8e7dec7b-078a-4fa3-b98d-77449babd85d, d3ba3c63-f3d0-41f5-9caf-5a47cd39624c |
| tags | [] |
| updated_at | 2017-10-19T05:10:11Z |
+---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
# create router r1
openstack router create r1
openstack router set --external-gateway public r1
neutron router-gateway-set r1 public
for all subnets in that net:
add interface from r1 to that subnet
openstack network list | grep scalenet10
| aee32462-f555-4392-891f-7a4600946759 | scalenet10 | 3413e300-3b65-44ce-b351-8794bad587dd, 52fb1ef6-e47e-449c-a556-a371226eb830, 8e7dec7b-078a-4fa3-b98d-77449babd85d, d3ba3c63-f3d0-41f5-9caf-5a47cd39624c |
make sure the network is owned by the same tenant as the vm.
in our case, we formed
=> network id is aee32462-f555-4392-891f-7a4600946759
for scalenet10
ip link add virbr0 to network namespace linux
https://blog.scottlowe.org/2013/09/04/introducing-linux-network-namespaces/
https://blog.scottlowe.org/2013/05/29/a-quick-introduction-to-linux-policy-routing/
https://blog.scottlowe.org/2013/05/30/a-use-case-for-policy-routing-with-kvm-and-open-vswitch/
http://man7.org/linux/man-pages/man8/ip-netns.8.html
https://unix.stackexchange.com/questions/229548/what-script-could-allow-regular-users-to-use-network-namespaces