Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Sep 2002 10:25:02 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        Daryl Chance <chancedj@yahoo.com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: 2 public ip's on 2 nics (problem)
Message-ID:  <20020915092502.GA53053@happy-idiot-talk.infracaninophi>
In-Reply-To: <20020915024436.90793.qmail@web9607.mail.yahoo.com>
References:  <20020915024436.90793.qmail@web9607.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Sep 14, 2002 at 07:44:36PM -0700, Daryl Chance wrote:

> I've got a server I'm trying to bring up that has 2 nics in it.  I
> have 2 valid public ip's, so thats not the issue.  the 2 nics are 2
> seperate things.  one is for dns and one is for mail (I know, I
> could just go with 1, but I'm trying to get this working anyhow).
 
> rc.conf looks like:
> defaultrouter="65.221.xxx.xw"
> hostname="mail.xxx.com"
> #only working for xl atm.  working on it.
> ifconfig_xl0="inet 65.221.xxx.xx  netmask
> 255.255.255.192"
> ifconfig_fxp0="inet 65.221.xxx.xy  netmask
> 255.255.255.192"

> If I do an ifconfig fxp0 add 65.221.xxx.xy netmask 255.255.255.0, it
> adds it, but i can't ping it (more then likely because of the
> netmask AND because it's an alias?
 
> adding it with 255.255.255.192 gives me:
> ifconfig: ioctl (SIOCAIFADDR): File exists

Yes --- adding two IP numbers on the same network, even if they are on
separate NICs is always going to be tricky.  The problem is
essentially to do with routing --- which NIC does the OS use to send
packets out of?  Which IP number does it put into the packets as the
return address?

Assuming you aren't interested in the ng_one2many(4) approach, which
effectively gloms together several separate NICs and makes them behave
collectively like one interface, then you've got to make it clear
somehow that one of the addresses is the default for outgoing packets,
and that the other should be used only when specifically requested.

About the only possible answer I can think of is that this is
essentially the same problem as having multiple alias addresses on the
same NIC, so the same rules should apply: the first IP number per
network gets configured with the appropriate netmask for the subnet,
second and subsequent addresses use the all ones netmask, even if
they're configured on different physical interfaces.

    ifconfig xl0  inet 65.221.xxx.xx netmask 255.255.255.192 up
    ifconfig fxp0 inet 65.221.xxx.xy netmask 255.255.255.255 up

That should make xl0 the default interface for outgoing traffic from
the machine.  Now this is all untested and may or may not work.  Give
it a go and see what happens.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
                                                      Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK

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?20020915092502.GA53053>