Hello,
I'm trying to automate the port forwarding with UCI Commands.
I need to add the two rules that you see in the attached file "two new rules portforwarding".
Now I'm using the following two lists of commands (but in some cases the router is not updated):
commandFirewall_occp_server = {
1: 'uci set firewall.DMZ=redirect',
2: 'uci set firewall.DMZ.src=wan',
3: 'uci set firewall.DMZ.target=DNAT',
4: 'uci set firewall.DMZ.dest=lan',
5: 'uci set firewall.DMZ.proto=tcp udp',
6: 'uci set firewall.DMZ.src_dport="18001"',
7: 'uci set firewall.DMZ].dest_ip= "192.168.240.171"',
8: 'uci set firewall.DMZ.dest_port= "18001"',
9: "uci set firewall.DMZ.name= 'occp_server'",
10: 'uci set firewall.DMZ.targert=DNAT',
11: 'uci set firewall.DMZ.enable="1"',
12: 'uci commit firewall'
}
and
commandFirewall_ssh_charger = {
1: 'uci set firewall.@redirect[5]=redirect',
2: 'uci set firewall.@redirect[5].src=wan',
3: 'uci set firewall.@redirect[5].target=DNAT',
4: 'uci set firewall.@redirect[5].dest=lan',
5: 'uci set firewall.@redirect[5].proto=tcp',
7: 'uci set firewall.@redirect[5].src_dport="22"',
8: 'uci set firewall.@redirect[5].dest_ip= "192.168.240.171"',
9: 'uci set firewall.@redirect[5].dest_port= "22"',
10: "uci set firewall.@redirect[5].name= 'ssh_charger'",
11: 'uci set firewall.@redirect[5].enable="1"',
11: 'uci commit firewall'
}
Please see the attached screen in the file that explains manually the two rules...
Could someone help me?
Thanks a lot
Alessandro