Diferentes sabores de modificación del archivo /etc/hosts en una LPAR AIX.
Fuente: https://www.ibm.com/developerworks/dwwi/jsp/WSLogin.jsp, agregados de ED.
Intro:
Este fichero se utiliza para obtener una relación entre un nombre de máquina y una dirección IP.
Métodos conocidos:
editar el archivo hosts:
#vi /etc/hosts
añadir una línea al /etc/hosts desde la línea de comandos:
#echo "192.168.2.5 mynewhost" >> /etc/hosts
editar el host vía SMIT:
#smitty hosts --> add a hosts --> parámetros
usar el comando hostent:
Este ultimo, es nuevo para nosotros (si bien vía smitty una función lo evoca) y funciona de la siguiente manera:
Simple syntax
To Add an Address-to-Host Name Mapping with the hostent command, here's the syntax:
#hostent -a IPAddress -h hostname
Those flags are easy enough to remember:
-a is to add an IP address
-h is the hostname
Veamos un ejemplo:
# hostent -a 192.168.2.5 -h mynewhost
Extras:
The hostent command also lets you add aliases, and it won't let you add the same IP address twice. If you try to add an IP address that already exists, you'll get a message like this:
hostent: 0822-041 The IP address 192.168.2.5 already exists.