Bug 252874 - pf cant't bind interface dynamically
Summary: pf cant't bind interface dynamically
Status: Closed Not A Bug
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.2-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-pf (Nobody)
Depends on:
Reported: 2021-01-21 04:52 UTC by Raffeale
Modified: 2021-01-22 01:44 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Raffeale 2021-01-21 04:52:12 UTC
when i add a nat rule to pf like this
nat on re0 inet from to any -> re0
                                          this is destination out interface

the pf nat forward the packet to the ip of re0 ,not interface re0

pfctl -s nat i can see the rule change to  this

nat on re0 inet from to any ->  (re0 ip)

it means that when i change the re0 ip address other the nat will not work, because the nat rule do not bind the interface but bind to the ip of re0 interface,

i wish the pf nat could bind the interface rather then  interface's ip.
Comment 1 Oleksandr Kryvulia 2021-01-21 06:52:00 UTC
You should use rule like this:

nat on re0 inet from to any -> (re0)
Comment 2 Andriy Gapon freebsd_committer 2021-01-21 10:22:14 UTC
(In reply to Raffeale from comment #0)
Please do not be too fast to open bugs.
You could read the documentation more carefully, search for solutions and ask questions on forums.
Comment 3 Raffeale 2021-01-22 01:44:56 UTC
sorry ,it's my fault!
thanks a lot!