I have freeBSD router and it host public IP address, I am using ipnat.rules to configure port forwarding prom public network inside my private network. Now I wondering can I restrict only specific public IP addresses to can pass trough my port forwarding. What I want is to only my specific public IP addresses can walk inside my network on specific ports. Here is how now look like my ipnat.rules file

rdr fxp0 217.199.XXX.XXX/32 port 7900-> port 80 tcp

You should use a firewall like PF/IPF/IPFW to allow only specified IP addresses to access port 7900 on your router/gateway. PF can actually do all of the NAT stuff for you as well. If you to keep using IPNAT to handle your NAT, you can use IPFW or IPF to limit what hosts can access a port.

Here's the FreeBSD page that lays out the differences between firewalls:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.