Date: Tue, 11 Dec 2001 15:36:43 -0800 (PST) From: Donnie Jones <donniejones18@yahoo.com> To: rick norman <rick.norman@lmco.com> Cc: freebsd-questions@freebsd.org Subject: Re: IP aliases & routes Message-ID: <20011211233643.24697.qmail@web20609.mail.yahoo.com> In-Reply-To: <3C167460.7D2177B7@lmco.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Maybe this link will help.... http://www.onlamp.com/pub/a/bsd/2000/07/05/OpenBSD.html 1. Edit /etc/ipnat.rules: rdr ep0 210.8.218.252/32 port 80 -> 192.168.0.10 port 80 This line configures IPNAT such that any request to 210.8.218.252:80 is forwarded to 192.168.0.10:80, and 192.168.0.10's response to the request is forwarded back out. I think maybe you could try it re-directing from the subnet to that gateway lke rick was saying. Hope this helps, I'm very new to freebsd, but I try. ;) -Donnie --- rick norman <rick.norman@lmco.com> wrote: > Okay, now I see more clearly your problem. > Unfortunately, > I don't know any way to have alternate defaults. > Default means, > use this when nothing else works. I would think > that you could use > ipfw and write a rule that forwards to a given > gateway based on the > src subnet. > Rick > > "James R. Van Artsdalen" wrote: > > > > Date: Tue, 11 Dec 2001 11:01:00 -0800 > > > From: rick norman <rick.norman@lmco.com> > > > > Why is there a requirement that there is but one > default? > > The only important thing is that there is no > ambiguity over which > > default to use. > > > > In my case there are two subnets on one interface, > for example > > 10.1.1/24 and 10.1.2/24. My server has addresses > 10.1.1.2 and > > 10.1.2.2: that's one address on each subnet. > > > > Each subnet has a gateway to the Internet: > 10.1.1.1 and 10.1.2.1. > > > > What I want to say is that when my server uses > 10.1.1.2 as its address > > then 10.1.1.1 is the default route, but if my > server uses 10.1.2.2 as > > its address then 10.1.2.1 is the default route. > > > > It might be tempting to say "just pick one > default!" but this doesn't > > work: if I pick 10.1.1.1 as the default, then my > server cannot reach > > any Internet address with no known route using the > 10.1.2.2 address, > > since packets sent from 10.1.2.2 cannot be seen by > 10.1.1.1 (they're > > on different subnets). It makes a second gateway > useless since > > there's no way to send a packet to it. > > > > BSD applications are permitted to decide which > source address a packet > > uses by calling bind(2). The routing code cannot > assume that a single > > default route covers all cases since the packet to > be routed might not > > be sourced on the same subnet as that default > gateway. The routing > > code should instead allow one default gateway on > each attached subnet > > and should check the packet against each default > to ensure that the > > packet is sourced on the same subnet as that > default gateway. > > > > > A default route is just that, a default, there > can't be two. There can > > > be different gateways for different subnets > though. Your description > > > sounds like a single subnet with two ip addrs on > it. 10.1.1/24 is the > > > subnet and .2 and .3 are the addrs. Why not use > 10.1.1/24 and 10.1.2/24 > > > ? > > > > > > Rick > > > > > > freebsd-questions@jrv.org wrote: > > > > > > > I have a FreeBSD server on an Ethernet with > two gateways to the > > > > outside world. I would like to use gateway A > for upstream HTTP > > > > traffic from squid and gateway B for > everything else. In other words, > > > > > > > the default route should point to B, except > for the squid's upstream > > > > socket, which should use A. > > > > > > > > What I did was create a new private subnet > (10.1.1/24) that both the > > > > server and gateway A can access via an IP > alias. Squid is told to use > > > > > > > 10.1.1.3 as its upstream address. Other > applications use the normal > > > > IP address. The idea is that one subnet uses > gateway A as the default > > > > > > > gateway and the other subnet uses gateway B > and that choosing the > > > > address of outbound socket via bind(2) chooses > how that application > > > > reaches the Internet. > > > > > > > > The question is how to tell the FreeBSD > (4.4-stable) server that > > > > gateway A can be used as a default route for > 10.1.1/24. There is > > > > already a default route for the normal IP > address and I can't seem to > > > > get the route command to let me create a > default route for the alias > > > > to use: > > > > > > > > $ route add default 10.1.1.2 > > > > route: writing to routing socket: File > exists > > > > add net default: gateway 10.1.1.2: > File exists. > > > > > > > > How do I add this second default route? There > is no conflict between > > > > the two defaults: every possible local IP > address belongs to only of > > > > the two subnets (and can match only one > default). > > > > > > > > To Unsubscribe: send mail to > majordomo@FreeBSD.org > > > > with "unsubscribe freebsd-questions" in the > body of the message > > > > > > > > > > > > To Unsubscribe: send mail to > majordomo@FreeBSD.org > > > with "unsubscribe freebsd-questions" in the body > of the message > > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of > the message __________________________________________________ Do You Yahoo!? Check out Yahoo! Shopping and Yahoo! Auctions for all of your unique holiday gifts! Buy at http://shopping.yahoo.com or bid at http://auctions.yahoo.com 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?20011211233643.24697.qmail>