2012/09/11

ZFSなMicroserverをnwamcfgで固定IPに設定するの巻


HP ProLiant MicroserverでOpenIndianaなZFSサーバをやっとこさ構成したのですが、肝心なIPの設定がDHCPになっていた。一応サーバなんで、これじゃぁ

アレだな。

ということで、固定IPに変更してみた。
いろいろと設定ファイルをいぢるのかなと思っていたのだけど、実際はnwamcfgで

一発OK

でした。で手順は、



リファレンス
http://docs.oracle.com/cd/E19963-01/html/821-1462/nwamcfg-1m.html



user@server:‾$ su -
#まずは何はともあれ"su" します。

Password:
OpenIndiana (powered by illumos)    SunOS 5.11    oi_151a3    March 2012
You have new mail.

root@server:~# nwamcfg
#ここから開始です。

nwamcfg>
#セカンダリプロンプトが表示されます。

nwamcfg> list
#"list"コマンドでネットワーク構成プロファイルとロケーションが表示されます。

NCPs:
Automatic
Locations:
Automatic
NoNet
User

nwamcfg> select ncp Automatic
#Automaticプロファイルを選択します。


nwamcfg:ncp:Automatic> list
#プロファイルを構成しているオブジェクトとして実装されているNICの一覧が表示されます。

NCUs:
phys bge0 #onboardのNIC
ip bge0
phys e1000g0 #追加したIntel Giga NIC
ip e1000g0

nwamcfg:ncp:Automatic> select ncu ip e1000g0
#e1000g0を選択。

nwamcfg:ncp:Automatic:ncu:e1000g0> walkprop
#walkpropで一通りの設定パラメタを対話形式で設定します。

enabled (true) [true|false]>
#デフォルトは"true"

ip-version (ipv4,ipv6) [ipv4|ipv6]>
#デフォルトは"ipv4,ipv6"

ipv4-addrsrc (static) [dhcp|static]>
#デフォルトは"dhcp"ですので"staic"に変更します。

ipv4-addr ("10.10.10.1")>
#付与するIPを設定します。

ipv4-default-route ("10.10.10.254")> 10.10.10.1
#defaul gatewayのIPを設定。

ipv6-addrsrc (dhcp,autoconf) [dhcp|autoconf|static]>
#enterキー一発押打で流します。

ipv6-default-route>
#もう一丁流します。

nwamcfg:ncp:Automatic:ncu:e1000g0> commit
#NCUのプロパティ設定を"commit"すると設定が反映されます。

Committed changes

nwamcfg:ncp:Automatic:ncu:e1000g0> end
#"end"で抜けます。


nwamcfg:ncp:Automatic> end
#もう一丁"end"

nwamcfg>
#続いてDNSの設定もやっちゃいます。

nwamcfg> list
#ネットワーク構成プロファイルとロケーションが表示されます。

NCPs:
Automatic
Locations:
Automatic
NoNet
User

nwamcfg> select loc Automatic
#今度はlocプロファイル構成を設定します。

nwamcfg:loc:Automatic> set dns-nameservice-configsrc=manual
#setコマンドでnameserverの配布方法を指定します。(manual|dhcp)

---
#昔ながらのnssswitch.confで設定している場合はそのファイルのパスを設定します。
#nameservices-config-file: path to nsswitch.conf file
---

nwamcfg:loc:Automatic> set dns-nameservice-servers=8.8.8.8,8.8.4.4
#setコマンドでnameserverのIPを設定します。

nwamcfg:loc:Automatic> commit
#"commit"します。

Committed changes

nwamcfg:loc:Automatic> end

nwamcfg> end


root@server:~#

これで固定IPの設定は完了です。rebootしても設定が元に戻ることはありませんでした。

0 件のコメント:

コメントを投稿