Hi, I am writing a paramiko script that automates the configuration of a router board. This changes the name of the router, the wifi password, the router password, IP addresses, DHCP range and then bridges all LAN ports. I can change the name of the router, the wifi password and the router password but I don’t know the command for editing already existing /ip address, /ip pool, /ip dhcp client, /ip dns static etc. All I’ve managed to do so far is add another ip address to a different eth port and using set doesn’t work to change ip addresses or the dhcp pool. Also I can’t figure out the command/commands necessary for bridging all LAN ports.
Any help with this would be appreciated
Changing something by a script is quite problematic. Rather make full configuration script and run it in the device with blank configuration. There is a feature that allows you to remove config and run the script right after.
Is very easy,
configure a test machine used as template,
/export file=script
and you have the script.
add
:delay 20s
on top and use it as template script used during reset configuration “run after reset” with no-default option set
Hi, thanks for the advice. So I got the script from export, then I just add 'delay 20s' at the top of the script? If I were to then use this in a python paramiko script would I just use the command 'stdin, stdout, stderr = client.exec_command('system reset-configuration no-defaults=yes run-after-reset=flash/script.rsc')'? Also, would I need to upload the script to the flash folder on the router or could I use a local address on my computer somehow?
I’m trying to explain better,
send remotely the file, after you set identity, IPs, and other parameters wanted from template (add :delay20s on top)
then exec on remote device where the file is put:
/system reset-configuration skip-backup=no keep-users=no no-defaults=yes caps-mode=no run-after-reset=myscript.rsc
That's just the one thing that I don't know how to do, how do I remotely send the template script from my computer to the flash folder or file directory of a new router so I can execute it? What is the terminal command?
I created a full configuration script and downloaded it to my computer from a router, now I just don’t know how to upload that same script to a new router so I can execute it from a paramiko file
Perhaps try sftp or scp to push the script.
/tool fetch url=https://ww.mywebserver.ext/thisfolder/myscript.rsc