What's new

Solved Is it possible to write the Port Forwarding table at the command line and have it appear in the web GUI?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!


New Around Here
I've been struggling with the High NVRAM usage for a while, but it's largely been under control manually running the one line command to sort it out a few minutes after boot.

However, since 386.9 on an AC68U, I have this "cool" issue where my port forwarding rules are blank on reboot. I see that Eric pointed out in another post that high NVRAM can do this. However, I have a bit of a circular problem - port forwarding table is dropped with high NVRAM, but I can't clear the NVRAM until after the router has booted, which seems to consistently clear my port forwarding table. Manual entry is a pain, and if someone ever has to reboot the router when I'm not around, a bunch of external stuff doesn't work until I get home and re-enter the rules in the GUI.

Not one to admit defeat easily, I've spent some time working out and testing the exact iptables commands to get my port forwarding table into a script. It works a treat from a technical standpoint, I now have a script to clear NVRAM and another script to add the port forward entries into the VSERVER chain on the NAT table.

For example:
#Allow SSH from anywhere
iptables -t nat -I VSERVER 1 -p tcp --dport 22 -j DNAT --to-destination

This rule replicates and works as other manually added ones in the web GUI, but this particular rule doesn't show up in the GUI. It might be because it's missing a "Service Name" as that doesn't appear to be specifiable at the command line, I'm a bit stumped on this last piece of the puzzle. Anyone happen to know how to add the port forwarding line at the command line and have it appear in the GUI?

Granted, it's a nice to have, I don't need the lines to appear in the GUI and I could just use the command line to administer all NAT rules as they do work. But if anyone has any ideas on the missing piece of the puzzle, then I could script something that could be administered in both command line and GUI. I also have the option of going back to 386.8 or earlier to solve this slight annoyance. I've cut back significantly on services, and I'm down to a bare minimum I can run, hence these workarounds.

Thanks in advance.
You should see your rule at System Log - Port Forwarding. You won't see your rule at WAN - Virtual Server / Port Forwarding because that page is showing you the information stored in NVRAM.
That is the perfect answer, thank you!

Can confirm that all rules appear there, both from GUI and command line. I can use this as my reference point going forward.

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!