Two Networks on one System
Jon Radel
jon at radel.com
Mon Jun 20 22:13:57 UTC 2011
On 6/20/11 5:07 PM, Martin McCormick wrote:
> We are moving a primary name server from network A to
> network B on one of our branch campuses. If the secondary
> interface was reachable from the world, we can change the whois
> information and not worry about the exact second the change goes
> in to effect.
Can networks A and B talk to each other? I suspect not, otherwise
things would be just working even if all traffic went to the primary's
gateway, but I just wanted to check that there wasn't something else bad
happening.
On the assumption that A and B are completely disconnected, then the
only solution for this problem that I know of is to do policy-based
routing using the source address or interface to make routing decisions,
rather than using solely the destination address.
This is actually relatively trivial to do using PF.
pass in on nic_a reply-to ($nic_a $gw_a)
pass in on nic_b reply-to ($nic_b $gw_b)
with the various interfaces named appropriately and variables set to
match should get you much of the way there. If you're using a slightly
older version of PF, where keeping state on connections is not the
default, you'll have to add state maintenance options to the lines. If
you want packets to local machines to not go to the gateways and do
u-turns there, you'll have to add a bit of filtering based on addresses,
etc., etc.
The explanation for the first line is more or less:
For any new "connection" that comes in on NIC A, add an entry to the
state table indicating that any reply packets should physically go out
NIC A and should be passed to the next hop at adress $gw_a.
WARNING: I use PF primarily on OpenBSD so sometimes get caught out on
the subtle differences to the FreeBSD version.
--Jon Radel
jon at radel.com
More information about the freebsd-questions
mailing list