28.09.2020 17:12, James Bensley wrote: > On Mon, 28 Sep 2020 at 07:35, Eugene Grosbein <[email protected]> wrote: >> One of my 7201 routers has four GigabitEthernet interfaces but uses only two, >> one for IP uplink and another as client-sided downlink with multiple >> sub-interfaces named like GigabitEthernet0/1.10 (encapsulation dot1Q). >> >> It need reconfiguration to use 2x1G port-channles. I already did such >> reconfiguration >> for same 7201 router with small number of sub-interfaces and know this is >> doable >> changing sub-interfaces from GigabitEthernet0/1.N to Port-channel1.N >> >> This time the router has about 800 sub-interfaces. I can do some scripting >> to prepare incremental configuration removing/re-creating sub-interfaces, >> but I presume high CPU load for router while reconfiguring, long procedure >> time >> and notable service degradation or even interruption. >> >> Is there same another, more lightweight way to mass-rename sub-interfaces >> while switching from single parent interface to Port-channel? > > Hi Eugene, > > If you don't want to do this over a series of incremental changes then > you can make one "big bang" change by taking a copy of the running > configuration, making all the changes to that, and uploading it to the > router as a replacement start-up config file, then just reboot the > router to apply the config in one action. However, this approach is > risky, you need to test that new full configuration file (confirm that > the change only relate to the interface renaming, and that there are > no mistakes, typos, wrong VLAN numbers etc.), which is quite tricky. > > If you've ever wanted a pet project to get you into some network > automation and programming stuff this sounds like an ideal project to > me. You can definitely do this with Python tools like NAPALM and > Nornir. Then you can automate the changes and automate the testing of > the changes, and the rollback if required, in either multiple stages > or as one giant change; whatever suits your circumstances best.
I've already wrote my script using AWK, it took moderate amount of time to write and debug; it resulted in less than 50 lines. For each sub-interface it removes all "ip route" commands referring to it (if any) then removes the interface, then adds it back with new name, then re-adds removed routes changing interface name. It's quick-n-dirty but works and is fine for one-time job. My question was if IOS has some better way to rename sub-interfaces I could be unaware of. _______________________________________________ cisco-nsp mailing list [email protected] https://puck.nether.net/mailman/listinfo/cisco-nsp archive at http://puck.nether.net/pipermail/cisco-nsp/
