Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    Example: Configuring ICMP Router Discovery

    Understanding the ICMP Protocol for Discovering Gateways to Other Networks

    The ICMP Router Discovery Protocol (IRDP) enables hosts to locate routers on the local subnet and use them as a gateway to reach other networks. Junos OS supports running IRDP in server mode, meaning that router discovery packets are generated. Junos OS does not support IRDP in client mode running as a host sending router solicitation messages. IRDP is specified in RFC 1256, ICMP Router Discovery Messages.

    For a host to participate on an internetwork, it needs connectivity to at least one router on the local network. One way to ensure that this is the case is to manually configure each host with the address of a local router as its default router (also called a gateway). This method is time-consuming to set up, difficult to maintain, and inflexible.

    When you enable the Dynamic Host Configuration Protocol (DHCP) on a host, you do not need to configure the default router. DHCP uses a method called router discovery to automatically discover local routers, and learn other information about them.

    The information provided includes the router’s address (or addresses, if it has more than one) and how long the host should retain information about the router. Router advertisement messages are sent periodically. Hosts listen for these messages. When an advertisement is received, the host processes it and adds the information about the router to its routing table. A host that has no manually configured routing information has no connectivity to routers when it first powers on. Instead of waiting for the next Router Advertisement message, the host sends a router solicitation message on its local network. This prompts any router that receives this message to immediately send an extra router advertisement message directly to that host.

    By default, router discovery is disabled on Junos OS routing devices. When router discovery is enabled, the default behavior is to advertise all interfaces. If the router supports multicast, all the IPv4 Layer 3 interfaces are advertised through multicast. Otherwise, all the IPv4 Layer 3 interfaces are advertised through broadcast.

    Example: Configuring the ICMP Protocol for Discovering Gateways to Other Networks

    This example shows how to configure Internet Control Message Protocol (ICMP) router advertisements to allow IPv4 hosts to discover the addresses of operational routers on the subnet. Hosts must discover routers before they can send IP datagrams outside their subnet.

    Requirements

    This example assumes that a server or a client computer on the local network supports RFC 1256, ICMP Router Discovery Messages.

    Overview

    Before a host is able to send a message to a host outside its own subnet, it must be able to identify the address of the immediate router. This is typically done through reading a configuration file upon startup, and on some multicast networks by listening to routing protocol traffic. When a server or a client computer on the local network that supports RFC 1256 needs to locate a default gateway (router), the server or client computer uses ICMP to send a router solicitation. Hosts that support RFC 1256 send an ICMP router discovery message on the multicast address 224.0.0.2. Routers on the local network that support RFC 1256 immediately respond with a router advertisement.

    The all-routers IP multicast address, 224.0.0.2, is the local IP broadcast address that IPv4 reserved. IPv4 multicast addresses in the range 224.0.0.0/24 (from 224.0.0.0 to 224.0.0.255) are reserved for the local subnet.

    The ICMP Router Discovery Protocol (IRDP) uses router advertisements as well as router solicitation messages to allow hosts to learn the IP addresses of the router that is attached to the immediate network. When a host is started, it sends router solicitation messages to check for the address of the immediate router.

    Note: Not all hosts perform router discovery using the method specified in RFC 1256. If the host has DHCP enabled, it might not use ICMP router discovery. The performance of router discovery is one of the DHCP options that is defined in RFC 1541, Dynamic Host Configuration Protocol. This option specifies whether the client solicits routers using the ICMP router discovery method specified in RFC 1256. A value of 1 indicates that the client performs router discovery. A value of 0 indicates that the client does not.

    To configure the router to be a router discovery server, you must include at least the following statement in the configuration. All other router discovery configuration statements are optional.

    [edit]
    protocols {router-discovery;}

    To configure a router as a server for ICMP router discovery, you can include the following statements in the configuration:

    [edit]
    protocols {router-discovery {disable;address address {(advertise | ignore);(broadcast | multicast);(ineligible | priority number);}interface interface-name {lifetime seconds;max-advertisement-interval seconds;min-advertisement-interval seconds;}traceoptions {file filename <files number> <size size> <world-readable | no-world-readable>;flag flag <detail> <disable>;}}}

    Figure 1 shows a simplified sample topology.

    Figure 1: ICMP Router Discovery Topology

    ICMP Router
Discovery Topology

    Configuration

    CLI Quick Configuration

    To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level.

    set interfaces ge-1/2/0 unit 6 description to-R2set interfaces ge-1/2/0 unit 6 family inet address 10.0.0.6/24set protocols router-discovery traceoptions file icmp-logset protocols router-discovery traceoptions flag allset protocols router-discovery interface ge-1/2/0.6 max-advertisement-interval 60set protocols router-discovery interface ge-1/2/0.6 min-advertisement-interval 10set protocols router-discovery interface ge-1/2/0.6 lifetime 120set protocols router-discovery address 10.0.0.6 multicastset protocols router-discovery address 10.0.0.6 priority 900

    Step-by-Step Procedure

    The following example requires you to navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the CLI User Guide.

    To configure ICMP router discovery:

    1. Configure the network interfaces.

      This example shows multiple loopback interface addresses to simulate attached networks.

      [edit interfaces]user@R1# set ge-1/2/0 unit 6 description to-R2user@R1# set ge-1/2/0 unit 6 family inet address 10.0.0.6/24
    2. Enable router discovery.
      [edit protocols]user@R1# set router-discovery
    3. (Optional) Enable trace operations for router discovery.
      [edit protocols router-discovery]user@R1# set traceoptions file icmp-loguser@R1# set traceoptions flag all
    4. (Optional) Set the IRDP maximum interval between advertisements.
      [edit protocols router-discovery]user@R1# set interface ge-1/2/0.6 max-advertisement-interval 60
    5. (Optional) Set the IRDP minimum interval between advertisements.
      [edit protocols router-discovery]user@R1# set interface ge-1/2/0.6 min-advertisement-interval 10
    6. (Optional) Set the IRDP period for which advertisements are valid.
      [edit protocols router-discovery]user@R1# set interface ge-1/2/0.6 lifetime 120
    7. (Optional) Configure the router to include the 10.0.0.6 IP address in IRDP advertisements to the all-hosts multicast address (224.0.0.1).

      If the router supports IP multicast, and if the interface supports IP multicast, multicast is the default. Otherwise, the addresses are included in broadcast router advertisement packets.

      [edit protocols router-discovery]user@R1# set address 10.0.0.6 multicast
    8. (Optional) Set the preference of the address to become a default router.

      This preference is set relative to the preferences of other router addresses on the same subnet.

      [edit protocols router-discovery]user@R1# set address 10.0.0.6 priority 900

    Results

    From configuration mode, confirm your configuration by entering the show interfaces and show protocols commands. If the output does not display the intended configuration, repeat the configuration instructions in this example to correct it.

    user@R1# show interfaces
    ge-1/2/0 {unit 6 {description to-R2;family inet {address 10.0.0.6/24;}}}
    user@R1# show protocols
    router-discovery {traceoptions {file icmp-log;flag all;}interface ge-1/2/0.6 {max-advertisement-interval 60;min-advertisement-interval 10;lifetime 120;}address 10.0.0.6 {multicast;priority 900;}}

    If you are done configuring the device, enter commit from configuration mode.

    Verification

    Confirm that the configuration is working properly.

    Checking the Trace Log

    Purpose

    Verify that the expected interfaces are sending messages.

    Action

    From operational mode, enter the show log icmp-log command.

    user@R1> show log icmp-log
    Mar 21 14:42:54 trace_on: Tracing to "/var/log/icmp-log" started
    Mar 21 14:42:54.409027 rdisc_ifa_change: Preference for address 10.0.0.6(ge-1/2/0.6) set to 900
    Mar 21 14:43:33.983695 task_timer_uset: timer RouterDiscoveryServer_Group <Touched Processing> set to offset 22 at 14:43:16
    Mar 21 14:43:33.984263 rdisc_server_timer: group ge-1/2/0.6 timer set to 22
    Mar 21 14:43:55.985225 task_timer_uset: timer RouterDiscoveryServer_Group <Touched Processing> set to offset 37 at 14:44:10
    Mar 21 14:43:55.985520 rdisc_server_timer: group ge-1/2/0.6 timer set to 37
    Mar 21 14:44:32.986407 task_timer_uset: timer RouterDiscoveryServer_Group <Touched Processing> set to offset 39 at 14:44:44
    Mar 21 14:44:32.986961 rdisc_server_timer: group ge-1/2/0.6 timer set to 39
    Mar 21 14:45:11.987331 task_timer_uset: timer RouterDiscoveryServer_Group <Touched Processing> set to offset 10 at 14:44:42
    Mar 21 14:45:11.987888 rdisc_server_timer: group ge-1/2/0.6 timer set to 10
    Mar 21 14:45:21.990974 task_timer_uset: timer RouterDiscoveryServer_Group <Touched Processing> set to offset 23 at 14:45:34
    Mar 21 14:45:21.991548 rdisc_server_timer: group ge-1/2/0.6 timer set to 23
    Mar 21 14:45:44.992150 task_timer_uset: timer RouterDiscoveryServer_Group <Touched Processing> set to offset 45 at 14:46:06
    Mar 21 14:45:44.992710 rdisc_server_timer: group ge-1/2/0.6 timer set to 45

    Meaning

    The log output shows that the preference was set to 900 for IP address 10.0.0.6 and that messages are being sent on the ge-1/2/0.6 interface.

    Modified: 2016-04-29