【OpenStack】Trunk Portをためす

Newtonで実装されたTrunk Portを試してみようかと。
わかりやすくVyOSでやってみる。

・Parent Port作成
・このParent PortのMac Addressを指定してChild Portを作成する
という流れのよう。

実際にやってみる。

<事前準備>
neutron.conf内のservice_pluginsにtrunkを追加。

# The service plugins Neutron will use (list value)
service_plugins=router,metering,firewall,trunk

neutronサービス再起動

# openstack-service restart neutron

<ネットワーク準備>

$ openstack network list
+--------------------------------------+----------------+--------------------------------------+
| ID | Name | Subnets |
+--------------------------------------+----------------+--------------------------------------+
| 9911d560-cd64-41d9-aac2-f8637010b614 | 172.20.10.0/24 | de53ce0a-6604-46e7-a97c-f26323fc8823 |
| bae535af-298b-4987-be7f-9bb7bdab7afd | 172.20.30.0/24 | b026b305-2731-471b-b358-51693cbed255 |
| e0d4d1b6-b71f-4a51-98ec-96cb8d55d0e0 | 172.20.20.0/24 | 0697e15f-8595-4df3-8eec-324dfb6aa1a6 |
+--------------------------------------+----------------+--------------------------------------+

<親ポート作成>

openstack port  create --network 9911d560-cd64-41d9-aac2-f8637010b614 parent0

<子ポート作成>

parent_mac="$( openstack port show parent0 | awk '/ mac_address / { print $4 }' )"
openstack port create --network e0d4d1b6-b71f-4a51-98ec-96cb8d55d0e0 --mac-address "$parent_mac" childport1
openstack port create --network bae535af-298b-4987-be7f-9bb7bdab7afd --mac-address "$parent_mac" childport2

<Trunkポート作成>

openstack network trunk create --parent-port parent0 --subport port=childport1,segmentation-type=vlan,segmentation-id=110 trunk0
openstack network trunk set --subport port=childport2,segmentation-type=vlan,segmentation-id=120 trunk0

<Trunkポート確認>

openstack network trunk show trunk0
+-----------------+-------------------------------------------------------------------------------------------------+
| Field | Value |
+-----------------+-------------------------------------------------------------------------------------------------+
| admin_state_up | UP |
| created_at | 2016-11-22T05:21:34Z |
| description | |
| id | b1555b22-fdbe-42c1-bd0f-eced582451c1 |
| name | trunk0 |
| port_id | 9d0240c6-338d-4790-b806-589434371f81 |
| revision_number | 2 |
| status | DOWN |
| sub_ports | port_id='3e3f9ddf-4432-4952-8e2f-706dec3b2e14', segmentation_id='110', segmentation_type='vlan' |
| | port_id='d90a11ae-98f8-4484-b6ed-1a9ffc5acb10', segmentation_id='120', segmentation_type='vlan' |
| tenant_id | 75680dae0c7b4e6296a53543687a8b6a |
| updated_at | 2016-11-22T05:22:51Z |
+-----------------+-------------------------------------------------------------------------------------------------+

<インスタンス作成>

openstack server create --flavor 3 --image 17074b09-66da-4fcc-b4ee-d6522191d4a6 --nic port-id=9d0240c6-338d-4790-b806-589434371f81 --security-group 0db30ac7-e1de-4ea2-96b2-a5f4a68cd57f VyOS_Trunk

<VyOS設定>

set interface ethernet eth0 address 172.20.10.10/24
set interface ethernet eth0 vif 110 address 172.20.20.8/24
set interface ethernet eth0 vir 120 address 172.20.30.2/24

これでPing通ったので完成かな。