Operating System - HP-UX
1834051 Members
2277 Online
110063 Solutions
New Discussion

Re: add NAT IP to hostname

 
joe_91
Super Advisor

add NAT IP to hostname

We have some NAT ip that we want to add to the hostnames in /etc/hosts will this work

hostname current-ip nat-ip
sharky (ex.69.4.213.108) (ex.10.9.66.55)

Thanks

Joe
2 REPLIES 2
Ivan Ferreira
Honored Contributor

Re: add NAT IP to hostname

It's not the correct sintax, the correct sintax will be:

current-ip hostname alias
nat-ip hostname-nat alias-nat

You should not use the same host name for multiple ip address in the hosts file.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Bill Hassell
Honored Contributor

Re: add NAT IP to hostname

NAT provides a special address outside your computer and since you cannot assign two or more IP addresses to a single hostname, you'll have to create a new hostname, perhaps sharknat or something similar. If you cannot change entries in your DNS server, you'll need to change your /etc/nsswitch.conf file so that /etc/hosts is consulted first, then your DNS server(s). Change the hosts line to read:

hosts: files [NOTFOUND=continue UNAVAIL=continue] dns

Then add the IP address and new-hostname to /etc/hosts. Use nsquery to verify:

nsquery hosts new-hostname


Bill Hassell, sysadmin