cancel
Showing results for 
Search instead for 
Did you mean: 

etc tile entry in UNIX

zaadss
Level 3
Hi,

I need to add an media server's name with its corresponding IP in masters servers host file for resolution purpose,wats the procedure...
I am aware of addning in it Windows but not in UNIX.As I am new to UNIX environment kindly request you to guide me all the steps.

Thanks in Advance,
Zaad
2 REPLIES 2

Andy_Welburn
Level 6
(or /etc/inet/hosts)

From the UNIX man page:

"...
The hosts file is a local database that associates the names of hosts with their Internet Protocol (IP) addresses. The hosts file can be used in conjunction with, or instead of, other hosts databases, including the Domain Name System (DNS), the NIS hosts map and the NIS+ hosts table.

The hosts file has one entry for each IP address of each host. If a host has more than one IP address, it will have one entry for each, on consecutive lines. The format of each line is:

IP-address official-host-name nicknames...

Items are separated by any number of SPACE and/or TAB characters. The first item on a line is the host's IP address. The second entry is the host's official name. Subsequent entries on the same line are alternative names for the same machine, or "nicknames." Nicknames are optional.
..."


Yasuhisa_Ishika
Level 6
Partner Accredited Certified
Format of hosts file(/etc/hosts) is same with that of Windows(Windows\system32\drivers\etc\hosts).
If you have never used editor app(vi, emacs,..) on UNIX,  copy and paste as follows.

1) save current hosts
# cp -p /etc/hosts /etc/hosts.orig

2) show all lines in /etc/hosts
# cat /etc/hosts

3) copy output of 2) to clipboard, paste them and edit lines on text editor

4) copy whole to clipboard

5) run below, paste, and enter Ctrl+D
# cat > /etc/hosts

6) check
# cat /etc/hosts

To recover origial, copy saved file.
# cp -p /etc/hosts.orig /etc/hosts