Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Apr 2002 14:53:18 -0600
From:      Brett Glass <brett@lariat.org>
To:        chat@freebsd.org
Subject:   How to control address used by INADDR_ANY?
Message-ID:  <4.3.2.7.2.20020419144005.0358c610@nospam.lariat.org>

next in thread | raw e-mail | index | archive | help
I'm in the process of creating a router which will sit on an ISP's 
internal subnet, which uses unregistered addresses. The router's upstream 
interface will have an unregistered address, say, 10.X.Y.Z. Its 
downstream interfaces will have registered IPs, so it will look like this:

                                 _A.B.C.1 -> feeds 
A.B.C.0/25
                     10.X.Y.Z   /
ISP and Internet ------[Router]\_A.B.D.1 -> feeds A.B.D.0/26
   10.X.Y/24                       etc.

But here's the rub. When the router communicates with the outside world 
on its own behalf (which it has to do; it's going to have some services 
running, including a a transparent Web cache), it needs to use one of its 
registered addresses as the source address, or the packets won't leave 
the ISP's internal network and get to the rest of the Internet.

My first attempt at configuring a FreeBSD machine to be the router didn't 
work. When attempting to speak to the Internet at large, it used its 
10.X.Y.Z address as the source address on its packets, and of course this 
caused them to stop at the ISP's gateway router (which is not doing NAT).

As best I can tell, the trouble is that when a process running on the 
router itself opens an outbound socket with INADDR_ANY (which most 
networked applications do), it picks 10.X.Y.Z as the source address 
instead of A.B.C.1.

What's the easiest way to specify the address to be used as the source 
address when an app opens an outbound socket with INADDR_ANY? I'm unclear 
about how the system is picking it now (I haven't yet found the place in 
the source where this decision is made), but it seems to be picking 
10.X.Y.Z, which of course will not work.

Also, if I'm doing an FTP install of FreeBSD on the router (I want to 
load 4.5-RELEASE-p3 rather than 4.5-RELEASE, to nuke the zlib, OpenSSH, 
and tcp memory leak bugs), how do I configure the interfaces, etc. from 
sysinstall so that I can install properly? Any help with this would be 
much appreciated.

--Brett Glass 


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




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