I’ve been doing a lot of work recently with VyOS1, the really amazing open source2 Linux based router operating system. A co-worker of mine showed it to me when we needed a capable router in our development environment and we didn’t feel like waiting for finance to approve a Cisco purchase. I have to admit I didn’t quite get it at first. Linux is an OS, not a router! That’s what IOS3 is for! But after digging into it a bit for a budget constrained side project, I’m totally hooked. And I learned, unequivocally, that Linux can function as a very capable router.
One of the oddities about VyOS is the show configuration
command doesn’t produce copy/pastable output. This was initially frustrating to me as someone who is accustomed to the way IOS, ASA OS, and NX-OS work: what you type on the command line is exactly what gets put in the running config. And you can copy and paste bits from a saved config to reuse those settings in other devices.
To get similar behavior out of VyOS, run show configuration commands
. You can parse this using our friend the pipe character (|
) and the match
command followed by a pattern4 like so:
show configuration commands | match interfaces
I wrote a simple script5 to save the running configuration to date stamped file. This could probably get fancier and scp
it somewhere, but I just put it on the router itself in my home directory and grab it using an SFTP client.
1 2 3 4 |
|
Happy routing! And don’t forget to always backup your config!
-
I use “Vyatta”, “VyOS”, and “EdgeRouter” interchangeably, for better or for worse.↩
-
Well, it’s technically no longer open source since Brocade bought them. But VyOS and EdgeRouter are healthy open source forks. That’s what I’ve been using.↩
-
This feels like
fgrep
is being run behind the scenes. Very similiar to the Cisco| include
command.↩ -
There are a few idiosyncrasies to scripting with VyOS outlined here.↩