2015年4月25日土曜日

OpenStackのDHCPレンジ拡張

■目的
 ある日OpenStack環境でVMを作成しようとしたところエラーで作成出来なかった。
調べてみるとNetworkで払い出せるアドレスの上限に達していたのでアドレスレンジを拡張する。

■前提
・OpenStack ver:juno

■内容
①まずはVMが作れないエラー調査

コンピュートノードで

tail -f /var/log/nova/nova-compute.log 
しながらVM作成を実行。
エラーになるが以下のようなログが出た。
nova-compute 2015-04-23 19:30:05.549 10981 WARNING nova.network.neutronv2.api [-] [instance: 24cbdf14-c745-46c9-921a-31a71729555d] Neutron error: No more fixed IPs in network: dc1ca486-c896-47ef-a3c5-6fa89a0b4654

nova-compute 2015-04-23 19:30:05.550 10981 ERROR nova.compute.manager [-] Instance failed network setup after 1 attempt(s)

No more fixed IPs in network:
ということでアドレスが枯渇している見たい。

②コントローラーノードで
[root@juno-controller01 ~]# . keystonerc_admin

[root@juno-controller01 ~(os_admin)]$
keystonerc_adminを読み込んでから

まずはneutron subnet-listでdhcpレンジを見てみる

[root@nfv-juno-controller01 ~(os_admin)]$ neutron subnet-list
+--------------------------------------+------+------------------+--------------------------------------------------------+
| id                                   | name | cidr             | allocation_pools                                       |
+--------------------------------------+------+------------------+--------------------------------------------------------+
| 0e7ebceb-758e-47aa-a1e8-65fe7bfc9404 |      | 192.168.210.0/24 | {"start": "192.168.210.1", "end": "192.168.210.253"}   |
| 201b876b-1d50-4b79-aeef-a04d8c0ffe48 |      | 192.168.205.0/24 | {"start": "192.168.205.1", "end": "192.168.205.253"}   |
| 247f6bf3-32f9-43ee-8dab-0620bb75e3e2 |      | 192.168.220.0/24 | {"start": "192.168.220.1", "end": "192.168.220.253"}   |
| 51148210-a9a3-46b6-a9d0-f9f496a5fdaa |      | 192.168.208.0/24 | {"start": "192.168.208.1", "end": "192.168.208.253"}   |
| 67b66355-7b26-447b-8e08-820ab5ee18f1 |      | 192.168.204.0/24 | {"start": "192.168.204.1", "end": "192.168.204.253"}   |
| 6b3cf7aa-c831-428d-a866-7373e0d63f71 |      | 192.168.255.0/24 | {"start": "192.168.255.151", "end": "192.168.255.170"} |
+--------------------------------------+------+------------------+--------------------------------------------------------+

192.168.255.0/24だけレンジが少ないのでこれを拡張する。
第4オクテット.181~200までを追加する。

しかしsubnet-updateのコマンド書式が分からないのでまずはヘルプ
[root@nfv-juno-controller01 ~(os_admin)]$ neutron help subnet-update
usage: neutron subnet-update [-h] [--request-format {json,xml}] [--name NAME]
                             [--gateway GATEWAY_IP] [--no-gateway]
                             [--allocation-pool start=IP_ADDR,end=IP_ADDR]
                             [--host-route destination=CIDR,nexthop=IP_ADDR]
                             [--dns-nameserver DNS_NAMESERVER]
                             [--disable-dhcp] [--enable-dhcp]
                             [--ipv6-ra-mode {dhcpv6-stateful,dhcpv6-stateless,slaac}]
                             [--ipv6-address-mode {dhcpv6-stateful,dhcpv6-stateless,slaac}]
                             SUBNET

Update subnet's information.

・・・

③以下の書式でコマンド実行してみる。
既存のアドレス分も記載して実行する
[root@nfv-juno-controller01 ~(os_admin)]$ neutron subnet-update --allocation-pool start=192.168.255.151,end=192.168.255.170 --allocation-pool start=192.168.255.181,end=192.168.255.200 6b3cf7aa-c831-428d-a866-7373e0d63f71

Updated subnet: 6b3cf7aa-c831-428d-a866-7373e0d63f71


もう一度見てみると
[root@nfv-juno-controller01 ~(os_admin)]$ neutron subnet-list
+--------------------------------------+------+------------------+--------------------------------------------------------+
| id                                   | name | cidr             | allocation_pools                                       |
+--------------------------------------+------+------------------+--------------------------------------------------------+
| 0e7ebceb-758e-47aa-a1e8-65fe7bfc9404 |      | 192.168.210.0/24 | {"start": "192.168.210.1", "end": "192.168.210.253"}   |
| 201b876b-1d50-4b79-aeef-a04d8c0ffe48 |      | 192.168.205.0/24 | {"start": "192.168.205.1", "end": "192.168.205.253"}   |
| 247f6bf3-32f9-43ee-8dab-0620bb75e3e2 |      | 192.168.220.0/24 | {"start": "192.168.220.1", "end": "192.168.220.253"}   |
| 51148210-a9a3-46b6-a9d0-f9f496a5fdaa |      | 192.168.208.0/24 | {"start": "192.168.208.1", "end": "192.168.208.253"}   |
| 67b66355-7b26-447b-8e08-820ab5ee18f1 |      | 192.168.204.0/24 | {"start": "192.168.204.1", "end": "192.168.204.253"}   |
| 6b3cf7aa-c831-428d-a866-7373e0d63f71 |      | 192.168.255.0/24 | {"start": "192.168.255.181", "end": "192.168.255.200"} |
|                                      |      |                  | {"start": "192.168.255.151", "end": "192.168.255.170"} |
+--------------------------------------+------+------------------+--------------------------------------------------------+
[root@nfv-juno-controller01 ~(os_admin)]$

192.168.255の.181~200が増えている。

■終わり
この状態で新規VM作成したところ問題なく作成できた。
最初はHDDが枯渇したのかと思ったがすんなり解決できてよかった。

私の体験が誰かの生産性向上に役立っていただけることを祈って

2015年4月6日月曜日

AristaでのVRF設定

■目的
 Arista-SWでVRFの設定をしてみる。
基本的にCiscoと同じ設定なので備忘録として記載する。

■内容
以下コマンドでVRF設定が可能

①まずはvrfの定義をする
vrf definition vrf1
   rd 65000:1

vrf definition vrf2
   rd 65000:2

②インターフェースVLANにVRFの指定をする
interface Vlan301
   vrf forwarding vrf1
   ip address 30.0.1.254/24

interface Vlan401
   vrf forwarding vrf2
   ip address 40.0.1.254/24

③VRF指定でルーティングを記載する
ip route vrf vrf1 40.0.1.0/24 30.0.2.1
ip route vrf vrf2 30.0.1.0/24 40.0.12.1

④IProutingでvrfの指定をする
ip routing
ip routing vrf vrf1

ip routing vrf vrf2


①Arista#sh vrf
  Vrf        RD            Protocols       State      Interfaces
---------- ------------- --------------- ------------- -------------------
   vrf1       65000:1       ipv4            routing    Vlan301, Vlan302,
                                                       Vlan303, Vlan304,
                                                       Vlan305,
   vrf2       65000:2       ipv4            routing    Vlan401, Vlan402,
                                                       Vlan403, Vlan404,
                                                       Vlan405,
test-arista#sh ip route vrf vrf1
Codes: C - connected, S - static, K - kernel,
       O - OSPF, IA - OSPF inter area, E1 - OSPF external type 1,
       E2 - OSPF external type 2, N1 - OSPF NSSA external type 1,
       N2 - OSPF NSSA external type2, B I - iBGP, B E - eBGP,
       R - RIP, I - ISIS, A B - BGP Aggregate, A O - OSPF Summary

Gateway of last resort is not set

 C      30.0.1.0/24 is directly connected, Vlan301
 C      30.0.2.0/24 is directly connected, Vlan302
 C      30.0.3.0/24 is directly connected, Vlan303
 C      30.0.4.0/24 is directly connected, Vlan304
 C      30.0.5.0/24 is directly connected, Vlan305
 S      40.0.11.0/24 [1/0] via 30.0.12.1, Vlan312
 S      40.0.21.0/24 [1/0] via 192.168.207.250, Vlan2007

test-arista#sh ip route vrf vrf2
Codes: C - connected, S - static, K - kernel,
       O - OSPF, IA - OSPF inter area, E1 - OSPF external type 1,
       E2 - OSPF external type 2, N1 - OSPF NSSA external type 1,
       N2 - OSPF NSSA external type2, B I - iBGP, B E - eBGP,
       R - RIP, I - ISIS, A B - BGP Aggregate, A O - OSPF Summary

Gateway of last resort is not set

 S      30.0.1.0/24 [1/0] via 40.0.12.1, Vlan412
 S      30.0.11.0/24 [1/0] via 40.0.12.1, Vlan412
 S      30.0.21.0/24 [1/0] via 192.168.203.250, Vlan2003
 C      40.0.1.0/24 is directly connected, Vlan401
 C      40.0.2.0/24 is directly connected, Vlan402
 C      40.0.3.0/24 is directly connected, Vlan403
 C      40.0.4.0/24 is directly connected, Vlan404
 C      40.0.5.0/24 is directly connected, Vlan405

test-arista#ping vrf vrf2 192.168.204.1
PING 192.168.204.1 (192.168.204.1) 72(100) bytes of data.
^C
--- 192.168.204.1 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

test-arista#ping vrf vrf2 192.168.204.254
PING 192.168.204.254 (192.168.204.254) 72(100) bytes of data.
80 bytes from 192.168.204.254: icmp_req=1 ttl=64 time=0.065 ms
80 bytes from 192.168.204.254: icmp_req=2 ttl=64 time=0.016 ms
80 bytes from 192.168.204.254: icmp_req=3 ttl=64 time=0.014 ms
80 bytes from 192.168.204.254: icmp_req=4 ttl=64 time=0.017 ms
80 bytes from 192.168.204.254: icmp_req=5 ttl=64 time=0.012 ms

--- 192.168.204.254 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.012/0.024/0.065/0.021 ms, ipg/ewma 0.056/0.044 ms
test-arista#


■終わり
Ciscoとほぼ一緒

私の体験が誰かの生産性向上に役立っていただけることを祈って

Arista-SWでのVerUP

■目的
 Arista-SWでのVerUP方法を記載する。
CiscoのIOSと違い、AristaのEOSは容量が大きいためtftpではなくFTPを使ったファイル転送を使う。

■前提
・VerUPするAristaのEOSは事前にPC上にダウンロードしておく
・PCでFTPサーバーを立てておく
・AristaにIPを振ってVLANの割り当てをし、PCとArista間で疎通出来る事を確認する。

■内容
①Arista-SWで新しいに空き容量がある事を確認する
②copyコマンドでEOSをAristaに送る
③boot configで次回起動時のEOSを新しいEOSに指定する。
④再起動

①Arista#sh version
Arista DCS-7150S-24-F
Hardware version:    01.00
Serial number:       XXXXXXXXXXXXX
System MAC address:  XXXXXXXXXXXXX

Software image version: 4.12.3
Architecture:           i386
Internal build version: 4.12.3-1352018.EOS4123
Internal build ID:      XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Uptime:                 6 weeks, 2 days, 19 hours and 26 minutes
Total memory:           4017112 kB
Free memory:            1980076 kB
 
以下のcopyコマンドでAristaのFlash内にOSを入れる。 ・事前にdir flash:で空き容量があることを確認する。 ・ftpのアカウントを作成しておく ②Arista#copy ftp://test:test@192.168.1.1/EOS-4.12.5.1.swi flash: errorと出ずに以下のように転送が始まっていればOK `EOS-4.12.5.1.swi' at 202073552 (48%) 2.13M/s eta:95s [Receiving data]

転送が終わったらdir flash:でOSが転送出来ていることを確認する。
#Arista#dir flash:
Arista#dir flash:
Directory of flash:/

       -rwx   408036210           Jul 18 01:49  EOS-4.12.3.swi
       -rwx   413508508           Dec 19 15:41  EOS-4.12.5.1.swi
       -rwx          24            Aug 1 02:04  boot-config
       drwx        4096           Nov 12 01:12  debug
       -rwx           0            Aug 1 02:05  fullrecover
       drwx        4096           Nov 12 01:10  persist
       drwx        4096           Aug 23 18:42  schedule
       -rwx        2698           Dec 26 00:20  startup-config
       -rwx          13           Nov 12 01:09  zerotouch-config

1769799680 bytes total (537268224 bytes free)

次にboot-configを確認する。

Arista#show boot-config 
Software image: flash:EOS-4.12.3.swi
Console speed: (not set)
Aboot password (encrypted): (not set)
Memory test iterations: (not set)

次回起動時に新しいOSで上がってくるように以下コマンドで転送したOSを指定する。
③Arista(config)#boot system flash:^VEOS-4.12.5.1.swi

Arista#show boot-config 
Software image: flash:/EOS-4.12.5.1.swi
Console speed: (not set)
Aboot password (encrypted): (not set)
Memory test iterations: (not set)

この状態で再起動すれば新OSで上がってくる。

■終わり
容量が大きいのもあるがFTP接続であればTCPコネクションを張るので信頼性は高くなったので良いかな

私の体験が誰かの生産性向上に役立っていただけることを祈って

2015年4月4日土曜日

Cisco-SWのライセンス変更

■目的
 IP-BaseのCisco-SWをIP-Serviceのライセンスを購入し、IP-Serviceに変更してみる。
最近のCisco機器はライセンスの形式がRTU(Right to Use)モデルのため
従来のようなライセンスファイルを機器にダウンロードせずにコマンドでライセンスレベルを変更することができる。
#例)C3750G-24TS-E、C3750G-24TS-S とかの-EがIP-Service -SがIP-Base

■参考にさせて頂いたサイト
・http://www.cisco.com/web/JP/product/hs/switches/cat3850/prodlit/pdf/Catalyst_3850_Licensing_and_Warranty.pdf
http://d.hatena.ne.jp/keroring/20120522/1337649001


■内容
特権モードから
license right-to-use activate ipservices all
のコマンドで変更できる。


Switch#license right-to-use activate ipservices all
PLEASE READ THE FOLLOWING TERMS CAREFULLY. INSTALLING THE LICENSE
OR LICENSE KEY PROVIDED FOR ANY CISCO PRODUCT FEATURE OR USING SUCH
PRODUCT FEATURE CONSTITUTES YOUR FULL ACCEPTANCE OF THE FOLLOWING TERMS.
YOU MUST NOT PROCEED FURTHER IF YOU ARE NOT WILLING TO BE BOUND BY ALL
THE TERMS SET FORTH HEREIN. Use of this product feature requires an
additional license from Cisco, together with an additional payment.
You may use this product feature subject to the Cisco end user license
agreement http://www.cisco.com/en/US/docs/general/warranty/English/EU1KEN_.html,
together with any supplements relating to such product feature.
It is your responsibility to make payment to Cisco for your use of the
product feature if not already licensed to do so. Your acceptance of
this agreement for the software features on one product shall be deemed
your acceptance with respect to all such software on all Cisco products
you purchase which includes the same software.  (The foregoing notwithstanding,
you must purchase a license for each software feature you use, so that
if you enable a software feature on 1000 devices, you must purchase
1000 licenses for use.)    This license may be transferrable from another
Cisco device of the same model for the same functionality if such license
already is owned.  Activation of the software command line interface
will be evidence of your acceptance of this agreement. By clicking  the
"accept" button  or typing "yes" you are  indicating  you have read and
agree to be bound by all the terms provided herein.ACCEPT (yes/no) : yes
% switch-1:stack-mgr:Reboot the switch to invoke the highest activated License level

Switch#
*Feb 28 17:57:46.439: %SMN_HBL_LICENSE-6-LIC_EVAL_TO_PERM: 1 stack-mgr:
  License level upgraded from ipservices evaluation to permanent; permanent
 license is in-use without reboot


上記が出来たらreboot後に以下確認コマンドで確認する

Switch#
Switch#
Switch#show license right-to-use summary
  License Name    Type     Count   Period left
-----------------------------------------------
  ipservices   permanent   N/A      Lifetime
  apcount      base        1        Lifetime
  apcount      adder       1        Lifetime

--------------------------------------------

License Level In Use: ipservices
License Level on Reboot: ipservices
Evaluation AP-Count: Disabled
Total AP Count Licenses: 2
AP Count Licenses In-use: 0
AP Count Licenses Remaining: 2


Switch#
Switch#show license right-to-use usage
 Slot#  License Name     Type     usage-duration(y:m:d)  In-Use  EULA
-----------------------------------------------------------------------
 1      ipservices     permanent    0 :0 :11               yes   yes
 1      ipservices     evaluation   0 :0 :0                no    yes
 1      ipbase         permanent    0 :0 :0                no    no
 1      ipbase         evaluation   0 :0 :0                no    no
 1      lanbase        permanent    0 :0 :0                no    yes
 1      apcount        evaluation   0 :0 :0                no    no
 1      apcount        base         0 :0 :11               yes   yes
 1      apcount        adder        0 :0 :0                yes   yes

Switch#
Switch#show version
Cisco IOS Software, IOS-XE Software, Catalyst L3 Switch Software (CAT3K_CAA-UNIVERSALK9-M),
 Version 03.02.00.SE RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
 (省略)

License Level: Ipservices
License Type: Permanent
Next reload license Level: Ipservices
 (省略)


■終わり
これ知っていると正直紳士協定になってしまうような気がするが、問い合わせサポート等受けられない可能性もあるので正攻法で行くほうが無難かな。
そもそもCiscoのSWを買う機会が少なくなっているのであまり使う機会もないだろう。

私の体験が誰かの生産性向上に役立っていただけることを祈って