1. sudoコマンドの実行結果を確認する
1 2 3 4 5 6 7 8 9 10 11 |
$ sudo cat /etc/hosts sudo: unable to resolve host MYHOSTNAME 127.0.0.1 localhost # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts |
2. /etc/hostsにホスト名を追加する
1 |
$ sudo sh -c 'echo 127.0.1.1 $(hostname) >> /etc/hosts' |
3. /etc/hostsの編集結果を確認する
1 2 3 4 5 6 7 8 9 10 11 |
$ sudo cat /etc/hosts 127.0.0.1 localhost # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts 127.0.1.1 MYHOSTNAME |
"unable resolve host …"が表示されなくなった。