Creating dhcp client after new interface seems to fail.

Hi

I’ve been working on a script that does the following:

  1. create a new virtual interface
  2. create a new ip dhcp client for that interface.

Now, my script works up until the point of creating the dhcp client.
For some reason it is not being created, I think it has to do with the fact that I create the dhcp client to fast after creating the interface.

Anyone have a possible solution for this issue?

Thanks!


:global SSID "Test";
:global AmountOfClients 5;
:global SecurityProfile "TNDefault";
:global MasterInterface "wlan1";
:global VirtualClientPrefix ("virt-" . $MasterInterface . "-");
#ONLY CHANGE VARIABLES ABOVE THIS LINE
:for i from=1 to=$AmountOfClients step=1 do={
	#create new 2.4GHz virtual client
	/interface wireless add master-interface=$MasterInterface mode=station security-profile=$SecurityProfile ssid=$SSID name=($VirtualClientPrefix . $i);
	#create DHCP client for virtual client
	/ip dhcp-client add interface=($VirtualClientPrefix . $i) disabled=no;
}

Hello.

You could put a delay timer between rules, maybe routerOS need a second to realize the new interface.