domainname
何するコマンド?
書き方
domainname [オプション] [NISドメイン名]
オプション
| オプション | 説明 |
|---|---|
| -a | 別名も表示する Display the alias name of the host (if used). This option is deprecated and should not be used anymore. |
| -A | 設定されている すべてのホスト名をFQDNで表示する……かな? Displays all FQDNs of the machine. This option enumerates all configured network addresses on all configured network interfaces, and translates them to DNS domain names. Addresses that cannot be translated (i.e. because they do not have an appropriate reverse DNS entry) are skipped. Note that different addresses may resolve to the same name, therefore the output may contain duplicate entries. Do not make any assumptions about the order of the output. |
| -b | 設定したホスト名を、ずっと有効にする……かな?でも、このオプションを指定しなくてもずっと有効だよね?分からん Always set a hostname; this allows the file specified by -F to be nonexistant or empty, in which case the default hostname localhost will be used if none is yet set. |
| -d | DNSのドメイン名を表示する Display the name of the DNS domain. Don't use the command domainname to get the DNS domain name because it will show the NIS domain name and not the DNS domain name. Use dnsdomainname instead. See the warnings in section THE FQDN above, and avoid using this option. |
| -f | ホスト名をFQDNで表示する Display the FQDN (Fully Qualified Domain Name). A FQDN consists of a short host name and the DNS domain name. Unless you are using bind or NIS for host lookups you can change the FQDN and the DNS domain name (which is part of the FQDN) in the /etc/hosts file. See the warnings in section THE FQDN above, and avoid using this option; use hostname --all-fqdns instead. |
| -F【ファイル名】 | ホスト名をファイルから読み込む Read the host name from the specified file. Comments (lines starting with a `#') are ignored. |
| -i | ホスト名に対応するIPアドレスを表示する。このオプションが使えなかったら「-I」オプションを使えや Display the network address(es) of the host name. Note that this works only if the host name can be resolved. Avoid using this option; use hostname --all-ip-addresses instead. |
| -I | 設定されている すべてのホスト名に対応するIPアドレスを表示する……かな? Display all network addresses of the host. This option enumerates all configured addresses on all network interfaces. The loopback interface and IPv6 link-local addresses are omitted. Contrary to option -i, this option does not depend on name resolution. Do not make any assumptions about the order of the output. |
| -s | 短縮表現のホスト名を表示する。 Display the short host name. This is the host name cut at the first dot. |
| -V | バージョン情報を表示する Print version information on standard output and exit successfully. |
| -y | NISドメイン名を表示・設定する Display the NIS domain name. If a parameter is given (or --file name ) then root can also set a new NIS domain. |
| -h | ヘルプを表示する Print a usage message and exit. |
補足事項
NISは「ネットワークにつながっているパソコンとかをまとめて管理するための仕組み(のひとつ)」です。
ネットワーク上にはパソコンとかがいっぱいあります。
こいつらは基本的に、それぞれ好き勝手に動いています。
自由気ままな奴らですよ。
そこに、1台の元締めコンピュータを投入しました。
元締めコンピュータは、ネットワーク上で好き勝手やってる奴らを統括的に管理するのが使命です。
元締めコンピュータが他のコンピュータのあれやこれやの情報を管理します。
このような仕組みのひとつがNISです。
NISは、主にUNIX系(Linuxとか)で使われる仕組みです。
Windowsの方が詳しい人は「Active Directory(アクティブディレクトリ)」みたいなものだと思ってください。
元締めコンピュータが下々のコンピュータたちの情報をまとめて管理します。
さて、このNISの仕組みですが、コンピュータに名前を付けて管理します。
この「NISの仕組みで使われるコンピュータの名前」を「NISドメイン名」と言います。
以上を踏まえて
NISドメイン名を表示・設定するときに使うコマンド
が「domainname」コマンドです。
「domainname」コマンドの使い方は簡単です。
何も指定しないで
domainname
を実行すると、設定されているNISドメイン名が表示されます。
domainname [NISドメイン名]
を実行すれば、指定した名前に変更できます。
例えば
domainname piyota
を実行すると、NISドメイン名が「piyota」になります。
それだけです。
オプションの使い方については必要に応じて情報を補完してください。
「domainname」コマンドは実質的に「hostname」コマンドと同じコマンドです。
domainname
を実行するのと
hostname -y
を実行するのは同じ結果になります。
試しに
man domainname
を実行して、マニュアルを表示してみてください。
「hostname」コマンドのマニュアルが表示されるはずです。
