What's new

How to persist vlan settings (script help)?

  • 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!

g1dtf

Occasional Visitor
I have an N66u (Rmerlin 374.43_2) with the following vlan settings.

robocfg vlan 20 ports "0t 8t"
vconfig add eth0 20
ifconfig vlan20 up
brctl addif br0 vlan20

I want them to survive a reboot and from what I have read this needs to be done with a script. I am looking for help in writing, installing and executing the script on my N66U . I have read various threads on this but finished up more confused than before.

Thanks

Andy.
 
I have an N66u (Rmerlin 374.43_2) with the following vlan settings.

robocfg vlan 20 ports "0t 8t"
vconfig add eth0 20
ifconfig vlan20 up
brctl addif br0 vlan20

I want them to survive a reboot and from what I have read this needs to be done with a script. I am looking for help in writing, installing and executing the script on my N66U . I have read various threads on this but finished up more confused than before.

There is a wealth of information here RMerlin Wiki and includes examples of implementing scripts on the router.

Basics for creating/exploiting scripts.

e.g. My_script.sh

1. Enable SSH access to router via the GUI
Administration->System TAB then Click 'Enable SSH=LAN only'
2. If you are using a Windows device then install WinSCP to create/edit the script file on the router.
I posted a mini-tutorial of getting a script onto the router via WinSCP:
Using WinSCP to create scripts/files on Asus Router
or SSH into the router then use the router's nano editor.

3. As per the Wiki, ensure your script is executable
SSH to the router using your preferred SSH Client (Xshell6,MobaXterm or PuTTY etc.) and issue​
Code:
dos2unix   /jffs/scripts/My_script.sh
chmod a+rx /jffs/scripts/My_script.sh
4. Ensure that execution of scripts is enabled - either via the GUI
Adminstration->System TAB then Click 'Enable JFFS custom scripts and configs=YES'​
or from the command line
Code:
nvram set jffs2_scripts="1"
nvram commit
5. If you are logged on to the Routers SSH console you can now test the script
Code:
sh /jffs/scripts/My_script.sh
For your VLAN script, I suggest you use nat-start

/jffs/scripts/nat-start


Code:
#!/bin/sh

sleep 10     # Always for nat-start?

# Only create the VLAN if it doesn't already exist.
if [ -z "$(robocfg show | grep -oF "vlan20:")" ];then
   robocfg vlan 20 ports "0t 8t"
   vconfig add eth0 20
   ifconfig vlan20 up
   brctl addif br0 vlan20
fi
 
Last edited:
Thanks for the info but just for clarification regards nat-start. Is that a folder in which I place my script or the name of the script once created?
 
Thanks for the info but just for clarification regards nat-start. Is that a folder in which I place my script or the name of the script once created?
Read the Wiki …. e.g. User scripts
 
I have read that a couple of times and gathered that the scripts should be placed in /jffs/scripts/ and the script should be named nat-start etc but not sure whether the file needs the .sh suffix. Unless I am not understanding things correctly which is more than likely lol.
 
Last edited:

Similar threads

Sign Up For SNBForums Daily Digest

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