Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Dec 1999 10:33:45 -0500
From:      "N.B. DelMore" <mylists@inr.net>
To:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Assigning Info
Message-ID:  <3.0.6.32.19991220103345.00a26670@mail.inr.net>
In-Reply-To: <4.2.0.58.19991216002113.00b19a90@mail.enterit.com>
References:  <000701bf484c$aeeac8c0$0300a8c0@Desktop>

next in thread | previous in thread | raw e-mail | index | archive | help
At 12:21 AM 12/16/1999 -0500, you wrote:
> ifconfig device  <  that is the same thing as 255.255.255.255

OK .. dumb question, what if your address space is sub-netted, for example,
we often use a /25 (255.255.255.128).

Also, in BSDI they use the following in /etc/netstat to configure virtual
IP addresses:

# Configure virtual hosts defined in /etc/virtualip
# /etc/virtualip contains a list of IP addresses to configure.
# We lookup the link address (if any) and arp for them if we
# can; otherwise we just add them as an IP alias on the loopback.
if [ -f /etc/virtualip ]; then
    /usr/libexec/linkaddr `cat /etc/virtualip` 2>/dev/null | \
        while read line; do
            set -- $line                # virtualip [linkaddr]
            ifconfig lo0 add $1
            if [ "$2" ]; then arp -s $1 $2 pub; fi
        done
fi

I haven't seen anything in freebsd equivalent, the nice thing about this
implimentation is it is very easy to add IP addresses if you've forgotten
to add it beforehand, i.e.

#!/bin/sh

# Let's make life easy and save some keystrokes by defining some variables
IP=$1   
NETMASK=$2

# Test to see if both the IP address and netmask was entered on the command
line
# otherwise show proper usage.

if [ $# -ne 2 ];then
        echo
        echo "usage: vip <ip> <netmask>"
        echo
        exit 0
fi

/sbin/ifconfig lo0 add $1 $2
/usr/sbin/arp -s `/usr/libexec/linkaddr $1` pub
echo $1 >> /etc/virtualip
echo "$1 added to /etc/virtualip"


Regards
Noel



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3.0.6.32.19991220103345.00a26670>