From owner-freebsd-questions@FreeBSD.ORG Fri Oct 17 17:42:03 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A7AF916A4B3 for ; Fri, 17 Oct 2003 17:42:03 -0700 (PDT) Received: from blacklamb.mykitchentable.net (207-173-254-228.bras01.elk.ca.frontiernet.net [207.173.254.228]) by mx1.FreeBSD.org (Postfix) with ESMTP id BCFE143FCB for ; Fri, 17 Oct 2003 17:42:02 -0700 (PDT) (envelope-from drew@mykitchentable.net) Received: from bigdaddy (unknown [192.168.1.3]) by blacklamb.mykitchentable.net (Postfix) with SMTP id 7840B3BF3F6 for ; Fri, 17 Oct 2003 17:42:01 -0700 (PDT) Message-ID: <005401c39510$a5250cf0$0301a8c0@bigdaddy> From: "Drew Tomlinson" To: "FreeBSD Questions" Date: Fri, 17 Oct 2003 17:42:01 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2727.1300 Subject: Is Port Based Routing Possible? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Oct 2003 00:42:03 -0000 Is there a way to route traffic based on port? Basically, I want to have all traffic on port 8080 use the rl0 interface for its gateway and all other traffic use dc0. Here is a diagram of my network. Internet | Public IP | ADSL Modem/Router 192.168.10.1 | dc0 192.168.10.2 | FBSD 4.8 --------- rl0 | 192.168.100.2 dc1 | | 192.168.100.1 192.168.1.2 Neighbor's AP | | Internal LAN Public IP | | 192.168.1.3 Internet Media Server I'm trying to serve a small video stream via my neighbor's faster Internet connection and keep all of my other traffic on my Internet connection. I'm trying to get the traffic to flow like this: 1. Media players connect to the public IP on the neighbor's AP (Linksys) on port 8080. 2. Neighbor's AP does NAT and forwards traffic on port 8080 to rl0 (192.168.100.2). I would like to forward to the media server at 192.168.1.3 but the Linksys won't allow me to set NAT to forward to a different subnet. 3. The rl0 interface on my FBSD box is running NAT as well. I did this because a simple "ipfw fwd" rule left the destination address as 192.168.100.2 and so my server at 192.168.1.3 ignored the packets as it was not the destination. natd with a 'redirect' switch and the corresponding 'divert' rule changes the destination address to 192.168.1.3. 4. The server receives the syn packet and sends a syn/ack to establish a connection. I want to have this packet return on the same path. However the default gateway for the media server is 192.168.1.2. Then because the default gateway for the FBSD box is 192.168.10.1 (my Internet connection), the packet goes out 192.168.10.2 and out through my own ISP. Thus the connection never gets established. I can get traffic to flow the way I want by adding a static route on the FBSD box. For example, if a media player at 1.2.3.4 initiates a connection from the Internet and do "route add -host 1.2.3.4 192.168.100.1" then the connection flows. However this is not practical in normal everyday usage when I don't know what IPs will connect. Is what I want possible and if so, what should I read to learn more? Thanks, Drew