各IPアドレスに異なるホスト名を付けますか?

各IPアドレスに異なるホスト名を付けますか?

私は4つのIPアドレスを持つDebianサーバーを持っています。すべてのIPアドレスは同じホスト名を使用します。各IPアドレスに一意のホスト名を付けることはできますか?

ベストアンサー1

管理するコンピュータの数に応じて、特に専用のバインドサーバー操作がない場合は、各コンピュータが特定のDNSサーバーを使用するように構成するよりも、各システムでホストファイルを編集する方が簡単です。 Unix、Linux、Windows、Macはすべて同じホストファイルを使用するため、コピーが簡単です。 Linuxシステムは通常、/etc/hosts他の人が言及したとおりに残ります。必要に応じて、スクリプトを作成してこれらのファイルを各システムに伝播できます。以下はホストファイルの例です。

###################################################################
## This is an example HOSTS file created by         
## www.bleepingcomputer.com.                     
##                               
## All entries in a HOSTS file must be in the format of:     
##                               
## ipaddress    hostname                     
##                               
## For example:                          
##                               
## 192.168.1.1  mycomputer.mydomain.com              
##                               
## Notice that you must have a whitespace between the IP address 
## and the hostname.  Also keep in mind that the hostname can    
## not contain any symbols like /,\,http://, etc.        
##                               
## As a last note, you can the # symbol to make comments.  Any   
## line that starts with the # symbol will not be parsed by      
## the operating system.  You can therefore use this # symbol    
## to make comments as seen below.               
##                               
## Example valid entries found below.                
###################################################################

# The localhost entry should be in every HOSTS file and is used
# to point back to yourself.

127.0.0.1   localhost

# My test server for the website

192.168.1.2 test.bleepingcomputer.com

#Blocking known malicious sites
127.0.0.1  admin.abcsearch.com
127.0.0.1  www3.abcsearch.com #[Browseraid]
127.0.0.1  www.abcsearch.com #[Restricted Zone site]

あなたの場合は、各IPに行を追加するだけです。また、同じ行で各名前をスペースで区切って、単一の IP に対して複数の名前を指定できます。

この変更はすぐに適用され、何も再起動する必要はありません。あなたは必要かもしれませんDNSキャッシュフラッシュしかし、すでにその名前を使ったことがある場合。

おすすめ記事