状況
ローカル環境において、ホスト名(VIP)とIPアドレスの紐付けを行いたい
手順
$ sudo vim /etc/hosts
で
[紐付けたいIP] [VIP]
を追加するだけ。
具体例
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
123.456.789.000 qiita.com
これだけ
あとは
$ ping [ホスト名]
を実行して
PING [ホスト名] ([紐付けたIPアドレス]): 56 data bytes
64 bytes from [紐付けたIPアドレス]: icmp_seq=0 ttl=55 time=37.822 ms
64 bytes from [紐付けたIPアドレス]: icmp_seq=1 ttl=55 time=33.661 ms
64 bytes from [紐付けたIPアドレス]: icmp_seq=2 ttl=55 time=29.932 ms
64 bytes from [紐付けたIPアドレス]: icmp_seq=3 ttl=55 time=30.933 ms
のような出力を得られればグッド👍疎通確認成功。
最後にホスト名を含んだURLを叩いてページが開けるのを確認しておしまい。
ローカル確認後、/etc/hosts
の変更を元に戻すのをお忘れなく。