*BSDThis forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How can I redirect an incoming connection on one rdomain to an IPv4 address existing on a different rdomain?
The following is incorrect but illustrates what I am trying to do on the router:
Code:
pass in quick on $ext proto tcp from any to any port 3000 \
rdr-to 192.168.1.100 port 3000 rtable 11
When I try to connect from the outside to port 3000 on the router it gives a "Connection refused" error rather than forwarding it to the inner machine.
However, I can connect from inside the router to port 3000 at 192.168.1.100 on rdomain 11 using the router route utility. I would like to do that in one step though by connecting to port 3000 on the outside and have it passed through to another machine on the inside.
This is for OpenBSD 6.5-current
Last edited by Turbocapitalist; 07-24-2019 at 11:58 AM.
The rule syntax includes the optional directive "...on rdomain number" but this is a match restriction just like the directives "in" and "out" or "on interface".
---
You're asking this esoteric OpenBSD question on a Linux-centric forum. For actual answers from either developers or users-with-a-clue, I recommend the Project's misc@ mailing list. As an example, Peter Hansteen wrote this paper on rdomain use, which you may have already seen. Peter is active on misc@, and is as likely to answer this question as any other expert, if you ask it there.
Thanks, I figured I'd try here on the *BSD subforum about BSD usage. PF is in several of the BSDs and this is a usage question not a miscellaneous development task. On the off chance that someone has the answer, that's great. Otherwise, I've at least talked myself through defining the problem.
Anyway, I've tried the following, but even that gives a connection refused error from the outside:
Code:
pass in quick on rdomain 10 inet proto tcp from any to ($ext_if) \
port 3000 rdr-to 192.168.1.100 port 3000 rtable 11
10 is the rdomain of egress and 11 is the rdomain of the other interface.
I have OpenBSD and FreeBSD boxen and use the same pf ruleset on both with only a slight change to the egress rule for OpenBSD. I don't enclose $ext_if on either.
I'm assuming you've made an interface macro for $ext_if.
Last edited by Trihexagonal; 07-26-2019 at 01:40 AM.
Yep. A macro exists for $ext_if. I thought that having it in parenthesis means that PF handles dynamic addresses.
Anyway, here is what works from the outside when connecting from another network:
Code:
pass in on $ext_if proto tcp from any to ($ext_if) port 3000
match in on rdomain 10 proto tcp from any to ($ext_if) port 3000 \
rdr-to 192.168.1.100 port 3000 rtable 11
So that part of the problem is solved. Now I just have to uncomplicate the rest of it so that I may do NAT hairpinning (or whatever the right name is) so that I can continue along from behind the router.
Thanks, both jggimi and trihexagonal, as well as any who also considered the problem.
Last edited by Turbocapitalist; 07-26-2019 at 02:05 AM.
Reason: pass too
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.