[...] But now, internal connections between interfaces will also be reset.
if (is_ipaddr($cacheip) && $ip != $cacheip && !isset($config['system']['ip_change_kill_states'])) { log_error("IP address change detected, killing states of old ip $cacheip"); mwexec('/sbin/pfctl -k ' . $cacheip); mwexec('/sbin/pfctl -k 0.0.0.0/0 -k ' . $cacheip);}
mwexec('/sbin/pfctl -k ' . $cacheip);mwexec('/sbin/pfctl -k 0.0.0.0/0 -k ' . $cacheip);
mwexec('/sbin/pfctl -k 0.0.0.0/0 -k ' . $cacheip);
Opnsense should proceed with the following work flow in case a dynamic IP change
@glasi @schnipp hi!Quotemwexec('/sbin/pfctl -k 0.0.0.0/0 -k ' . $cacheip);imho although it seems logical to me in terms of freeing up space in the states table, from a practical point of view: what a chances that such a packet will appear on the interface after dynamic ip change?)
[...]. may I ask for a comment?3.1. ip address is explicitly specified in the rules?3.2. static routes on dynamic interface?3.3. can you give an example please?3.4. isn't that happening now? (mwexec('/sbin/pfctl -k ' . $cacheip)the problem is that the 'pfctl -k' can kill the state by the source or target ip. but not by mapped addressso actually we have to parse the 'pfctl -ss' output and kill states by id?or run some custom script with "pfctl -k internal_client_ip -k target_server_ip"?
imho it is worth remembering that we force the opnsene to do what it should not do.
if the application claims to be NAT-aware then it should take care of such situations(for example, if the PBX maintains states with frequent keepalive\heartbeats, then there should also be configurable delays available (for example. "send keepalive packets every 'n' seconds. if the answer is not received then try 'k' times with 'm' sec interval, then keep silent for 'p' seconds and initiate new registration"))
you can treat this old IPv4 address like an additional (temporary) bogon
3.1: There can be firewall or forwarding rules on the WAN interface which integrate the dynamic IPv4
3.2: Possibly yes. Static routes bound to the WAN interface
3.3: This step is optional but shortens the time that local processes on the Opnsense run into a timeout
I don't think so. SOHO DSL routers do the same.
the issue resides at OSI layer 3 and 4
the discussion is becoming more theoretical, but I hope this is ok)
No ALTQ support in kernel ALTQ related functions disabled all udp 8.8.8.8:53 <- 10.1.0.102:55555 MULTIPLE:MULTIPLE age 00:02:46, expires in 00:14:59, 11:11 pkts, 891:935 bytes, rule 199 all udp 83.135.92.15:40401 (10.1.0.102:55555) -> 8.8.8.8:53 MULTIPLE:MULTIPLE age 00:02:46, expires in 00:14:59, 11:11 pkts, 891:935 bytes, rule 100
No ALTQ support in kernel ALTQ related functions disabled all udp 8.8.8.8:53 <- 10.1.0.102:55555 MULTIPLE:MULTIPLE age 00:07:20, expires in 00:13:12, 14:14 pkts, 1134:1190 bytes, rule 199 all udp 83.135.92.15:40401 (10.1.0.102:55555) -> 8.8.8.8:53 MULTIPLE:MULTIPLE age 00:07:20, expires in 00:13:12, 14:14 pkts, 1134:1190 bytes, rule 100
No ALTQ support in kernel ALTQ related functions disabled all udp 8.8.8.8:53 <- 10.1.0.102:55555 MULTIPLE:MULTIPLE age 00:09:39, expires in 00:14:22, 17:14 pkts, 1377:1190 bytes, rule 199 all udp 83.135.92.15:40401 (10.1.0.102:55555) -> 8.8.8.8:53 MULTIPLE:MULTIPLE age 00:09:39, expires in 00:14:22, 17:14 pkts, 1377:1190 bytes, rule 100 -- all udp 8.8.4.4:53 <- 10.1.0.102:55555 MULTIPLE:MULTIPLE age 00:01:24, expires in 00:14:08, 5:5 pkts, 405:425 bytes, rule 201 all udp 82.207.219.175:15111 (10.1.0.102:55555) -> 8.8.4.4:53 MULTIPLE:MULTIPLE age 00:01:24, expires in 00:14:08, 5:5 pkts, 405:425 bytes, rule 100
try yourself if you still don't believe me
It does not make sense to discuss
Testing: ('$' means execute the following command on the command line)[...]Result:The DNS query to 8.8.8.8 times out, because it hits the outdated NAT state table entry and the request will be translated to the wrong (outdated) source IPv4 address. These packets will be dropped by the ISP. As long as the client fires DNS requests to 8.8.8.8 the existing NAT state table entry will NEVER expire, because the timer resets to its starting value on every DNS query.After manually deleting the outdated NAT state table entry ($ pfctl -k 0.0.0.0/0 -k 8.8.8.8 ), DNS queries to 8.8.8.8 will be successfully answered :-)For this reason, deleting the outdated NAT state table entries is essential after the WAN IP has changed.
mwexec ('/ sbin / pfctl -k 0.0.0.0/0 -k'. $cacheip);