Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 May 1996 08:24:15 +0100
From:      Paul Walsh <paul@nation-net.com>
To:        Dean Neumann <dneum@telelink.com>
Cc:        questions@FreeBSD.ORG
Subject:   Re: ifconfig aliasing 
Message-ID:  <3198351F.720D@nation-net.com>

next in thread | raw e-mail | index | archive | help
This is the answer to a similar question posted a few weeks ago ( and 
probably a few weeks before that etc..)

....................................................................

Eric Berenguier wrote:
>         Is it possible to give several adresses to a single network
> interface on a FreeBSD system ?
>         (I know it's possible to do this with latest Linux kernel (IP_ALIAS))

I have no idea how this might be done with ppp or slip, but on ethernet 
the
following:

ifconfig <device> alias <ip alias>
route add <ip alias> 127.0.0.1

Lazy way to make this permanent: Add these commands to /etc/rc.local

More scalable way to permanency:
Add the following to /etc/sysconfig: (put them with like config options)
--
# network interface aliases
interface_aliases="ed1"
alias_ed1="alias x.x.x.x"
route_alias1="x.x.x.x 127.0.0.1"
--
Add the word alias1 to the static_routes= definition.
Add the following to /etc/netstart:
--
# Set up any aliases to network interfaces.
for device in ${interface_aliases}; do
        eval ifconfig_args=\$alias_${device}
        ifconfig ${device} ${ifconfig_args}
done
--
This way if you have more than one alias on an interface you just have:
alias_ed1="alias x.x.x.x alias y.y.y.y alias z.z.z.z"
route_alias1="x.x.x.x 127.0.0.1"
route_alias2="y.y.y.y 127.0.0.1"
route_alias3="z.z.z.z 127.0.0.1"
static_routes="multicast alias1 alias2 alias3 loopback"

All of your network config info is still in one file this way and you 
can
easily see the aliases assigned to an interface.
--
_ __                  | Only my ideas here unless I say otherwise...
' )  )     /          | (BeamJack@IRC)
 /--' ____/___o  __   | "Nondum amabam, et amare amabam...  quaerebam 
quid
/  \_(_) /_) (__/) )_ |  amarem, amans amare." - St Augustine

....................................................................


Regards, Paul Walsh (www.nation-net.com)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3198351F.720D>