FLeiXiuS
November 6th, 2004, 01:32 AM
Here is a quick how to, to edit your /etc/hosts file.
The $ represents a line of code you may enter in a terminal.
Open /etc/hosts with your favorite text editor. Remember to use sudo.
Format:
<IP> <HOSTNAME>.<DOMAIN> <ALIAS>
Example:
127.0.0.1 localhost.localdomain localhost
IP
Replace the <IP> with the IP of your system. If your running DHCP do not worry about editing this file. To detect your IP address run
$ lsconfig Then browse for the connected interface (eth0, wlan0, etc)
Hostname
Replace the <HOSTNAME> to your systems hostname.
To view current hostname:
$ hostname
To change hostname:
$ sudo hostname 'enterhostname'
(without quotes)
Domain Name
The domain name can be anything you like unless it must be resolv, which then you must use /etc/resolv.conf. But thats another issue i'll cover later! :o
Alias
Alias are simply another way to combine a set of arguments. When you create a hosts file, its simply creating a list of hosts on the network, or locally. Its much easier to understand if you kept the alias the same as the hostname. It saves a lot of trouble with debugging and troubleshooting. But you are free to use whatever you like.
That should help you out. Please comment!
The $ represents a line of code you may enter in a terminal.
Open /etc/hosts with your favorite text editor. Remember to use sudo.
Format:
<IP> <HOSTNAME>.<DOMAIN> <ALIAS>
Example:
127.0.0.1 localhost.localdomain localhost
IP
Replace the <IP> with the IP of your system. If your running DHCP do not worry about editing this file. To detect your IP address run
$ lsconfig Then browse for the connected interface (eth0, wlan0, etc)
Hostname
Replace the <HOSTNAME> to your systems hostname.
To view current hostname:
$ hostname
To change hostname:
$ sudo hostname 'enterhostname'
(without quotes)
Domain Name
The domain name can be anything you like unless it must be resolv, which then you must use /etc/resolv.conf. But thats another issue i'll cover later! :o
Alias
Alias are simply another way to combine a set of arguments. When you create a hosts file, its simply creating a list of hosts on the network, or locally. Its much easier to understand if you kept the alias the same as the hostname. It saves a lot of trouble with debugging and troubleshooting. But you are free to use whatever you like.
That should help you out. Please comment!