From owner-freebsd-net@freebsd.org Tue Jan 23 18:26:22 2018 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D2D0EBEAF6 for ; Tue, 23 Jan 2018 18:26:22 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf0-x232.google.com (mail-lf0-x232.google.com [IPv6:2a00:1450:4010:c07::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E4032684DA; Tue, 23 Jan 2018 18:26:21 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf0-x232.google.com with SMTP id q17so1813716lfa.9; Tue, 23 Jan 2018 10:26:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=SLNgs9muxezVsCz4+oO1+smPyLNbSVRWSYOhMAcq4Uk=; b=MbBGarTSQjedS0N0pW7bmz0kbZ2bT/puQB08iDVJsDkr72iyssyJBpue7LrNqOTwe6 0SJfjqEDcqBX0/Unm7somSakZ9GdWvw0bBgK0OeRH01c/3JNusrOnUdYWV2Zl520RJvj 7q3rqb6iRXFMGMnKib6LN4/oAvL6Go+sGnAyCDxuldz0mxm5RFHEMnFRicLiDVSu+vCX y92a51McAFCBSTzxZRUkdWQmVKF6rnuWlXAlSYdGP97MxMVhx42OO3Mrz5uDS3VGuhpI o5ihLrZXa65sOcVaGVnfd3T6qhK+pSPGCk1alc6vBJBMnLsVMbK1E4MyCeqbSXI5qSI9 Ckbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=SLNgs9muxezVsCz4+oO1+smPyLNbSVRWSYOhMAcq4Uk=; b=lo1hDbXYaq5CZIe/RgT8bnJ78U/T5vUAzp0o65Wqu9zV/79RnEemZBWMrfGLXWHXYz ms+g7WHaJIfmvr4nFV2FqMYAvmblG/YmmOpRRY5FL5iLGEHp6cRyF/HVKbV2iPm7lva2 Njy0i6aQPp6tDrRX0ptjO9bC3HzK855DQIWMHpnlaI8Ior1xY+3wySS2v3tHOHiMiHPi sE8n1X5cMpnnzsSl5xjc0bieAol44/js3MdwB35/IZ3NbQLq1gXdArjK386aTWemnkt7 2ZwaN6L8GbK6lYft4TKpq62JfB/V+GxlmgbkVbP3sbdvKZpYoxD3FBM3obsd0PBazNzi 5hzQ== X-Gm-Message-State: AKwxytcmHJbOJDjyYkOCIMhdnolE570CBbNmTSDkhSYJ9oJK+BbAlSvQ ECkhrAt9UOeGIt36lz0GTw+sqpsjnXNWyCFVZd8= X-Google-Smtp-Source: AH8x2277RWFqB46zWbdH4/HJCUBEjNqnLi7LyESjbuBnM6sL2yLwtxvemTht9kIzu9OwPbGUd23w3TSX7yPL2qahxRw= X-Received: by 10.25.228.146 with SMTP id x18mr1695193lfi.115.1516731979893; Tue, 23 Jan 2018 10:26:19 -0800 (PST) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.179.87.131 with HTTP; Tue, 23 Jan 2018 10:26:19 -0800 (PST) In-Reply-To: <759792be-189f-bdaf-04c9-b01d26fa9e00@yandex.ru> References: <759792be-189f-bdaf-04c9-b01d26fa9e00@yandex.ru> From: Alan Somers Date: Tue, 23 Jan 2018 11:26:19 -0700 X-Google-Sender-Auth: euUsrvp-BKnDmrUrNDho6g1Gr3A Message-ID: Subject: Re: pf: redirect a packet's port but not its address? To: "Andrey V. Elsukov" Cc: FreeBSD Net , Kristof Provost Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jan 2018 18:26:22 -0000 On Tue, Jan 23, 2018 at 10:39 AM, Andrey V. Elsukov wrote: > On 23.01.2018 19:17, Alan Somers wrote: > >>> Unfortunately, pf currently lacks this capability. But it looks like > it > >>> could be added without breaking existing pf.conf syntax. Would this > be a > >>> good idea? > >>> > >>> I don't use ipfw, but from reading the man page I believe that it has > the > >>> same problem. > >> > >> I think ipfw should work with such configuration using "fwd" action, > >> since TCP/UDP has special handling for this. > > > > > > The man page says that the fwd directive always takes an IP address. > What > > I need is a way to forward the port without changing the IP address. Is > > that possible in ipfw? > > "fwd" rule does not changing nor IP address, nor port. It uses some > magic with PCB lookup in the TCP/UDP code. > Just tried this: > > # ipfw add fwd ::1,5678 tcp from any to any 4000 > # nc -6 -l ::1 5678 > > And from another host tried: > # telnet -6 fc00::1 4000 > > And this works. > This does not work for me. When I try, tcpdump shows that the host running ipfw returns an RST packet when it receives a SYN for port 4000. That sounds like the fwd rule isn't working. And it's probably not working because I'm a total ipfw n00b. Is there anything else I need to configure in ipfw first? My rc.conf file looks like: firewall_enable="YES" firewall_type="open"