From owner-freebsd-chat Fri Apr 19 13:53:51 2002 Delivered-To: freebsd-chat@freebsd.org Received: from lariat.org (lariat.org [12.23.109.2]) by hub.freebsd.org (Postfix) with ESMTP id 5338B37B404 for ; Fri, 19 Apr 2002 13:53:47 -0700 (PDT) Received: from mustang.lariat.org (IDENT:ppp0.lariat.org@lariat.org [12.23.109.2]) by lariat.org (8.9.3/8.9.3) with ESMTP id OAA07247 for ; Fri, 19 Apr 2002 14:53:34 -0600 (MDT) X-message-flag: Warning! Use of Microsoft Outlook may make your system susceptible to Internet worms. Message-Id: <4.3.2.7.2.20020419144005.0358c610@nospam.lariat.org> X-Sender: brett@nospam.lariat.org X-Mailer: QUALCOMM Windows Eudora Version 4.3.2 Date: Fri, 19 Apr 2002 14:53:18 -0600 To: chat@freebsd.org From: Brett Glass Subject: How to control address used by INADDR_ANY? Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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