------------------------ | | Opensatck-Router | 自宅Net -------------------- ------------------ | (192.168.10.0/24) |Openstack | |192.168.10.110 | | | public |-----| | | | 192.168.10.110 | | | | | --117 | ------------------ | -------------------- |192.168.110.1 | | | | | | ------------------------ --------------------- | Private (Network) | | 192.168.110.0/24 | | | ---------------------
# source keystonerc_admin [root@openstack-kilo ~(keystone_admin)]#
[root@openstack-kilo ~(keystone_admin)]# neutron router-create Router1
Created a new router:
[root@openstack-mitaka ~(keystone_admin)]# neutron router-show Router1 +-------------------------+--------------------------------------+ | Field | Value | +-------------------------+--------------------------------------+ | admin_state_up | True | | availability_zone_hints | | | availability_zones | nova | | description | | | distributed | False | | external_gateway_info | | | ha | False | | id | da592fa9-7af3-437c-b4bc-4192af072253 | | name | Router1 | | routes | | | status | ACTIVE | | tenant_id | e3ca6100bb5a4172bf51f809595d879c | +-------------------------+--------------------------------------+
neutron net-create public --tenant-id e3ca6100bb5a4172bf51f809595d879c --router:external Created a new network:
[root@openstack-mitaka ~(keystone_admin)]# neutron net-show Private +---------------------------+--------------------------------------+ | Field | Value | +---------------------------+--------------------------------------+ | admin_state_up | True | | availability_zone_hints | | | availability_zones | nova | | created_at | 2016-07-29T23:28:35 | | description | | | id | b7025c4a-0fe1-49a0-9338-d19df4f22e8a | | ipv4_address_scope | | | ipv6_address_scope | | | mtu | 1450 | | name | Private | | provider:network_type | vxlan | | provider:physical_network | | | provider:segmentation_id | 14 | | router:external | False | | shared | False | | status | ACTIVE | | subnets | 0ade5036-a55f-4588-9778-50c059a528a6 | | tags | | | tenant_id | e3ca6100bb5a4172bf51f809595d879c | | updated_at | 2016-07-29T23:28:35 | +---------------------------+--------------------------------------+
[root@openstack-mitaka ~(keystone_admin)]# neutron net-create public --tenant-id e3ca6100bb5a4172bf51f809595d879c --router:external Created a new network: +---------------------------+--------------------------------------+ | Field | Value | +---------------------------+--------------------------------------+ | admin_state_up | True | | availability_zone_hints | | | availability_zones | | | created_at | 2016-07-30T07:27:37 | | description | | | id | cab789fb-0a38-476b-98eb-028dc0f8dc10 | | ipv4_address_scope | | | ipv6_address_scope | | | is_default | False | | mtu | 1450 | | name | public | | provider:network_type | vxlan | | provider:physical_network | | | provider:segmentation_id | 100 | | router:external | True | | shared | False | | status | ACTIVE | | subnets | | | tags | | | tenant_id | e3ca6100bb5a4172bf51f809595d879c | | updated_at | 2016-07-30T07:27:37 | +---------------------------+--------------------------------------+
ネットワーク名「public」にサブネット名public_subnet(配布アドレス192.168.10.110-192.168.10.117)を割り当てる (この範囲がなぜネットワーク名「public」になるか不明?)
[root@openstack-mitaka ~(keystone_admin)]# neutron subnet-create --name public_subnet --enable_dhcp=False --allocation- \
pool=start=192.168.10.110,end=192.168.10.117 --gateway=192.168.10.245 public 192.168.10.0/24
Created a new subnet: +-------------------+------------------------------------------------------+ | Field | Value | +-------------------+------------------------------------------------------+ | allocation_pools | {"start": "192.168.10.110", "end": "192.168.10.117"} | | cidr | 192.168.10.0/24 | | created_at | 2016-07-30T07:29:56 | | description | | | dns_nameservers | | | enable_dhcp | False | | gateway_ip | 192.168.10.245 | | host_routes | | | id | 041593a1-1a11-4aff-b872-24e3c2fd1831 | | ip_version | 4 | | ipv6_address_mode | | | ipv6_ra_mode | | | name | public_subnet | | network_id | cab789fb-0a38-476b-98eb-028dc0f8dc10 | | subnetpool_id | | | tenant_id | e3ca6100bb5a4172bf51f809595d879c | | updated_at | 2016-07-30T07:29:56 | +-------------------+------------------------------------------------------+
[root@openstack-mitaka ~(keystone_admin)]# neutron router-gateway-set Router1 public Set gateway for router Router1
[root@openstack-mitaka ~(keystone_admin)]# neutron net-show public +---------------------------+--------------------------------------+ | Field | Value | +---------------------------+--------------------------------------+ | admin_state_up | True | | availability_zone_hints | | | availability_zones | nova | | created_at | 2016-07-30T07:27:37 | | description | | | id | cab789fb-0a38-476b-98eb-028dc0f8dc10 | | ipv4_address_scope | | | ipv6_address_scope | | | is_default | False | | mtu | 1450 | | name | public | | provider:network_type | vxlan | | provider:physical_network | | | provider:segmentation_id | 100 | | router:external | True | | shared | False | | status | ACTIVE | | subnets | 041593a1-1a11-4aff-b872-24e3c2fd1831 | | tags | | | tenant_id | e3ca6100bb5a4172bf51f809595d879c | | updated_at | 2016-07-30T07:27:37 | +---------------------------+--------------------------------------+
Floating IPをインスタンスに割りあてるとそのIPでOpenStock外からアクセスできる。
Privateネットワーク内のPC(IP192.168.110.103)にFloating IP(192.168.10.111)を割り振るとルータを介さないでアクセスできる.