You need a “number” in order to identify the address to change because, generally, an interface might have more than one address. So the interface name is not a “key” to an unique address.
If you are sure that your interface is assigned a single address you can use the following command:
/ip address set [/ip address find interface=ether10] address=10.0.0.1/24
anyway, with exactly the same semantics, a more proper solution would be:
/ip address set [/ip address find address="10.0.0.2/24"] address=10.0.0.1/24
From the latter you can clearly see what I said: you are working with addresses, not interfaces.
I’m also looking for a similar command to the above where for example I have a number of sites which all have the site number set within the IP address,
so scripting wise for the “average person” to literally go in and edit 3 :global variables can change the single octet on the IP address
e.g - Change X to site number
:global SiteNumber=x
site 6 gets 10.1.6.254/24 for example,
and I need a command that does something like - add address=10.1.$SiteNumber.254/24 interface=loopback network=10.1.$SiteNumber.0
A friend had suggested something like
so address-begining = “10.10.”; address-end = “.254/24”; full_address = $address-beginning . $6bit . $address-end;
But not sure whether this would work?