Showing posts with label JunosTips. Show all posts
Showing posts with label JunosTips. Show all posts

Sunday, 4 November 2012

[JTips] Configure NTP server

 

JUNOS TIP: Keeping routers (and their log timestamps) synchronized with NTP, and the use of lo0-based routing engine protection firewall filters, are two best practices that are often deployed together.


Another one of NTP’s not-so-well-understood nuances is its need to use the 127.0.0.1 loopback address when communicating with the local daemon to obtain server association status. Make sure your protecting filters allow such traffic, or you’ll get an error rather than the expected status display.


Scenario: You have configured Junos for NTP, and while actual clock synchronization appears to be working fine, you note that the "show ntp associations" command is timing-out:


user@host# show ntp associations
localhost: timed out, nothing received
***Request timed out

The solution is to make sure your routing-engine protection filter permits internal communications with the ntp daemon:
[edit]
user@host# show firewall family inet filter ROUTER-ACCESS term NTP-REJECT
from {
  source-prefix-list {
    default-prefix;
    NTP-ROUTER-ACCESS except;
  }
  protocol udp;
  port ntp;
}
then {
  discard;
}

user@host# show policy-options prefix-list NTP-ROUTER-ACCESS
10.0.3.1/32;
10.0.3.99/32;

Modify the NTP-ROUTER-ACCESS prefix list to include the loopback address, like this:

[edit policy-options prefix-list ntp-router-access]
user@host# show | compare

+ 127.0.0.1/32;
user@host# run show ntp associations
remote refid st t when poll reach delay offset jitter
==========================================
*10.0.3.99 130.149.17.8 2 u 29 64 377 0.624 -0.427 0.280
+10.0.3.1 192.36.143.150 2 - 24 128 377 2.343 2.014 0.168

Wednesday, 31 October 2012

[JTips] Disable ''Auto-negotiation'' on JUNOS

If ''Auto-negotiation" configured on GE interfaces can cause packet loss on both sides, and the FIFO error statistics are increasing, as shown 

lab@router> show interfaces extensive ge-0/0/0 
Physical interface: ge-0/0/0, Enabled, Physical link is Up
Interface index: 128, SNMP ifIndex: 79, Generation: 11
Description: coloc uplink
Link-level type: Ethernet, MTU: 1518, Speed: 100mbps, Loopback: Disabled, Source filtering: Disabled, Flow control: Enabled
<...>
  MAC statistics:                      Receive         Transmit
    Total octets                       5473299         96564932
    Total packets                       112044              398
    Unicast packets                     888990           696389
    Broadcast packets                   158996           401151
    Multicast packets                    64059             4121
    CRC/Align errors                         0                0
  
FIFO errors                              0            43518
    MAC control frames                       0                0
    MAC pause frames                         0                0
    Oversized frames                         0
    Jabber frames                            0
    Fragment frames                          0
    VLAN tagged frames                       0
    Code violations                          0

At the same time, the GE auto-negotiation status is "Incomplete" or "No-autonegotiation":

Autonegotiation information:
      Negotiation status: No-autonegotiation, Link partner status: Ok, Link partner: Unknown, Flow control: None

Disable auto-negotiation for GE interfaces:

[edit interfaces ge-0/0/0]
root@LAB# show
gigether-options {
    no-auto-negotiation;
}
unit 0 {
    family inet {
        address 192.168.1.1/24;
    }
}

Sunday, 30 September 2012

How to hide configuration?


JUNOS TIP: An often forgotten or unnoticed Junos tip is that you can hide common pieces of configuration in everyday use by setting apply-flags omit in the hierarchy you want to omit, like so:

[edit]
user@device# set system apply-flags omit

[edit]
user@device# show
## Last changed: 2011-05-02 17:24:51 UTC
version 10.3R1.9;
system { /* OMITTED */ };
logical-systems {
[...]

After committing, a show system in configuration mode will still show the whole stanza and editing works just as it usually does:

[edit]
user@device# show system
apply-flags omit;
host-name device;
root-authentication {
encrypted-password "$1$KI99zGk6$MbYFuBbpLffu9tn2.sI7l1"; ## SECRET-DATA
[...]

Use show | display omit in the top of configuration to show the entire configuration without omitting sections:

[edit]
user@device# show | display omit
## Last changed: 2011-05-02 17:24:51 UTC
version 10.3R1.9;
system {
apply-flags omit;
host-name device;
root-authentication {
encrypted-password "$1$KI99zGk6$MbYFuBbpLffu9tn2.sI7l1"; ## SECRET-DATA
[...]

This tip is useful for hiding long, uninteresting, static pieces of various configurations.