View Single Post

   
  #3 (permalink)  
Old 01-18-2008, 05:12 AM
Lew Pitcher
 
Posts: n/a
Default Re: Can linux box support 2 host names / 2 ip addresses

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Richard TU wrote:
> If yes, could you guys advise how to do it?


Yes, a linux system can have two host names and two IP addresses. Most already do.

For hostnames, you have to determine what sort of hostname you are interested in.

- - If it is the name returned by the hostname(1) utility, then you only get one
name. Sorry.
- - If it is the name used by Samba as your systemname within a workgroup or
domain, then again, you only get one. Sorry.
- - However, if it is the name associated to your IP address, then you get as
many names as you can assign to your IP address. You can use the /etc/hosts
file (see hosts(5)) to assign as many names as you want to your static IP
addresses. You can also use your DNS server to assign the names. You already
have at least /one/ host name for your system: IP address 127.0.0.1 is, by
convention, named as "localhost" (or "localhost.localnet") by the /etc/hosts
file.

As for IP addresses, if your system is connected to a network, then it already
has at least two IP addresses. Run the ifconfig(8) command, and it will list
each interface you have. Most interfaces will be assigned an IP address,
including the "lo" interface (which is assigned the IP address 127.0.0.1). You
get as many IP addresses as you have network interfaces for. (And, btw, each
IP address can have a host name, assigned either through /etc/hosts or through
DNS; you already have the hostname of "localhost" assigned this way, for
instance.)

To get more than one working /network/ IP address, you have to have more than
one working network adaptor. You either install multiple NICs into your
system, or you use Linux "logical" networking interface. This permits you to
have (for instance) an eth0 /and/ an eth0:0 device; two logical interfaces
each with it's own IP address, but on one physical NIC. See the ifconfig(8)
manual page for details.

- --
Lew Pitcher

Master Codewright & JOAT-in-training | GPG public key available on request
Registered Linux User #112576 (http://counter.li.org/)
Slackware - Because I know what I'm doing.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBXKNQagVFX4UWr64RAr4NAJ9KWArmOM1lyghT8X2MeQ U5+OuTDwCfcO66
o3PKTmGP8uevZaSFb50zn+4=
=BR6x
-----END PGP SIGNATURE-----
Reply With Quote