DE-CIX logo

Migration between IXP Peering LANs on VyOS – how-to

With DE-CIX Munich having an upcoming migration to accommodate for new members, we’re up against the challenge to re-address all our peering sessions.


As I’m both lazy and not that good at programming, I quickly jump to for loops and usage of awk.
Of course there’s more elegant ways, but I know it works well, and it’s easier to understand and read.

Given the information by DE-CIX, the migration is from 80.81.202/24 to
As there’s nothing on the upper /24, we don’t need to account for that in this migration.

Deleting the old peers

The command we’ve used is as follows:
echo "" > change_decix_muc.txt
for i in `show ip bgp sum |grep 80.81.202 | awk '{print $1}'`; do echo -en "delete protocols bgp 58299 neighbor $i \n" >> change_decix_muc.txt; done


First off, we create a new file with a simple empty echo command, which we’ll call “change_decix_muc.txt”.

Second, we initiate a for loop. This loop prints out the currently configured neighbors; pipes this into a grep that simply looks for the peers that match the old Peering LAN (80.81.202), and this is then fed into an awk that prints the first column, to give back every Peering LAN IP to $i in the for loop.

After that, we hand it over to the do, which echo‘s the commands to delete the old neighbors; finally written into “change_decix_muc.txt”.

Adding the new peers

Now that we’ve written out the commands to delete the old neighbors, we’ve got to figure out how to easily replace them with their new counterpart IP.

We’ll use the following for that:
show configuration commands | grep "protocols bgp 58299 neighbor 80.81.202" | sed s/80.81.202/185.1.208/g >> change_decix_muc.txt


Like the first one, I’ll break down what it does.

The first line tells the router to show us the entire configuration, in command form; We’ll pipe the results to grep, which looks for all configured neighbors in the old Peering LAN.

Once grep has that figured out, we hand it over to sed, which in this case knows “Alright, I need to throw out 80.81.202, and replace that with 185.1.208”.

Lastly, we append the results to the existing “change_decix_muc.txt” file, and that’s it!
You’ve now got a file that has all the commands primed and ready to go.

Running the commands

Now that we’ve got the commands nicely written out in a file, we’ll copy it somewhere accessible, and open it in a text editor.

After that, we’ll focus back onto the router, and move into configuration mode. (configure)

Finally, we copy/paste the file’s contents into the terminal, run commit; save; exit, and we’re done!
If you take a look at your neighbors, you should now see them all replaced with their new counterpart IP.


My solution is by no means elegant, but it definitely works well.
It also cuts down the ~30 seconds it might take per peer to do by hand to about 1 minute for the entire change.

Share this post

Share on facebook
Share on twitter
Share on linkedin
Share on email