Cisco Configuration Tip - Command Macro To Change IP Address

Network Engineer at a Bar
Remotely changing an IP address on a Cisco router or switch, or moving an IP from one interface to another can be a challenge.

Cisco allows you to use macros although I have not really worked with them. rekrowteN has a great blog post about using macros to move an IP address from one VLAN interface to another.

In a previous Configuration Tip I discussed using the reload in/at commands to prevent getting locked out of a router or switch.

In this scenario we need to move the IP Address assigned to interface VLAN 1 to VLAN 10.

For this tip start by entering reload in 15.

Next we create the macro
conf t
macro name mgmtchange
interface vlan 1
no ip address
interface vlan 10
ip address
no shutdown
The "@" signifys  at the end of the macro. To apply the macro enter:
conf t
macro global apply mgmtchange
Once the change is made and you can reconnect don't forget reload cancel.

Configuring Command Macros

Have you used macro's? What Macro scripts do you use?