参考URL
VIBについて
・http://www.v-front.de/2012/11/a-daemons-vib-part-3-building-software.html
・http://vfronttest.blogspot.jp/2012_11_01_archive.html
・http://www.v-front.de/2012/11/a-daemons-vib-part-3-building-software.html
Firewallについて
・http://cormachogan.com/2014/03/28/adding-bespoke-firewall-rules-to-esxi/
・http://www.yellow-bricks.com/2011/11/29/how-to-create-your-own-vib-files/
・http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2005284
・http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2005304
ESXi5-CPTについて
・http://www.v-front.de/p/esxi5-community-packaging-tools.html
今回のVIBインストールでのディレクトリ構成(ESXiへの配置)
/etc/vmware/firewall/iperf.xml
/opt/bin/iperf
とします。
*読む方への注意
オチがあるので気をつけてください。
出来上がったものはこちらに置いておきます。
自己責任でお願いいたします。
またZIP圧縮していますので、
中のファイルを見ると何をしているのか分かると思います。
・/opt/binに配置するも撃沈バージョン
http://www.neko6.info/wp-content/up/iperf-esxi.zip
・Firewallルールのみバージョン
http://www.neko6.info/wp-content/up/iperf-fw.zip
なにはともあれiperfを作りましょ。
# cd /tmp # mkdir -p opt/bin/ # wget https://iperf.fr/download/iperf_2.0.5/iperf-2.0.5-source.tar.gz # tar zxfv iperf-2.0.5-source.tar.gz # cd iperf-2.0.5/ # ./configure # make # cp src/iperf /tmp/opt/bin/
「make install」までは必要なく、バイナリだけひっぱて来ます。
VIBでインストールできるディレクトリは限られているみたいで、
とりあえず、ESXiの/opt以下に配置するようにしました。
ちなみに(/opt以外など)にインストールしようとすると・・・・
# esxcli software vib install -v /tmp/iperf-0.1.x86_64.vib --no-sig-check [InstallationError] Error in running mv /tmp/img-stg/data/iperf.t00 /tardisks/: Return code: 1 Output: mv: can't rename '/tmp/img-stg/data/iperf.t00': Operation not permitted It is not safe to continue. Please reboot the host immediately to discard the unfinished update. Please refer to the log file for more details.
こんなエラーを吐かれます。。。
で次に、Firewallのルールを作ります。
# cd /tmp # mkdir -p etc/vmware/firewall/ # vi etc/vmware/firewall/iperf.xml ConfigRoot> <!-- iperf --> <service> <id>iperf</id> <rule id='0000'> <direction>inbound</direction> <protocol>tcp</protocol> <porttype>dst</porttype> <port>5001</port> </rule> <enabled>false</enabled> <required>false</required> </service> </ConfigRoot>
これがFirewallルールとなります。
ちなみにESXiにはデフォルトで
# ls /etc/vmware/firewall/ service.xml
があり、ここで制御しているみたいです。
さてこれを、tgzへ圧縮します。
cd /tmp # ls iperf-2.0.5-source.tar.gz iperf-2.0.5 etc/ opt/ # tar czfv iperf.tgz etc/ opt/ etc/ etc/vmware/ etc/vmware/firewall/ etc/vmware/firewall/iperf.xml opt/ opt/bin/ opt/bin/iperf
ディレクトリ構成はこんな感じ。
Windowsを使って出来上がったiperf.tgzをVIBに変換します。
・http://www.v-front.de/p/esxi5-community-packaging-tools.html
tgz2vib5.cmdを叩けばGUI起動してきます。
あとは、tgzの指定をするのですが、2点ほど。
・Load presets・・・Firewall rule
・Packaging・・・Do not touch
にしておいたほうがよさげです。
出来上がったiperf.vibをESXiに持っていって
# esxcli software acceptance set --level CommunitySupported # esxcli software vib install -v /tmp/iper.vib --no-sig-check Installation Result Message: Operation finished successfully. Reboot Required: false VIBs Installed: iperf_bootbank_iperf VIBs Removed: VIBs Skipped:
でインストールされます。
# esxcli software vib list |grep iperf iperf 0.1 iperf CommunitySupported 2014-09-29
インストールされているのが分かります。
Firewallを有効にしてあげる。
vSphere clientでセキュリティプロファイルからでもOK。
# esxcli network firewall refresh # esxcli network firewall ruleset set -e true -r iperf
であとは実行するのみ!!
# /opt/bin/iperf -v iperf version 2.0.5 (08 Jul 2010) pthreads # /opt/bin/iperf -s bind failed: Operation not permitted ------------------------------------------------------------ Server listening on TCP port 5001 TCP window size: 64.0 KByte (default) ------------------------------------------------------------
はい!!残念でした!!
どうやっても、ポートBindできません!!
お手上げです!!
なので、実際に使用する場合は、
・iperfはバイナリを直接実行
・FirewallルールはVIBでインストール
ということになります。
一度VIBをアンインストール
# esxcli software vib remove -n iperf Removal Result Message: Operation finished successfully. Reboot Required: false VIBs Installed: VIBs Removed: iperf_bootbank_iperf VIBs Skipped:
する。
最初に作ったiperfのバイナリだけを、/opt/binなどに配置。
Firewallルールだけをtgz圧縮する。
# tar czfv iperf.tgz etc/ etc/ etc/vmware/ etc/vmware/firewall/ etc/vmware/firewall/iperf.xml
で再度VIB化してインストール。
あとは、Firewallを空けてあげてバイナリを実行するだけ。
# ./iperf -s ------------------------------------------------------------ Server listening on TCP port 5001 TCP window size: 64.0 KByte (default) ------------------------------------------------------------ [ 4] local 172.16.2.2 port 5001 connected with 172.16.1.50 port 53533 [ ID] Interval Transfer Bandwidth [ 4] 0.0-10.1 sec 34.2 MBytes 28.5 Mbits/sec
こんな感じw(無線経由でやっちゃった)
ということで、誰かVIBでインストールしても使えるようにしてください。
[tegaki]他力本願寺[/tegaki]