Cisco ACI は GUI や REST API など、様々な方法で設定することが出来ます。 今回は CLI で設定する方法をメモしておきます。 尚、実際の検証は 5.0(2h) で行いました。
- 設定モードへの移行方法
- Tenant
- VRF
- BD (Bridge Domain)
- BD Subnet
- Application Profile
- AppEpg (Application EPG)
- L3Out
- Filter
- Contract 及び Subject
- L3Out と AppEpg を Contract する
- BD Subnet を L3Out から広報する
- ExtEpg Subnet
- 全体の設定
設定モードへの移行方法
ACI 環境において、CLI であっても「設定は全て APIC で行う」というのは同じです。 CLI の設定モードへ移行するには APIC で configure terminal
を実行します。
configure terminal
(conf t
では無く) configure
でも同じく、設定モードへ移行することが可能です。
configure
Tenant
Tenant の作成時、特に注意事項はありません。
tenant Tenant1 exit
VRF
VRF の作成時、特に注意事項はありません。
tenant Tenant1 vrf context Vrf1 exit exit
BD (Bridge Domain)
項目 | GUI デフォルト値 | CLI デフォルト値 |
---|---|---|
ARP Flooding |
enable |
disable |
その為、CLI から BD を作成する場合、必要に応じて arp flooding
を設定しておきます。
tenant Tenant1 bridge-domain Bd1 arp flooding vrf member Vrf1 exit exit
尚、bridge-domain Bd1
で BD を作成すると必ず同時に interface bridge-domain Bd1
も定義されます。
# show running-config tenant Tenant1 # Command: show running-config tenant Tenant1 # Time: Sun Aug 16 00:03:22 2020 tenant Tenant1 vrf context Vrf1 exit bridge-domain Bd1 arp flooding vrf member Vrf1 exit interface bridge-domain Bd1 exit exit
この設定は連動しており、例えば no interface bridge-domain Bd1
で削除すると bridge-domain Bd1
も削除されます。
apic1# configure apic1(config)# tenant Tenant1 apic1(config-tenant)# no interface bridge-domain Bd1 apic1(config-tenant)# apic1(config-tenant)# show running-config tenant Tenant1 # Command: show running-config tenant Tenant1 # Time: Sun Aug 16 00:05:31 2020 tenant Tenant1 vrf context Vrf1 exit exit
BD Subnet
項目 | GUI デフォルト値 | CLI デフォルト値 |
---|---|---|
Make this IP address primary |
disable |
enable |
その為、CLI から BD を作成する場合、ip address ~ secondary
のように secondary
を設定します。
tenant Tenant1 interface bridge-domain Bd1 ip address 10.0.1.254/24 secondary exit exit
以下のように secondary
を指定せずに設定すると Make this IP address primary
が Enable
になります。
tenant Tenant1 bridge-domain Bd1 arp flooding vrf member Vrf1 exit interface bridge-domain Bd1 ip address 10.0.1.254/24 exit exit
Application Profile
Application Profile の作成時、特に注意事項はありません。
tenant Tenant1 application Ap1 exit exit
AppEpg (Application EPG)
項目 | GUI デフォルト値 | CLI デフォルト値 |
---|---|---|
QoS |
Level3 |
Unspecified |
その為、CLI から設定する時は必要に応じて明示的に set qos-class level3
を設定します。 尚、今回は VMM Domain で設定しています。
tenant Tenant1 application Ap1 epg Epg1 bridge-domain member Bd1 set qos-class level3 vmware-domain member Vmm1 push pre-provision exit exit exit exit
L3Out
L3Out は設定量が多いで若干、長くなります。 最低限の設定は概ね以下のようになろうかと思います。 ここでは OSPF で設定しています。 show running-config
で表示されるコンフィグ順序上は「router ospf default
が先 (上位)」なのですが、router ospf default
で定義している VRF が存在しない場合、この順序で設定するとエラーになってしまいます。 そこで (show running-config
通りのコンフィグ順序では無く) router ospf default
より先に vrf context
を設定しています。
tenant Tenant1 l3out L3Out1 vrf member Vrf1 exit external-l3 epg Epg99 l3out L3Out1 vrf member Vrf1 exit exit ! leaf 101 vrf context tenant Tenant1 vrf Vrf1 l3out L3Out1 router-id 10.0.99.201 route-map L3Out1_in scope global exit route-map L3Out1_out scope global exit route-map L3Out1_shared scope global exit exit ! router ospf default vrf member tenant Tenant1 vrf Vrf1 area 0.0.0.0 l3out L3Out1 exit exit ! interface vlan 101 vrf member tenant Tenant1 vrf Vrf1 ip address 10.0.99.254/24 ip router ospf default area 0.0.0.0 mtu 1500 exit interface ethernet 1/1 switchport trunk allowed vlan 101 tenant Tenant1 external-svi l3out L3Out1 exit exit
Filter
Filter の作成時、特に注意事項はありません。
tenant Tenant1 access-list Filter1 match ip exit exit
Contract 及び Subject
contract
で Contract を作成します。 type
オプションには以下の値を指定可能です。 type
オプションを指定しない場合は Standard Contract が作成されます。
No. | type | 作成される Contract 種別 | 備考 |
---|---|---|---|
1 | permit | Standard | - |
2 | deny | Taboo | - |
3 | oob-mgmt | Out-Of-Band Contracts | mgmt' Tenant でしか作成出来ない (他 Tenant で作成するとエラー) |
Out-Of-Band Contracts
とは mgmt
Tenant で OoB 接続の管理に利用する特殊な Contract です。
GUI で Subject を設定する場合、デフォルトで Apply Both Direction
が true
に設定されますが、CLI では access-group Filter1 both
のように、明示的に both
を指定する必要があります。
tenant Tenant1 contract Contract1 subject Subject1 access-group Filter1 both exit exit exit
Apply Both Direction
を false
に設定する場合は in
オプションを指定する必要があります。
tenant Tenant1 contract Contract1 subject Subject1 access-group Filter1 in exit exit exit
access-group Filter1
設定はオプションとして以下の 3 値から指定することが出来ます。
No. | access-group 設定 | Apply Both Direction | Filter Chain For Consumer to Provider | Filter Chain For Provider to Consumer |
---|---|---|---|---|
1 | both | true | - | - |
2 | in | false | ○ | X |
3 | out | false | X | ○ |
尚、CLI に限った話ではありませんが、both
な Filter が存在する Subject に in
や out
な設定を追加することは出来ません。 実際に試してみると Cannot add in if both is present
というエラーになります。
apic1(config)# tenant Tenant1 apic1(config-tenant)# contract Contract1 apic1(config-tenant-contract)# subject Subject1 apic1(config-tenant-contract-subj)# access-group Filter1 both apic1(config-tenant-contract-subj)# access-group Filter2 in Cannot add in if both is present apic1(config-tenant-contract-subj)# access-group Filter3 out Cannot add out if both is present
both
Filter を含まないのであれば in
と out
を混在させることは可能です。 以下で例示している Contract2
や Contract3
はいずれも正しく設定可能です。
tenant Tenant1 contract Contract2 subject Subject1 access-group Filter1 in access-group Filter2 out exit exit ! contract Contract3 subject Subject1 access-group Filter1 out access-group Filter2 in exit exit exit
L3Out と AppEpg を Contract する
L3Out と AppEpg を Contract してみます。
L3Out (Provider) ~ AppEpg (Consumer)
以下の設定になります。
tenant Tenant1 application Ap1 epg Epg1 contract consumer Contract1 exit exit external-l3 epg Epg99 l3out L3Out1 contract provider Contract1 exit exit
AppEpg (Provider) ~ L3Out (Consumer)
Provider と Consumer を逆に設定する場合、以下の設定になります。
tenant Tenant1 application Ap1 epg Epg1 contract provider Contract1 exit exit external-l3 epg Epg99 l3out L3Out1 contract consumer Contract1 exit exit
BD Subnet を L3Out から広報する
BD Subnet を L3Out から広報するには下記の設定が必要です。
- BD の L3 Configurations で
Associated L3 Outs
へ適切な L3Out を関連付ける - BD Subnet の Scope を
Advertised Externally
に設定する
これを CLI で設定すると下記の通りです。
leaf 201 vrf context tenant Tenant1 vrf Vrf1 l3out L3Out1 route-map L3Out1_out scope global match bridge-domain Bd1 exit exit exit exit ! tenant Tenant1 interface bridge-domain Bd1 ip address 10.0.1.254/24 scope public exit exit
leaf の match bridge-domain Bd1
に一致する設定は、GUI 上では下記です。
Tenant の ip address 10.0.1.254/24 scope public
に一致する設定は、GUI 上では下記です。
ExtEpg Subnet
ExtEpg Subnet の External EPG Classification
が External Subnets for External EPG
をチェックした状態にするには以下のように設定します。
tenant Tenant1 external-l3 epg Epg99 l3out L3Out1 match ip 10.0.100.0/24 exit exit
ExtEpg の Route Control / External EPG Classification 設定ごとの設定を一覧にすると以下の通りです。 Route Control に関連する設定は leaf で、External EPG Classification に関する設定は tenant で実施します。
全体の設定
(Application Profile や Subject, Filter などを除き) 今回設定した主要コンポーネントを図示すると以下の通りです。
この構成を CLI から設定する場合、コンフィグは以下の通りです。
tenant Tenant1 access-list Filter1 match ip exit contract Contract1 subject Subject1 access-group Filter1 both exit exit vrf context Vrf1 exit bridge-domain Bd1 arp flooding vrf member Vrf1 exit application Ap1 epg Epg1 bridge-domain member Bd1 contract consumer Contract1 set qos-class level3 vmware-domain member Vmm1 push pre-provision exit exit exit l3out L3Out1 vrf member Vrf1 exit external-l3 epg Epg99 l3out L3Out1 vrf member Vrf1 match ip 10.0.101.0/24 contract provider Contract1 exit interface bridge-domain Bd1 ip address 10.0.1.254/24 scope public exit exit ! leaf 201 vrf context tenant Tenant1 vrf Vrf1 l3out L3Out1 router-id 10.0.99.201 route-map L3Out1_in scope global exit route-map L3Out1_out scope global match bridge-domain Bd1 exit exit route-map L3Out1_shared scope global exit exit router ospf default vrf member tenant Tenant1 vrf Vrf1 area 0.0.0.0 l3out L3Out1 exit exit interface vlan 101 vrf member tenant Tenant1 vrf Vrf1 ip address 10.0.99.254/24 ip router ospf default area 0.0.0.0 mtu 1500 exit interface ethernet 1/1 switchport trunk allowed vlan 101 tenant Tenant1 external-svi l3out L3Out1 exit exit