diff --git a/iopsys-econet/base-files/lib/netifd/pre-reload/tc3162-eth-portmap.sh b/iopsys-econet/base-files/lib/netifd/pre-reload/tc3162-eth-portmap.sh
new file mode 100644
index 0000000000000000000000000000000000000000..ac86f282cd6c95d11eb066e6ba9aff3947b920db
--- /dev/null
+++ b/iopsys-econet/base-files/lib/netifd/pre-reload/tc3162-eth-portmap.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+tc3162_eth_portmap() {
+	[ -d /proc/tc3162 ] || return 0
+
+	wan_port="-1"
+	lan1_port="-1"
+	lan2_port="-1"
+	lan3_port="-1"
+	lan4_port="-1"
+	lan5_port="-1"
+	lan6_port="-1"
+
+	wandevice="$(uci -q get network.wan.device)"
+	case "$wandevice" in
+		eth0.[0-9])
+			wan_port=${wandevice:5}
+		;;
+	esac
+
+	landevice=$(uci -q get network.lan.device)
+	case "$landevice" in
+		eth0.[0-9])
+			lan1_port="${landevice:5}"
+		;;
+		br-lan)
+			section="$(uci show network | grep 'name=.*br-lan' | cut -d'.' -f2)"
+			lan_ports="$(uci -q get network.$section.ports)"
+			lan1_port=$(echo $lan_ports | cut -d' ' -f1 | cut -d'.' -f2)
+			lan1_port="${lan1_port:--1}"
+			lan2_port=$(echo $lan_ports | cut -d' ' -f2 | cut -d'.' -f2)
+			lan2_port="${lan2_port:--1}"
+			lan3_port=$(echo $lan_ports | cut -d' ' -f3 | cut -d'.' -f2)
+			lan3_port="${lan3_port:--1}"
+			lan4_port=$(echo $lan_ports | cut -d' ' -f4 | cut -d'.' -f2)
+			lan4_port="${lan4_port:--1}"
+			lan5_port=$(echo $lan_ports | cut -d' ' -f5 | cut -d'.' -f2)
+			lan5_port="${lan5_port:--1}"
+			lan6_port=$(echo $lan_ports | cut -d' ' -f6 | cut -d'.' -f2)
+			lan6_port="${lan6_port:--1}"				
+		;;
+	esac
+
+	echo $wan_port $lan1_port $lan2_port $lan3_port $lan4_port $lan5_port $lan6_port > /proc/tc3162/eth_portmap
+}
+
+tc3162_eth_portmap