- Created by Fréderic LOUI, last modified on Sep 29, 2020
You are viewing an old version of this page. View the current version.
Compare with Current View Page History
« Previous Version 2 Next »
This is a special blog series called "RARE Day One". I've always been a huge Cisco and JUNIPER fans, Cisco has unparalleled documentation and I really like JUNIPER "Day One" or "This Week" booklets. Similar to JUNIPER approach RARE "Day One" articles are dealing with essential topics that you need to get familiar with and that will become handy during your "RARE-freeRouter"-FU practices !
Requirement
|
Overview
Even in the era of zero touch configuration where everything can be modelled by YANG and automated by Ansible, CLI configuration mode is essential and will take a special important place into network engineers' heart.
Any network engineer in the room who never issued this command ?
conf t ...
Article objective
In this article, we will present you freeRouter available configuration mode. This is an essential article as it will help you in your potential daily operation task.
Diagram
[ #001 ] - "configure <mode>"
When you log into a network equipment such as a router, you tend to have some automatic reflex. You usually:
- Check router configuration: show run or sh conf
- Check ipv4 / ipv6 / or LFIB forwarding table
- An then you want to configure the router
Let's assume you want to configure interface sdn3 description:
r1#sh run sdn3 interface sdn3 description r1@LAN3[05:00.0] mtu 1500 macaddr 007b.0c15.1e0c shutdown no log-link-change exit ... r1#conf t r1(cfg)# r1(cfg)#int sdn3 r1(cfg-if)# r1(cfg)#int sdn3 r1(cfg-if)#description Hello Workd SDN3 r1(cfg-if)#
As you would notice, configuring these from "config terminal" prompt has an immediate effect. Please note you can issue "show" command from config mode using the "do" keyword :
r1#conf t r1(cfg)# r1(cfg)#int sdn3 r1(cfg-if)# r1(cfg)#int sdn3 r1(cfg-if)#description Hello Workd SDN3 r1(cfg-if)# r1(cfg-if)#do sh run sdn3 interface sdn3 description Hello Workd SDN3 mtu 1500 macaddr 007b.0c15.1e0c shutdown no log-link-change exit
At that point you have a running-config in router memory and you have a startup-config written into the freeRouter flash. In order to see the difference:
... r1(cfg-if)#do sh config interface sdn3 no description old_descrption description Hello Workd SDN3 exit ... r1(cfg-if)# end r1#show config-differences interface sdn3 no description old_descrption description Hello Workd SDN3 exit
Notice the use of "end" primitive in order to end configuration mode and revert to user mode. In the example we used shortcut command name:
- sh config
- show config-differences
So basically this command will show you the difference between running-config and startup-config. This is similar to Junos: show | compare except that in this context this a comparison between running and startup config.
In this case it just delete the current description and replace it by the new one.
Once you are happy you can write the running-config into the startup-config:
... r1#wr % success r1#sh conf r1#
You observe that show config-differences has no relevant output. running-config is aligned to startup-config !
Note
This is the most intuitive and recommended way to start learning freeRouter as from this interactive mode, you'll benefit from the contextual help that can be triggered by '?'. In this way you'll even be able to discover new freeRouter feature yourself ! This piece of software holds a tremendous amount of secret functionality. In the output below we just check which control plane can be activated ...
... r1(cfg)#router ? babel4 - babel routing protocol babel6 - babel routing protocol bgp4 - border gateway protocol bgp6 - border gateway protocol blackhole4 - blackhole collector blackhole6 - blackhole collector deaggr4 - deaggregate creator deaggr6 - deaggregate creator download4 - route download download6 - route download eigrp4 - enhanced interior gateway routing protocol eigrp6 - enhanced interior gateway routing protocol flowspec4 - flowspec to flowspec rewriter flowspec6 - flowspec to flowspec rewriter isis4 - intermediate system intermediate system isis6 - intermediate system intermediate system logger4 - route logger logger6 - route logger lsrp4 - link state routing protocol lsrp6 - link state routing protocol mobile4 - mobile route creator mobile6 - mobile route creator msdp4 - multicast source discovery protocol msdp6 - multicast source discovery protocol olsr4 - optimized link state routing protocol olsr6 - optimized link state routing protocol ospf4 - open shortest path first ospf6 - open shortest path first pvrp4 - path vector routing protocol pvrp6 - path vector routing protocol rip4 - routing information protocol rip6 - routing information protocol uni2flow4 - unicast to flowspec converter uni2flow6 - unicast to flowspec converter uni2multi4 - unicast to multicast converter uni2multi6 - unicast to multicast converter
"configure viewer" is a very interesting mode as it gives you the possibility to review the router configuration from a viewer inspired from "mcedit" (Norton Midnight Commander)
r1#configure viewer ...
Then you'll be able to read your configuration from a READ-ONLY text buffer:
As a side note, you can benefit from online help by pressing <f1>
But what if I just want to view a specific object ? Let's find out how to check ONLY BGP configuration @ home:
r1#configure viewer bgp4 ...
So in this case It'll just throw my IPv4 bgp config snippet onto the viewer buffer
Same if I want to only view all interface sdn<x> from the router config:
r1#configure viewer sdn ...
This is so cool, isn't ?
Note
In big TELCO Service Provider environment, most of the time you have Technical Project Manager that just need to perform some checks related to specific customer VPN deployment. So some times, I received some calls: "Can you please that from customer the HUB site prefix 1.2.3.0/24 is configured and advertised into BGP for customer ABC in VRF YXZ ?" With "configure viewer <object>", the TPM can just check it for himself without bothering you at all ! And this without the fear to alter router configuration by accident.
PS: For that you'll need to create a aaa security config with:
- proper router aaa security policy with privilege level 1
- with or without TACACS/RADIUS authentication / authorisation and accounting
- and apply it to a specific OOBM SSH/telnet server in a specific VRF,
but this is not in the scope of the the present article and it will be the object of further articles.
In SP environment, you should not be surprised to see router configuration that has 100k lines or even more. In these environment, I've seen config with countless amount of VRF, NAT, DLSW, GRE, IPSEC tunnels, BGP peers ... "config viewer" is a great tools when you want to verify a specific stanza on a per customer or object basis and in bonus without any risk the Provider Edge router configuration.
"configure viewer" gives you the possibility to view the config or some parts of the config in read-only mode. "configure editor" gives you simply the possibility to edit also the specific running-config config stanza.
r1#configure editor ...
Then you'll be able to edit your configuration from a READ-WRITE text buffer:
As a side note, you can benefit from online help by pressing <f1>
You can press Ctrl+q in order to exit the editor. As you did not change anything it will exit the editor.
But what if I just want to edit a specific object ? Let's find out how to check ONLY BGP configuration @ home:
r1#configure editor bgp4 ...
So in this case I'll just throw my IPv4 bgp config onto the editor buffer
In this buffer let's just create a description for BGP neighbor 172.23.215.177.
Now just press Ctrl-q (as per the online help accessible using <f1>). However, freeRouter detect the buffer changed has we added BGP description configuration. Therefore it will ask you if you want to save the buffer change into the running-config and apply it.
At that moment you'll be displayed a small recap of what has been applied.
Even more cool no ?
Warning
Even if "config editor" is seducing and seems more appealing especially for beginners. This is absolutely not the case. "configure editor" mode is meant for advanced users who knows freeRouter CLI by heart. Why, you might say ? Just try to edit a gigantic BGP configuration without any contextual help just by writing a textual file and you'll understand the risk behind using "config editor". Therefore it is no recommend to use it against complex control plane object.
Please take note that "config editor" alter the running-configuration directly when you saved the editor buffer !
Note
So what's the point of having this cool feature ? This feature is powerful when it comes to simple control plane object or big repetitive object. This is very practical to use this feature against: ACL / Prefix-List / Route Policy Object / Route Map etc.
- ACL
- prefix-list
- route policy list
- route-map
but nothing to prevent you to edit BGP stanza if you feel that your freeRouter-fu needs to be challenged
Same as "config editor", but instead of working against the running-config you are editing the startup-config. Which is more safe ... till the next reload
r1#configure startup ...
"configure reload" as its name implies is not about reloading a router whatsoever
r1#configure reload ? <url> - source url r1#configure reload ...
This command take a <url> as argument. Basically it will fetch router configuration from the specified <url> and load it into the startup-config. It is an equivalent to Cisco "copy <url> start". From that point:
- it is up to the network operator to check the startup configuration
- and issue a reload warm in order to restart the router and test that connectivity is resuming as expected
- Check the running-config is aligned to startup-config
Warning
(repetition is not harmful) As said before "configure reload" does not reload the router. It just load the config from specified <url> into the startup-configuration. And this steps precedes a reload that has to be triggered manually by the operator after having checked the config.
Note
in day to day operation, startup-config is usually not altered directly. In TELCO SP environment, IIRC, I used it mainly to retrieve configuration from a CMDB server during 2 situations:
- Router first time installation after basic configuration staging enabling minimum connectivity
- Router hardware replacement
Note that in SP environment, as VPN owner we could handle a portfolio of customer (~10). Each customer could have ~ 2000 CPEs. You can see why "config reload" can be very handy.
"configure network" gives you the possibility to update/merge existing running-config from config exposed from a web server.
r1#configure network ? <url> - source url r1#configure network ...
This command take a <url> as argument. Basically it will fetch specified configuration from the specified <url> and merge it into the running-config. It is an equivalent to Cisco "copy <url> run". So, from that point:
Warning
- only running-config is altered.
- If not saved all changes will be lost in the next reload
Note
in day to day operation, In TELCO SP environment, "configure network" is very useful when you want to apply the same configuration stanza to several router at the same time.
Same as "configure network" gives you the possibility to replace running-config from config exposed from a web server.
r1#configure overwrite-network ? <url> - source url r1#configure overwrite-network ...
This command take a <url> as argument. Basically it will fetch specified configuration from the specified <url> and replace the running-config. It is an equivalent to Cisco "copy <url> run". So, from that point:
Warning
- only running-config is altered.
- If not saved all changes will be lost in the next reload
Note
in day to day operation, In TELCO SP environment, "configure network" is very useful when you want to apply the same configuration stanza to several router at the same time from a clean slate state. (no merger)
"configure banner" is one of my favorite mode. It will display an editor allowing you to edit the banner of your router.
r1#configure banner ...
Press Ctrl-q and then y in order to save the banner.
Log in to you router again in order to check your new banner:
Note
in day to day operation, this banner can be written in configuration using banner encoded command
banner encoded ICAgX18gICAgICAgICAgICAgICBfX19fICAgICAgICAgICAgIF8NCiAgLyBffF8gX18gX19fICBfX198ICBfIFwgX19fICBfICAgX3wgfF8gX19fIF8gX18NCiB8IHxffCAnX18vIF8gXC8gXyBcIHxfKSAvIF8gXHwgfCB8IHwgX18vIF8gXCAnX198DQogfCAgX3wgfCB8ICBfXy8gIF9fLyAgXyA8IChfKSB8IHxffCB8IHx8ICBfXy8gfA0KIHxffCB8X3wgIFxfX198XF9fX3xffCBcX1xfX18vIFxfXyxffFxfX1xfX198X3wNCiAgXyBfXyBfX18gICBfX198IHwgX19fX18gIHwgfA0KIHwgJ19fLyBfIFwgLyBfX3wgfC8gLyBfX3wgfCB8DQogfCB8IHwgKF8pIHwgKF9ffCAgIDxcX18gXCB8X3wNCiB8X3wgIFxfX18vIFxfX198X3xcX1xfX18vIChfKQ0KDQo=
the command corresponds to the banner mentioned above.
"configure revert" revert the running-config to the startup config. For Junos fan it is equivalent to "rollback 0"
r1#sh run int sdn3 interface sdn3 description r1@LAN3[05:00.0] mtu 1500 macaddr 007b.0c15.1e0c shutdown no log-link-change exit !
r1# conf t r1(cfg)#int sdn3 r1(cfg-if)#description "This is the new description" mjolnir(cfg-if)#do sh conf interface sdn3 no description r1@LAN3[05:00.0] description "This is the new description " exit
r1(cfg-if)#do sh conf interface sdn3 no description r1@LAN3[05:00.0] description "This is the new description " exit
mjolnir(cfg)#exit mjolnir#sh run sdn3 interface sdn3 description "This is the new description " mtu 1500 macaddr 007b.0c15.1e0c shutdown no log-link-change exit
mjolnir#configure revert 1: interface sdn3 2: no description "This is the new description " 3: description r1@LAN3[05:00.0] 4: exit errors=0
mjolnir#sh run sdn3 interface sdn3 description r1@LAN3[05:00.0] mtu 1500 macaddr 007b.0c15.1e0c shutdown no log-link-change exit
Note
in day to day operation, In TELCO SP environment, "configure revert" should be used as "rollback 0" upon the running config. This means that you are about to abandon the current running config and re-apply the config that figures in the startup-config. In our case, it was changing a description, but in some case it can have more impact. (change route filtering, route advertising etc.)
"configure rollback" is very useful when you are in an operational situation that needs "trial and error" approach, and sometimes the error can lead to loss of connectivity on the router itself... Who never experienced that ?
First of all we have a saying a French saying: "Il n'y a que ceux qui ne font rien qui ne font pas de bêtise". So don't feel guilty about that... I remembered having isolated some sites just by accident ...
In this situation "configure rollback" is a combination of "configure revert" and a loss of CLI TCP session. What does this practically means ?
Imagine you are configuring a redistribution between IS-IS and OSPF and that you forgot that the network have 2 connections. This redistribution without careful route filtering will result in a routing loop and it happens that you lose connectivity upon that configuration. (never ending routing advertisement loop, high cpu load etc...)
Upon losing TCP connection, in "configure rollback" freeRouter will automatically revert to its startup config.
You will therefore auto-magically get back connection before it was the route redistribution that caused the havoc.
How cool is that !
Note
In IOS, i used to use "reload in <x>" command, in JunOS of course you have "commit confirm" and same goes for IOS-XR. So this airbag is not only unique to freeRouter, but IT IS THERE !
"configure file" gives you to the possibility to update/merge running configuration from a local file from the flash filesystem.
r1#configure file ? <file> - source file r1#configure file ...
This command take a <file> as argument. Basically it will load specified configuration from the specified <file> and update/merge the running-config. It is an equivalent to Cisco "copy <flash:file> run". So, from that point:
mjolnir#show flash /rtr date size name 2009-12-31 23:00:00 18048 bundle.bin 2020-07-30 15:47:05 2477 c.sh 2009-12-31 23:00:00 22648 hdlcInt.bin 2020-08-26 07:35:35 2937 hwdet-all.sh 2020-07-31 13:31:28 203 hwdet-main.sh 2009-12-31 23:00:00 18616 mapInt.bin 2020-09-29 08:58:48 554856 mjolnir.log 2009-12-31 23:00:00 18088 modem.bin 2009-12-31 23:00:00 131432 p4dpdk.bin 2009-12-31 23:00:00 121896 p4emu.bin 2009-12-31 23:00:00 63144 p4pkt.bin 2009-12-31 23:00:00 18088 pcap2pcap.bin 2009-12-31 23:00:00 18608 pcapInt.bin 2009-12-31 23:00:00 18384 rawInt.bin 2020-09-28 11:54:12 598 rtr-hw.txt 2020-09-28 21:16:19 14607 rtr-sw.txt 2020-07-30 15:47:37 2022 rtr.err 2020-09-29 03:09:25 5587321 rtr.jar 2020-09-29 03:09:16 5585713 rtr.jar.bak 2020-09-29 03:09:26 24 rtr.rld 2020-09-23 03:06:12 529 rtr.scr 2020-09-23 03:06:11 483 rtr.scr.bak 2020-08-23 17:34:19 46 rtr.scr2 2020-08-23 17:34:18 0 rtr.scr2.bak 2020-09-23 03:06:11 542720 rtr.tar 2020-09-23 03:06:09 522240 rtr.tar.bak 2020-09-29 03:11:04 2330 rtr.ver 2020-09-29 03:11:03 3790694 rtr.zip 2020-09-29 03:10:57 3789659 rtr.zip.bak 2020-07-30 15:47:05 388 setup_dpdk.sh 2020-07-30 15:47:05 48 setup_route.sh 2020-07-30 15:47:05 2171 setup_veth.sh 2009-12-31 23:00:00 18048 stdLin.bin 2009-12-31 23:00:00 18440 tapInt.bin 2009-12-31 23:00:00 18224 ttyLin.bin 2009-12-31 23:00:00 18256 vlan.bin
"configure file" gives you to the possibility to replace running configuration from a local file from the flash filesystem.
r1#configure replace ? <file> - source file r1#configure replace ...
This command take a <file> as argument. Basically it will load specified configuration from the specified <file> and replace the running-config. It is an equivalent to Cisco "copy <flash:file> run". So, from that point:
mjolnir#show flash /rtr date size name 2009-12-31 23:00:00 18048 bundle.bin 2020-07-30 15:47:05 2477 c.sh 2009-12-31 23:00:00 22648 hdlcInt.bin 2020-08-26 07:35:35 2937 hwdet-all.sh 2020-07-31 13:31:28 203 hwdet-main.sh 2009-12-31 23:00:00 18616 mapInt.bin 2020-09-29 08:58:48 554856 mjolnir.log 2009-12-31 23:00:00 18088 modem.bin 2009-12-31 23:00:00 131432 p4dpdk.bin 2009-12-31 23:00:00 121896 p4emu.bin 2009-12-31 23:00:00 63144 p4pkt.bin 2009-12-31 23:00:00 18088 pcap2pcap.bin 2009-12-31 23:00:00 18608 pcapInt.bin 2009-12-31 23:00:00 18384 rawInt.bin 2020-09-28 11:54:12 598 rtr-hw.txt 2020-09-28 21:16:19 14607 rtr-sw.txt 2020-07-30 15:47:37 2022 rtr.err 2020-09-29 03:09:25 5587321 rtr.jar 2020-09-29 03:09:16 5585713 rtr.jar.bak 2020-09-29 03:09:26 24 rtr.rld 2020-09-23 03:06:12 529 rtr.scr 2020-09-23 03:06:11 483 rtr.scr.bak 2020-08-23 17:34:19 46 rtr.scr2 2020-08-23 17:34:18 0 rtr.scr2.bak 2020-09-23 03:06:11 542720 rtr.tar 2020-09-23 03:06:09 522240 rtr.tar.bak 2020-09-29 03:11:04 2330 rtr.ver 2020-09-29 03:11:03 3790694 rtr.zip 2020-09-29 03:10:57 3789659 rtr.zip.bak 2020-07-30 15:47:05 388 setup_dpdk.sh 2020-07-30 15:47:05 48 setup_route.sh 2020-07-30 15:47:05 2171 setup_veth.sh 2009-12-31 23:00:00 18048 stdLin.bin 2009-12-31 23:00:00 18440 tapInt.bin 2009-12-31 23:00:00 18224 ttyLin.bin 2009-12-31 23:00:00 18256 vlan.bin
Discussion
Most of you will simply use the basic "conf t" mode, but keep in mind that depending on your context, all the other modes are proven to be very handy. The possibility to configure 1000 router with one single config file using "config network" is a savior. Having the possibility to trigger automatic definitive router staging using "conf reload" is tremendously useful when you have to deploy 10 routers a day. As said "config view" can give non operation staff to check if some configs are there or not ... "config editor" is very powerful when you want to edit a never ending access-list, but remember to avoid to use it for complex BGP config... You have been warned !
Conclusion
In this 1st article:
- We presented freeRouter config mode
- Most of these are useful in various different context
Final words
All these modes are not new. IOS, IOS-XR, IOX-XE, NW-OX, JUNOS have their own config mode that are somewhat similar. In any case freeRouter config mode implementation is meant to address all needs from the network operators perspective. As you can observe, configure mode has an impressive list of mode. Feel free to try and use them according to your environment taste!
- No labels