diff --git a/etc/rc.newwanip b/etc/rc.newwanip
index 79d07a4..1bd5529 100755
--- a/etc/rc.newwanip
+++ b/etc/rc.newwanip
@@ -204,6 +204,14 @@ if (!empty($gre)) {
  * could be failing back in which case we need to switch IPs back anyhow.
  */
 if (!is_ipaddr($oldip) || $curwanip != $oldip || !is_ipaddrv4($config['interfaces'][$interface]['ipaddr'])) {
+	/*
+	 * Some services (e.g. dyndns, see ticket #4066) depend on
+	 * filter_configure() to be called before, otherwise pass out
+	 * route-to rules have the old ip set in 'from' and connection
+	 * do not go through correct link
+	 */
+	filter_configure_sync();
+
 	/* IP changed, kill states accordingly */
 	if ($curwanip != $oldip) {
 		log_error("IP has changed, killing states on former IP $oldip.");
@@ -215,14 +223,6 @@ if (!is_ipaddr($oldip) || $curwanip != $oldip || !is_ipaddrv4($config['interface
 		}
 	}
 
-	/*
-	 * Some services (e.g. dyndns, see ticket #4066) depend on
-	 * filter_configure() to be called before, otherwise pass out
-	 * route-to rules have the old ip set in 'from' and connection
-	 * do not go through correct link
-	 */
-	filter_configure_sync();
-
 	/* reconfigure static routes (kernel may have deleted them) */
 	system_routing_configure($interface);
 
