Can I map a hostname *and* a port with /etc/hosts? [closed] October 13, 2022 by Tarik No, that’s not possible. The port is not part of the hostname, so it has no meaning in the hosts-file.