connect to an android device over wifi with an ip address of 192.168.1.2 and forward the port with pf on freebsd from the host to a jail with an ip address of 10.10.0.5
returns this
In the =pf.conf= file, you need to add a rule to forward traffic from
port =5037= on the host to port =5037= on the jail's IP address
(=10.10.0.5=).
Add the following rule to the configuration file:
Code:
# Redirect port 5037 to the jail at 10.10.0.5
rdr pass on em0 proto tcp from any to any port 5037 -> 10.10.0.5 port 5037
- Replace =em0= with the name of the network interface on the host
that's receiving the traffic (this could be =eth0=, =vtnet0=, or
whatever your network interface is named).
- =rdr= stands for "redirect", and this rule tells =pf= to forward
incoming traffic on port =5037= to the jail at =10.10.0.5=.
Next, you need to ensure that traffic is allowed through the firewall on
the jail's interface. Add a rule like this to your =pf.conf= file:
Code:
# Allow traffic on port 5037 to the jail
pass in on em0 proto tcp from any to 10.10.0.5 port 5037
After making these changes to =/etc/pf.conf=, you need to reload the
=pf= configuration so that the rules take effect:
Code:
sudo pfctl -f /etc/pf.conf
sudo pfctl -e
You can verify that =pf= is correctly forwarding the port by checking
the rules:
Also, check that port =5037= is open and accessible from the host:
Code:
sudo sockstat -l | grep 5037
You should now have port =5037= on the host correctly forwarded to the
jail at =10.10.0.5=.