Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Jan 1997 09:18:24 +1100 (EST)
From:      "Daniel O'Callaghan" <danny@panda.hilink.com.au>
To:        david <david@ssc.ac.ru>
Cc:        sysops <freebsd-isp@freebsd.org>
Subject:   Re: Multiple IP addresse, hostnames on one machine
Message-ID:  <Pine.BSF.3.91.970128085920.13981U-100000@panda.hilink.com.au>
In-Reply-To: <19970127201615.1b59db1b.in@alania.ssc.ac.ru>

next in thread | previous in thread | raw e-mail | index | archive | help

This is really a candidate for the upcoming HowTo section of the Handbook.

On Mon, 27 Jan 1997, david wrote:

>  Is it possible to have multiple IP addresses on one machine without having
>  multiple ethernet cards..
>  
>  We want to have one computer (for now) that runs DNS, WWW, FTP, TELNET,
>  POP, PPP and anything else.

>  We want to have
>  
>  www.rno.ssc.ac.ru 
>  mail.rno.ssc.ac.ru 
>  ftp.rno.ssc.ac.ru 
>  telnet.rno.ssc.ac.ru 
>  dialup.rno.ssc.ac.ru 
>  admin.rno.ssc.ac.ru 
>  
> All running on one machine, whith the ability to expand and move each
>  service to it's own machine without having to have all the user change
>  thier configurations.

You don't need multiple IP addresses for this.  You want to use the DNS 
to manage this.  Simply list each service separately in the DNS and make 
sure that users use the correct name for the service.  When you want to 
split to multiple machines, simply reconfigure the DNS.  Easy.

Start:

(zone file for rno.ssc.ac.ru)
admin  IN A 1.2.3.4
ftp    IN CNAME admin
www    IN CNAME admin
telnet IN CNAME admin
mail   IN CNAME admin 
  
Note that a CNAME record *must* point to an A record, not to another CNAME.

After split:
admin  IN A 221.2.3.4
mail   IN CNAME admin 
telnet IN CNAME admin

www    IN A 221.2.3.5 
ftp    IN CNAME www


>  I would assume it would just be a matter of putting multiple names in the
>  /etc/hosts file and using the same IP address

Yes, but don't use the hosts file, use DNS.  There are some DNS primers 
out there on the 'net. (Can anyone recommend URLs, please - I'd like to 
digest them into a FreeBSD HowTo)

>  But moving the service from this machine would have to change the ip, is
>  there anyway to aliase IP addresses and
>  have that address move with the aliased hostname?

You can put multiple IP addresses onto a single machine.  There are two 
basic cases:

1.  The aliased address is part of the same subnet/network as the primary 
    address.

In this case, you need to specify a netmask of 0xffffffff (8 f's) and put 
the alias onto the primary ethernet interface, e.g. ed0.
# ifconfig ed0 221.2.3.4 netmask 0xffffff00
# ifconfig ed0 221.2.3.5 netmask 0xffffffff alias

When this happens, the machine will respond to arp requests for both 
addresses.

2. The aliased address is part of a different subnet/network from the 
   primary IP address.

I find that the best place to put these aliases is onto the lo0 interface.

# ifconfig lo0 219.5.6.7 netmask 0xfffffff0 alias
# ifconfig lo0 219.5.6.8 netmask 0xffffffff alias
# ifconfig lo0 219.5.6.9 netmask 0xffffffff alias

Note that the first alias in a given net/subnet must have the correct netmask
for that net/subnet, while additional aliases use the netmask of all 1's 
(0xffffffff, 255.255.255.255).

Since these aliases are part of a different subnet/net from the local 
ethernet, other machines on the local ethernet must be given routes to 
the network using the aliased machine's primary ethernet IP address as a 
gateway.


regards,

Danny



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.970128085920.13981U-100000>