Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Oct 2004 15:53:38 -0700
From:      "Kevin Glick" <keving@sbfnet.com>
To:        "'Richard Marriner'" <richard@syix.com>
Cc:        freebsd-questions@freebsd.org
Subject:   RE: Quickie... Hopefully!
Message-ID:  <20041001225433.84BD243D1F@mx1.FreeBSD.org>
In-Reply-To: <20041001222957.026415C40@richard.syix.com>

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

I've done the same thing a few times.  To get the full description, check
the ifconfig man page and look for "alias".  There's two problems with doing
this: first, BSD can't have two default routes.  Windows allows you to set
two default gateways, and it works because of the "Route Discovery" built
into it (this is why a windows machine can use a gateway that's not on it's
local subnet...but, that's another topic).  Second, if you've got servers
set to listen only on a specific IP (apache, etc) it still won't work, even
with the alias.

Example:
1.1.1.1-1.1.1.255 -->from ISP #1 \
/-> 1.1.1.2
					    -->hub/switch --> FreeBSD fxp0 
2.2.2.1-2.2.2.255 -->from ISP #2 /
\-> 2.2.2.2

In the crude diagram above, both ISPs feeds end up coming into a hub/switch
that your BSD machine is plugged into.  The normal ifconfig on the device is
1.1.1.2 netmask 255.255.255.0.  You would then: "ifconfig fxp0 inet 2.2.2.2
netmask 255.255.255.0 alias" the device.  This will work, as long as routing
is setup correctly.  Any request for 2.2.2.2 from anywhere in the world
would end up at the same machine/interface as a request for 1.1.1.2.  The
problem lies in getting data out with the aliased address.  The default
route on the machine would be 1.1.1.1 and all traffic goes there.  If you
have specific traffic that you want to go out with the 2.2.2.2 address,
you'd have to add routes for each DESTINATION IP:  "route add -net 3.3.3.3
-netmask 255.255.255.0 2.2.2.1" and so on.  BSD isn't smart enough to do
source based routing.  So the traffic will come into 2.2.2.2 via ISP #2, but
the replies/ACKs will go out via ISP #1.  Any traffic generated from the
machine, without a specified SOURCE IP will go out as 1.1.1.2, and get sent
via the 1.1.1.1 gateway.

The other problem with the diagram above is that you've got two subnets
running on the same lan, which breaks most rules of networking.  This can be
remedied with a few vlans, but again, that's another topic.

Hope this helps.  I'm sure most of this info is correct, but I'm more than
willing to have somebody set me straight.

Kevin Glick
ITS Manager
keving@sbfnet.com
Sterling Business Forms


-----Original Message-----
From: owner-freebsd-questions@freebsd.org
[mailto:owner-freebsd-questions@freebsd.org] On Behalf Of Richard Marriner
Sent: Friday, October 01, 2004 3:25 PM
To: freebsd-questions@freebsd.org
Subject: Quickie... Hopefully!

Dear list,

   Just wondering if there is anyway (preferably simple.) to have two ip
addresses on the same NIC that are different networks.  

A little background.  We are in the process of changing ISPs, we now have
two circuits going to two differnet ISPs.  Because of this change we have to
renumber our entire network.  Being an ISP ourselves we have a handful of
servers that run FreeBSD.  While trying to get one of our test servers to
talk to both networks from the internet we fail, I think because even though
your request is on the new numbers FreeBSD still trys routing the response
back through our old gateway.  Another question, I know in Windows XP you
can set two gateways, two ips, etc.  Can you do this in FBSD?   Our windows
boxes are talking fine on both networks.

Any help or suggestions appreciated...

       Richard Dean Marriner II
SYIX.COM  --=--  Network Administrator
530-755-1751x206 - richard at syix.com

_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"




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