Network World
Saturday, November 22, 2008
DNSstuff.com
Get information about your IP
IP Information
50+ On-demand DNS and network tools

Jeff Doyle on IP Routing

Cisco Subnet

Navigation

Navigating a JUNOS Configuration

In the previous post on JUNOS I gave you a brief overview of the software architecture, with a particular emphasis on modularity. In this post, we'll have a first look at maneuvering around within a JUNOS configuration file.

The JUNOS configuration file is well organized in a hierarchical structure; once you understand that structure and its various levels, it's easy to navigate the file and find exactly the parts you want to examine or change without being distracted by parts you are not interested in at the moment.

To begin, I log into the router:

Juniper5 (ttyd0)

login: jeff
Password:

--- JUNOS 8.5R1.13 built 2007-11-14 17:54:24 UTC
jeff@Juniper5>

The prompt shows the user name (jeff) and the name of the router (Juniper5). The router is now in operational mode, from which you can perform operational tasks such as displaying router states and databases, ping and traceroute, telnet and ssh, restarting system processes – most commands that you need for monitoring and troubleshooting the system. The JUNOS operational mode is equivalent to the IOS user EXEC mode; in fact the prompts of both is a "greater than" (>) sign.

As with IOS, the question mark is your friend; it's the primary informational tool when you can't quite remember the next statement in a command string, or just want to see what options are available to you. I can use the question mark to see all of the commands available in operational mode:

jeff@Juniper5> ?
Possible completions:
clear Clear information in the system
configure Manipulate software configuration information
diagnose Invoke diagnose script|
file Perform file operations
help Provide help information
monitor Show real-time debugging information mtrace Trace multicast path from source to receiver ping Ping remote target quit Exit the management session request Make system-level requests restart Restart software process set Set CLI properties, date/time, craft interface message show Show system information ssh Start secure shell on another host start Start shell telnet Telnet to another host test Perform diagnostic debugging traceroute Trace route to remote host

To make configuration changes, I enter configuration mode by entering the configure command:

jeff@Juniper5> configure

Entering configuration mode

[edit]
jeff@Juniper5#

The JUNOS configuration mode is equivalent to the IOS privileged EXEC or "enabled" mode. Notice that the prompt changed from > to #, again the same way IOS does after you enter the enable command.

Another characteristic of the JUNOS configuration mode is the [edit] banner just above the prompt. You can maneuver around within the configuration hierarchy to observe or change just the part of the file that are of interest to you; the banner indicates precisely where you are within the hierarchy. When the banner just shows [edit], you are at the top of the hierarchy. So for example, if you type show at this level with no modiiers, JUNOS displays the entire configuration.

Using the question mark with the show command, you can see the top levels of the configuration hierarchy:

[edit]
jeff@Juniper5# show ?
Possible completions:
  <[Enter]>            Execute this command

> access               Network access configuration
> accounting-options   Accounting data configuration
> applications         Define applications by protocol characteristics
+ apply-groups         Groups from which to inherit configuration data
> chassis              Chassis configuration
> class-of-service     Class-of-service configuration
> event-options        Event processing configuration
> firewall             Define a firewall configuration
> forwarding-options   Configure options to control packet forwarding
> groups               Configuration groups

> interfaces           Interface configuration
> policy-options       Routing policy option configuration
> protocols            Routing protocol configuration
> routing-instances    Routing instance configuration
> routing-options      Protocol-independent routing option configuration
> security             Security configuration
> services             Service PIC applications settings
> snmp                 Simple Network Management Protocol configuration
> system               System parameters
  |                    Pipe through a command
							

The labels accompanying this list explain the levels pretty well. For example, all interfaces are configured under the interfaces level, all protocols are configured under the protocols level, and all routing policies are configured under the policy-options level.

Below each of these top levels are many sub-levels. For example, under protocols you can find BGP, OSPFv2, OSPFv3, MPLS, RSVP, and so on. And under each of those will find further sub-levels specific to the protocol. Under OSPF, for example, you will find a level for the area configurations and then under each area level you will find a level for specifying the interfaces that are in that area. I'll show you an example of that in a moment.

The hierarchical structure of the configuration allows you to focus on just the part of the configuration in which you are interested. For example, suppose you want to look at just the BGP portion of the configuration. show protocols bgp shows you the entire BGP configuration:

[edit]
jeffr@Juniper5# show protocols bgp 
local-address 192.168.50.10;
local-as 65503;
group CustomerX {
    export XPolicy;
    peer-as 65510;
    neighbor 192.168.1.1 {
        authentication-key "$9$-Ud2aji.5z6qm"; ## SECRET-DATA
    }
    neighbor 192.168.1.5 {
        authentication-key "$9$JiZHmzF/t0I69ev"; ## SECRET-DATA
    }
    neighbor 192.168.1.10 {
        authentication-key "$9$mPF/u0Icrv1Rbs"; ## SECRET-DATA
    }
}
group CustomerY {
    neighbor 192.168.10.20;
    neighbor 192.168.10.30;
    neighbor 192.168.10.40;
}
group CustomerZ {
    neighbor 192.168.20.100;
}
						

You can see in this configuration that there is a local address (192.168.50.10) from which all the BGP TCP sessions originate, the local AS number is 65503, and there are three peer groups: CustomerX, CustomerY, and CustomerZ. CustomerX has an outgoing (export) routing policy I've named XPolicy; and because the AS number for that group (65510) is different from the local AS number, we know these are EBGP peers. There are three neighbors configured under this group, all of which are authenticated with individual passwords. Peer groups CustomerY, with three neighbors, and CustomerZ, with one neighbor, are IBGP because they have no separate AS numbers specified, and no authentication is configured.

Suppose, rather than the entire BGP configuration, you are interested in only the configuration of neighbor 192.168.1.5 under group Customer X. I can tell JUNOS to display just that part of the configuration file simply by being more explicit with the show command:

[edit]
jeff@Juniper5# show protocols bgp group CustomerX neighbor 192.168.1.5    
authentication-key "$9$JiZHmzF/t0I69ev"; ## SECRET-DATA

Of course if you are in configuration mode you probably want to do more than just look at parts of the configuration; you want to make changes. Using the question mark alone while in configuration mode, you can see the different actions you can take:

[edit]
jeff@Juniper5# ?     
Possible completions:
  <[Enter]>            Execute this command
  activate             Remove the inactive tag from a statement
  annotate             Annotate the statement with a comment
  commit               Commit current set of changes
  copy                 Copy a statement
  deactivate           Add the inactive tag to a statement
  delete               Delete a data element
  edit                 Edit a sub-element
  exit                 Exit from this level
  help                 Provide help information
  insert               Insert a new ordered data element
  load                 Load configuration from ASCII file
  quit                 Quit from this level
  rename               Rename a statement
  replace              Replace character string in configuration
  rollback             Roll back to previous committed configuration
  run                  Run an operational-mode command
  save                 Save configuration to ASCII file
  set                  Set a parameter
  show                 Show a parameter
  status               Show users currently editing configuration
  top                  Exit to top level of configuration
  up                   Exit one level of configuration
  wildcard             Wildcard operations
						

The remainder of this post and all of the next post discuss the actions on this list.

I want to add some elements to the configuration, and the command for doing that is set. Lets' say we want to add interface fe-0/0/0 to OSPF area 5. Using set, we specify each level down through the hierarchy until we get to the point – under the area 5 level – where the interface is to be added:

[edit]
jeff@Juniper5# set protocols ospf area 5 interface fe-0/0/0 

By the way, if OSPF was not enabled or area 5 did not yet exist, the same command would enable the protocol and create area 5 in addition to adding the interface to the area.

Another approach is to first move down to the level you want to configure, using the edit command, and then make the changes you want:

[edit]
jeff@Juniper5# edit protocols ospf area 5 
[edit protocols ospf area 0.0.0.5]
jeff@Juniper5# set interface fe-0/0/1 
						

Notice here that after entering edit protocols ospf area 5, the banner over the prompt changed to show where I am in the hierarchy – I always know where I am. I then used the set command to add interface fe-0/0/1 at that level. I don't need to specify the entire hierarchy this time, because I am already at the level where I want to make a change.

These two approaches give you the flexibility to manage a configuration in the manner most convenient to you. If you are just adding a statement or two to a configuration, it is usually easier to do that from the top level, specifying the full path down to the level you want to change. If you are making extensive changes to a particular level, it is usually easier to move to that level first using the edit command, and then make the changes directly without having to specify the full path with every command.

While edit takes you to the specific level where you want to work, up moves you up one level in the hierarchy. For instance, suppose that from where we are at the OSPF area 5 level, we want to move up to the full OSPF level:

[edit protocols ospf area 0.0.0.5]
jeff@Juniper5# up 
[edit protocols ospf]
jeff@Juniper5# show  
area 0.0.0.5 {
    interface fe-0/0/0.0;
    interface fe-0/0/1.0;
}

You can see that the banner above the prompt changed after issuing the up command, telling you where you are. A show command at any level shows all of the configuration statements under the level – in this case, it shows all of the OSPF config.

If you want to jump back to the top of the hierarchy from any level, you use the top command:

[edit protocols ospf]
jeff@Juniper5# top 
[edit]
jeff@Juniper5# 

In this example, you could also have gotten from the existing level to the top by issuing the up command twice: [edit protocols ospf] => up => [edit protocols] => up => [edit]. Using the edit, up, and top commands together, you can quickly move to wherever you need to be in the configuration file for efficient operations.

In addition to the set command, there are a few more important commands for changing the configuration. In the interests of space I won't demonstrate them, but I want to at least point them out:

  • delete is the opposite of set; it removes statements from the configuration.
  • replace is used to replace one statement with another statement.
  • insert is used when you want to add a statement within an ordered element (such as a filter list) rather to the end, as the set command would do.
  • deactivate is used when you want to make a statement inactive but don't want to remove the statement from the config. This is handy for temporarily "turning off" something that you intend to eventually turn back on.
  • activate is used to reactivate an inactive statement.
  • annotate is used to add a comment to a statement; this is very useful for making a large, complex configuration file easier to interpret.

One of the more significant operational differences between JUNOS and IOS is that unlike IOS, when you enter a new statement into the JUNOS configuration it does not immediately become active on the router. You can make as many changes as you like, inspect your changes, and make them take effect only when you explicitly tell the router to accept them.

That's the topic of the next post: Commits, rollbacks, saves, and loads.

HI,Jeff Thanks for your

Useful answer?
0

HI,Jeff

Thanks for your posts
Indeed,we can simulate a virtual JUNOS system for study.

Ha-ha,but i'm looking forward to your posts on MPSL:
"how RSVP-TE sets up an LSP ,and, how it determines what path to use for the LSP"
"how LDP works,and difference for RSVP-TE "

Thanks & BG
Jason

----------
Welcome to
http://www.netyourlife.net

Re: MPLS

Useful answer?
0

Hi Jason,

Thanks for your comments, and I'll definitely get back to covering more MPLS topics eventually.

--Jeff 

Thanks a lot

Useful answer?
0

Dear,Jeff

Thanks a lot,
And,I had recommanded to many many of friends in my forum to read your posts,they are all looking forward to that next next mpls topic.

Ha-HA,Thanks very much!

Thanks & BG
Jason

----------
Welcome to
http://www.netyourlife.net

JUNOS rookie

Useful answer?
0

Dear Jeff:

I like your words very much. It is simple and easy to understand. I am study Juniper EX Series Switch in order to conduct the hands-on course for SI engineers. This article is a good beginning for a new JUNOS user.

BTW, thanks for your last e-mail response about OSPFv2 LSA Type 8 usage in real world!

Sincerely,
--
Johnson

Awesome post. I always

Useful answer?
0

Awesome post. I always wanted to know about JUNOS.
Thanks a tonne. Anticipating more in the series :)

Best Blog on Network World

Useful answer?
0

As always best content on this site or any other Networking site, from Jeff. I love Jeff's blog, he makes stuff really easy to understand - whether it is Cisco Press - Routing TCP/IP Vol1, Vol2 or new series he has started here on NW about Juniper's JunOS or his recent blogs on MPLS label switching, he simply rocks.

iBGP reason to run

Useful answer?
0

Hi Jeff,

Thanks for your post in your previous article regarding the iBGP question I had posed over there. Again I do apologize for asking something completely unrelated to this article. Just had a few more questions with regards to iBGP usage in a enterprise environment.

Say if there are 4 sites with WAN Routers

P1 = Primary Site

D1 = DR Site

B1 = Remote Branch Primary Site

B2 = Remote Branch Secondary Site

Assume the following connections between the Branch and the Primary and DR Site

P1 (AS 65000)------eBGP------ B1 (AS 65001)

D1 (AS 65000)------eBGP------ B2 (AS 65001)

All these devices running BGP are the WAN Routers. These WAN routers in turn connect to other switches. The WAN Routers run EIGRP with these switches within the site and between the site.

P1 ---------- EIGRP ---------- D1

B1 ---------- EIGRP ---------- B2

The P1 and D1 sites are the Data Center Sites and they will provide transit for other Remote Branch sites to reach other.

Hence based on your previous explanation it would seem that iBGP would be required within AS65000? Is that correct? Can you elaborate on why that would be the case? Won't it be possible to just run an IGP like OSPF or EIGRP and redistributed eBGP into the IGP? Since this is not the full internet routing table but a very small subnet of private networks probably than the IGP should have no problem handling these subnets I would think?

With regards to the branch sites since they are not providing transit is iBGP required in AS65001?

I realize that the benefits of running IBGP are that you have a richer feature set to manipulate the routing. In addition with proper summarization you probably do not have to redistribute your IGP into BGP but most of the times i think you would redistribute the IGP into BGP with filters and same for vice-versa. Those are the only reasons I would see to run iBGP in a enterprise environment. Can you please advise if my thinking is correct? Thx

Re: IBGP

Useful answer?
0

If I recall correctly, you asked previously why you would want to run IBGP: A very general question, to which I gave a general answer. For most general best practice rules, I could come up with exceptions, corner cases, and other reasons why the generality isn't all that important for a specific case. 

Sure, you can run the above network just as you describe. Better yet, why not make it all one AS and run an IGP everywhere?

It's all about making the best design decision *for a specific network*, insuring that the risks and operational complexities are minimized, and using the best tools for the problem you are trying to solve.  

--Jeff 

Why does no one use Static Routes?

Useful answer?
0

Using another IGP would work just fine, as Jeff responded there are lot of ways to skin the cat so to speak, its about choosing the best one.
I would ask... on network with only 4 routers, that most likely do not have redundant connections, why not consider STATIC routes?

I the understanding that routing protocols are only reasonable on a network with dozens of routers or circuits, and some redunandcy or likelyhood of change. When your network is relatively static, why not just nail down the routes you want? Static routes support manual weighting, so you can very easily have backup circuits with less weight than the primary ones. Not only that but you could save a load of CPU/resource time on the routers at the remote offices by not having to run any routing protocols like BGP or OSPF.
BGP uses a lot of memory/CPU resources. Even if you are not at the limit now, by avoiding using unneeded processes on your networking equipment you can continue to use the same equipment for longer, and wont require as many updates. You could certainly avoid using BGP on the remote offices, and likely at your data center as well. If you do have more than one connection to more than one ISP, then BGP is probably a necessity on your gateway router. If both connections are to the same ISP there are other wasy ways to use both circuits without needed BGP's giant routing tables.

I think Cisco and other experts way too often push much more complex solutions than necessary. Automation only makes sense when you are going to have to re-do the task a number of times. For large networks there is NO question that routing protocols are NECESSARY to manage all the routing and device/circuit changes that will happen. But I think the simplistic design is WAY to ofter overlooked on smaller networks.

[Jeff I would love your expert opinion on this statement]

Re; Static Routes

Useful answer?
0

Hi,

In defense of the previous poster I think he was using the 4-router layout just as an example for examining interactions at protocol domain edges, not as an example of an entire network.

Having said that, I'm very much in agreement with you about static routes. I love 'em. Any kind of automatic process, whether a routing protocol, a dynamic tunneling mechanism, or whatever, means giving up some control of the network. And that means unexpected things can happen. Automatic mechanisms are needed for scale, but at routing domain edges and especially at autonomous system edges I always look to use static routes first and only go to something more dynamic if absolutely necessary. 

As I tend to harp endlessly about on this blog, it's all about risk mitigation.

--Jeff 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <i> <b> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <br /> <br> <p>
  • Lines and paragraphs break automatically.
  • You can use BBCode tags in the text.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

About Jeff Doyle

Jeff Doyle is president of Jeff Doyle and Associates, an IP network consultancy. Jeff is the author of Routing TCP/IP, Volumes I (read an excerpt) and II and of OSPF and IS-IS: Choosing an IGP for Large-Scale Networks. He is a frequent speaker on IPv6, MPLS, and large-scale routing.

Contact him.

RSS feed XML feed

Jeff Doyle archive.

Cisco Subnet

RSS feed Cisco news RSS feed

The opinions expressed in this Weblog are those of the writer and may not represent the opinions of Network World.

Advertisement: