|
Solaris 10でDHCPクライアントから固定IPに変更したりその逆も
Solaris 10でDHCPクライアントから固定IPに変更したりその逆も
0.改訂履歴
1.はじめに
このドキュメントでは,Solaris 10をDHCPクライアントとしてセットアップした後,固定IPアドレスに変更する手順を説明す
る.また,逆に固定IPアドレスからDHCPクライアント化する方法も説明する.
2.現在DHCPクライアントとなって
いる事を確認する
- ネットワークインタフェイスの情報をifconfigで確認する.
# id uid=0(root) gid=0(root) # /sbin/ifconfig -a lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 e1000g0: flags=201004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4,CoS> mtu 1500 index 2 inet 192.168.99.8 netmask ffffff00 broadcast 192.168.99.255 ether 0:50:56:38:ec:7c #
|
- インタフェイスe1000g0がDHCPでIPアドレスが設定されている事が確認できる.
- DHCP化する為のファイルがあることを確認する.
# ls -la /etc/dhcp.e1000g0 -rw-r--r-- 1 root root 1 6月 10日 22:24 /etc/dhcp.e1000g0 #
|
- インタフェイス名がe1000g0で,DHCPファイルが存在する事が確認できた.
- ちなみに1バイトのファイルだが,中身は次の様になっている.
# cat /etc/dhcp.e1000g0
# od /etc/dhcp.e1000g0 0000000 000012 0000001 #
|
# cat /etc/hosts # # Internet host table # ::1 localhost 127.0.0.1 localhost 192.168.99.8 solaris10dev # Added by DHCP #
|
3.DHCPから固定IPアドレスに変
更する
- 今回は,次の様なネットワーク構成とする.
- IPアドレス 192.168.20.70
- サブネットマスク 255.255.255.0
- デフォルトルータ 192.168.20.1
- DNSサーバ 192.168.20.1
- DHCP機能をオフにする為にDHCPファイルを消す.
# rm /etc/dhcp.e1000g0 # ls -la /etc/dhcp.e1000g0 /etc/dhcp.e1000g0: ファイルもディレクトリもありません。 #
|
# cat /etc/hosts # # Internet host table # ::1 localhost 127.0.0.1 localhost 192.168.20.70 solaris10dev loghost #
|
# cat /etc/hostname.e1000g0 192.168.20.70 #
|
# cat /etc/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 # 192.168.0.0 255.255.255.0 #
|
# ls -la /dev/defaultrouter /dev/defaultrouter: ファイルもディレクトリもありません。 # echo 192.168.20.1 > /dev/defaultrouter # cat /dev/defaultrouter 192.168.20.1 #
|
# cat /etc/resolv.conf nameserver 192.168.20.1
#
|
# ifconfig -a lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 e1000g0: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 1500 index 2 inet 192.168.20.70 netmask ffffff00 broadcast 192.168.20.255 ether 0:50:56:38:ec:7c #
|
4.固定IPアドレスからDHCPクライアントに変更する
bash-3.00# touch /etc/dhcp.e1000g0 bash-3.00# ls -la /etc/dhcp.e1000g0 -rw-r--r-- 1 root root 0 6月 16日 21:22 /etc/dhcp.e1000g0 bash-3.00#
|
# /sbin/ifconfig -a lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 e1000g0: flags=201004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4,CoS> mtu 1500 index 2 inet 192.168.99.8 netmask ffffff00 broadcast 192.168.99.255 ether 0:50:56:38:ec:7c #
|
-
各種ネットワーク設定ファイルがどのように変更されているか確認する.
# cat /etc/hosts # # Internet host table # ::1 localhost 127.0.0.1 localhost 192.168.99.8 solaris10dev # Added by DHCP # cat /etc/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 # 192.168.0.0 255.255.255.0 # cat /dev/defaultrouter 192.168.20.1 # cat /etc/resolv.conf nameserver 192.168.99.1 #
|
-
/etc/hostsファイルとresolv.confが下記変わっている事が確認できた.
|
|