Solaris 10 で NIC の IP アドレスを設定する




Solaris 10 で NIC の IP アドレスを設定する方法は次の通り

Solaris 10 では IP アドレスを変更した際には再起動しなければなりません。

次のファイルを編集することで IP アドレスを変更します。

  • /etc/inet/hosts
  • /etc/inet/ipnodes
  • /etc/inet/netmasks
  • /etc/hostname.[ インターフェース名 ]
  • /etc/net/ticlts/hosts
  • /etc/net/ticots/hosts
  • /etc/net/ticotsord/hosts

  • 概念的には、ホスト名に IP アドレスを定義して、
    そのホスト名をインターフェースに結び付けることで、
    インターフェースに IP アドレスを設定するような流れになる。


    具体的な変更手順

    1.ホスト名の設定

    以下のファイルの両方に同様の内容を記述する。
    設定が異なる場合 ipnodes の設定が優先される。

  • /etc/inet/hosts
  • /etc/inet/ipnodes


  • /etc/inet/hosts を編集する。

    #
    # Internet host table
    #
    127.0.0.1       localhost
    1.1.1.1         hostA   loghost
    2.2.2.1         hostB
    

    /etc/inet/ipnodes を編集する。

    #
    # Internet host table
    #
    ::1     locahost
    127.0.0.1       localhost
    1.1.1.1         hostA   loghost
    2.2.2.1         hostB
    


    2.ネットマスクの設定

    /etc/inet/netmasks を編集する。

    #
    # The netmasks file associates Internet Protocol (IP) address
    # masks with IP network numbers.
    #
    #       network-number  netmask
    #
    # The term network-number refers to a number obtained from the Internet Network
    # Information Center.
    #
    # Both the network-number and the netmasks are specified in
    # "decimal dot" notation, e.g:
    #
    #               128.32.0.0 255.255.255.0
    #
    1.1.1.0   255.255.255.0
    2.2.2.0   255.255.255.0
    


    3.インターフェースとホスト名を結び付ける

    /etc/hostname.pcn0, /etc/hostname.elxl0 を編集する。

    今回は、IBM XSeries 340 にインストールした Solaris 10 での設定例。

    ちなみに elxl は、3Com の増設 NIC。
    イーサネットドライバによって名前が変わる。例. hme0 など。

    /etc/hostname.pcn0

    hostA
    

    /etc/hostname.elxl0

    hostB
    



    これ以降は、ファイルの内容を見て必要であれば修正する。

    今回は、必要ありませんでした。


    4.ホスト名の設定(必要であれば)

    今回は確認だけ。

  • /etc/net/ticlts/hosts

  • #
    # Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
    # Use is subject to license terms.
    #
    # ident "@(#)hosts      1.3     03/12/07 SMI"
    #
    # NOTE: This file is no longer consulted and may be removed from a future
    #       release of Solaris.
    #
    

  • /etc/net/ticots/hosts

  • #
    # Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
    # Use is subject to license terms.
    #
    # ident "@(#)hosts      1.3     03/12/07 SMI"
    #
    # NOTE: This file is no longer consulted and may be removed from a future
    #       release of Solaris.
    #
    


  • /etc/net/ticotsord/hosts

  • #
    # Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
    # Use is subject to license terms.
    #
    # ident "@(#)hosts      1.3     03/12/07 SMI"
    #
    # NOTE: This file is no longer consulted and may be removed from a future
    #       release of Solaris.
    #
    


    以上で、設定は完了。

    後は、システムを再起動して設定を反映。