![]() |
|
|||
![]()
[ COMP1 ] [ COMP3 ]
| | ---+------+-----+------- xl0 [ OpenBSD ] fxp0 -------- ( Internet ) | [ COMP2 ] Please help me to configure the /etc/pf.conf that my OpenBSD can forward port 55555 to port 22. I have sshd installed on COMP3, and I want to ssh to COMP3 from Internet. I have following rules, but it doesn't work. Please help. # macros ext_if="fxp0" int_if="xl0" comp3="192.168.0.3" # options set block-policy return set loginterface $ext_if set skip on lo # scrub scrub in ## my port forwarding rule rdr on $ext_if proto tcp from any to any port 55555 -> 192.168.0.3 port 22 # filter rules block in pass out keep state pass in quick on $int_if |
|
|||
![]() Code:
## my port forwarding rule rdr on $ext_if proto tcp from any to any port 55555 tag SSH -> \ 192.168.0.3 port 22 # filter rules block in pass in quick on $ext_if tagged SSH pass out pass in quick on $int_if
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
||||
![]()
You're using a non-Internet-routable RFC 1918 address (192.168.0.3) but you do not show any Network Address Translation (NAT) configured in PF.
If fxp0 has a real internet address, you'll need to configure NAT if you want any of the devices on your local network to be able to connect to the internet. If fxp0 uses a different RFC 1918 subnet, then NAT occurs between fxp0 and your ISP. http://openbsd.rt.fm/faq/pf/nat.html |
|
|||
![]()
I have tried out above rules. However, I don't see port 55555 is open. SSH it failed.
|
|
|||
![]() Quote:
nat on $ext_if from !($ext_if) to any -> ($ext_if) Is this ok(Secure)? |
|
|||
![]() Quote:
Code:
pass out quick on $int_if tagged SSH By running tcpdump you then can see these packets Code:
# tcpdump -eni pflog0
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
|||
![]() Quote:
Code:
# macros ext_if="fxp0" int_if="xl0" comp3="192.168.0.3" # options set block-policy return set loginterface $ext_if set skip on lo # scrub scrub in nat on $ext_if from !($ext_if) to any -> ($ext_if) ## my port forwarding rule rdr on $ext_if proto tcp from any to any port 55555 tag SSH -> \ 192.168.0.3 port 22 # filter rules block in pass in quick on $ext_if tagged SSH pass in quick on $int_if pass out quick on $int_if tagged SSH pass out keep state |
|
|||
![]()
If you run tcpdump on the external interface do you see the packets coming in on port 55555?
Code:
tcpdump -ni fxp0 Please read http://openbsd.org/faq/pf/rdr.html#reflect why connections initiated from the local lan will never get redirected ![]()
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
|||
![]()
My friend tested it, and I have tried tcpdump it, I do not see any packets coming in on port 55555. Are there anything wrong with my rules?
|
|
||||
![]()
If that is your complete rule set, you are not logging PF data.
Each filter rule you want to log must explicitly state it, whether a block or a pass. J65nko's example, above, will log only blocked packets. If you want to log passing packets, those rules must include "log", also. http://openbsd.rt.fm/faq/pf/logging.html |
|
|||
![]() Quote:
If tcpdump -ni fxp0 doesn't show packets with destination port 55555 then your friend possibly forget to tell ssh to use 55555 instead of the default 22.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
|||
![]() Code:
rdr on $ext_if proto tcp from any to any port 55555 ... Maybe: from any to $ext_ip ? |
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenBSD, vpnc and packets forwarding problems | Tritone | OpenBSD General | 3 | 2nd July 2009 09:59 PM |
SSH on port 443 | maxrussell | General software and network | 4 | 6th April 2009 05:16 AM |
x11 forwarding over ssh not working | kasse | OpenBSD General | 14 | 23rd December 2008 02:21 PM |
VNC port forwarding help | revzalot | OpenBSD Security | 3 | 10th September 2008 06:59 AM |
vlc port failing | maxrussell | FreeBSD Ports and Packages | 11 | 27th May 2008 04:38 PM |