---
name: "mrtd"
section: "1"
platform: "linux"
package: "mrt"
version: "2.2.2a-3"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/mrtd"
---

# mrtd(1)

multi-threaded routing daemon

## NAME

mrtd - multi-threaded routing daemon

## DESCRIPTION

Usage: mrtd \[-f config\_file\] \[-p uii\_port \] \[-v\] \[-n\]

3\. MRTd

   MRTd is a multi-threaded routing daemon with support for BGP4, RIP1/2,\
    RIPng, and BGP4+ (for IPv6) and multiple RIBs (i.e. route server).\
    MRTd reads Cisco Systems-like router configuration files and includes\
    a Cisco Systems router-like interactive telnet interface.

   At the moment, BGP, RIPng, and BGP4+ are completely supported. RIP1/2\
    and its interaction with other protocols are not supported.\
    Development of OSPF and PIM-DM is currently underway.

  Synopsis

    mrtd \[-v\] \[-n\] \[-f configuration file\] \[-l rib file\] \[-r\] \[-m\]

  Options

   \-f configuration\_file\
           Read the specified configuration file. By default, MRT tries to\
           read /etc/mrtd.conf.

   \-v\
           Turn on verbose logging to standard output. This is useful to\
           turn on logging before the debug commands are read in the\
           configuration file.

   \-n\
           Specify that MRT will not modify the kernel routing table.\
           (This option is used to test MRT configurations with actual\
           routing data.)

   \-r\
           Don't install routes in the RIB.

   \-l routing database\
           Load routes from a routing table dump and use these prefixes in\
           the simulation. The routing database file must be in MRT\
           message format. The programs included in the route\_atob\
           directory will convert GateD, RSd and Cisco Systems routing\
           table dumps to MRT RIB format.

   \-m\
           Use a new dump format.

  Description

   MRT first reads its configuration file (by default /etc/mrtd.conf) to\
    configure routing protocols, route peerings, and routing policy. The\
    configuration file closely resembles those used by Cisco Systems\
    routers.

   After reading the configuration file, MRT scans the kernel for\
    existing routes, scans the kernel interface list, and then initiates\
    routing protocol communications. MRT also begins listening on the mrt\
    service port, "mrtd," (specified in /etc/services) for user telnet\
    connections.

  Sample Configuration Files

   A sample IPv4 MRT configuration file is shown below:

   Line vty\
        password\
        my\_password login ! debug norm stdout ! access-list 1 deny 0.0.0.0/0 access-list 1 permit all access-list 2 permit 192.168.0.0/16 ! router bgp 185 neighbor 192.168.10.2 remote-as 65 neighbor 192.168.10.2 distribute-list 1 in neighbor 192.168.10.2 distribute-list 2 out neighbor 198.108.60.244 remote-as 185 redistribute static redistribute rip ! router rip network 192.168.10.0/24 network 198.108.60.0/24 redistribute static redistribute bgp ! ip route 192.168.100.0/24 192.168.10.100 ip route 192.168.150.0/23 192.168.10.100 ip route 192.168.190.1/24 192.168.10.100 ip route 10.0.0.0/8 192.168.10.100

   Following is a sample IPv6 configuration file:

   Line vty\
        password my\_passwordhttp://pythia.uoregon.edu/~llynch/nanog16.html\
        port 5674 login\
        !\
        dump bgp view 1 /susr/masaki/tmp/ipv6/bgp.routes.%y%m%d.%H:%M 60m\
        dump bgp updates /susr/masaki/tmp/ipv6/bgp.updates.%y%m%d.%H:%M\
        15m\
        debug all /tmp/MRTd.log 1000000\
        redirect /tmp\
        !\
        access-list 1 deny 3ffe:1c00::/24 refine !merit internal\
        access-list 1 permit all\
        !\
        access-list 99 deny all\
        !\
        as-path access-list 1 permit ^1673 ! just an example, it's always\
        true\
        !\
        router bgp 237 ! define own AS number\
        aggregate-address 3ffe:1c00::/24 summary-only as-set\
        neighbor 3ffe:0dfe:fffe::9 remote-as 1673 ! eBGP\
        neighbor 3ffe:0dfe:fffe::9 description ANS\
        neighbor 3ffe:0dfe:fffe::9 distribute-list 1 out ! drop specific\
        neighbor 3ffe:0dfe:fffe::9 filter-list 1 in ! as path filter\
        neighbor 3ffe:1c00::3 remote-as 237 ! iBGP\
        neighbor 3ffe:1c00::3 description CC\
        neighbor 3ffe:1c00::3 bgp4+ 1 ! use RFC version of BGP4 MP\
        neighbor 3ffe:1c00:0:60::112 remote-as 112 ! for test\
        neighbor 3ffe:1c00:0:60::112 remote-as 112 description MRT\
        neighbor 3ffe:1c00:0:60::112 distribute-list 99 in ! drop\
        everything\
        neighbor 3ffe:1c00:0:60::112 bgp4+ 1 ! ! use RFC version of BGP4\
        MP\
        redistribute static ! inject static routes\
        redistribute direct ! inject connected routes\
        !\
        router ripng\
        network 3ffe:1c00:0:60::/64\
        network 3ffe:1c00:0:12::/64\
        network cti1\
        network cti2\
        redistribute static\
        redistribute direct\
        redistribute bgp\
        distribute-list 99 in cti2\
        distribute-list 99 out cti2\
        !\
        ip route 0.0.0.0/0 198.108.60.1 ! default route\
        ip route 3ffe:1c00::/24 ::1 ! merit pTLA

  Configuration Guide

   This section introduces the command sets for:\
      \* Configuring MRTd and BGPsim\
      \* Using MRT's interactive interface to monitor the status of MRTd\
        and BGPsim.

   For information about the uii, debug, and access-list configuration\
    commands, see Chapter 2, "Getting Started."

    Configuration Commands

   As mentioned in Chapter 2, all of the below options may be configured\
    directly through the UII telnet interface. Administrators may also\
    choose to edit the configuration file directly on disk. In this case,\
    MRTd must be rebooted before the changes will take affect.

      Configuring Routes and Policy

   MRTd supports most of the common Cisco Systems routing policy\
    commands, including access lists, as-path access lists and route maps.

   route--\
    defines a static route

   route \[\]

   Establishes a static route to a destination via . may be an IPv4 or\
        IPv6 address and must be consistent with . To use a specific\
        interface, specify .

   as-path access-list\
    \--defines an as-path access-list

   as-path access-list \<number\> {permit\|deny} \<as-regular-expression\>

   Defines an as-path access-list \<number\>, which permits or denies\
        access if \<as-regular-expression\> is matched.\
        Matches are performed in the order in which they appear. At the\
        end of a list with the same number, deny .\* is assumed.\
        The as regular expressions are as follows:\
        \<number\> an as number (1 through 65535)\
        . Matches any single as number\
        \* Matches 0 or more sequences of the pattern\
        \+ Matches 1 or more sequences of the pattern\
        ? Matches 0 or 1 occurrences of the pattern\
        ^ Matches the beginning of the as path\
        $ Matches the end of the as path\
        \| Matches one of the alternatives\
        () Encloses a pattern\
        For example:\
        .\* any AS path, including null\
        237$ originated from AS 237\
        237 via AS 237\
        ^(237\|10) from AS 237 or AS 10\
        ^$ originated from this AS

   network \<prefix\>

   Configure routes originating in BGP.

   route-map--\
    define a route-map

   route-map

   Defines the conditions to modify attributes of any updates.

   route-map\
    sub commands

   set as-path \[prepend\]

   Sets or prepends to the as-path of the route. Note that there is no\
        matching function implemented.\
  ... ...    a sequence of AS numbers

        \[ ... \]  a set of AS numbers

   set community \[additive\] (\|no-export\|no-advertise)

   Sets community attribute to the route, or appends if additive is\
        specified.\
        values are 1 to 4294967200.

   set origin (igp\|egp \|incomplete)

   Sets the origin code.

   set next-hop \<address\>

   Sets the nexthop attribute. If the address is an IPv6 global address,\
        it is set as BGP4+ next hop. In addition, If the address is an\
        IPv6 link-local address, it is set as BGP4+ next hop link local\
        address.

   set metric

   Sets the metric value (MED).

   set local-preference

   Sets the local preference value.

   set dpa as

   Sets the DPA values.

   set atomic-aggregate

   Sets automatic aggregate attribute.

   set aggregator as\
    \<address\>

       Sets aggregator information. \<address\> should be IPv4.

      Configuring Routing Protocols

   MRTd supports BGP4, BGP4+, RIP2, and RIPng. This version includes\
    partial support for OSPF, and a PIM-DM implementation is underway.

   router--configures routing protocol

   router bgp\
    \<as number\>

       Enables assignment of the BGP (or BGP4+ if IPv6 is available)\
        routing protocol to the routing process.

   router ripng

       Enables RIPng routing protocol.

   router rip

       Enables RIP routing protocol.

   The following commands are available for the router bgp command.

   neighbor remote-as\
    \<peer's as number\>

       Adds an entry of BGP neighbor with .\
        \<peer's as number\> should be an AS number to which the peer\
        belongs.\
        Must precede other neighbor commands for .

   neighbor update-source

   Specifies the addresses for outgoing BGP connections and at which\
        incoming BGP connections are accepted.

   neighbor next-hop-self

   Forces the next hop in the AS path to be the host itself.

   neighbor\
    \<peer address\> (transparent-as\|transparent-nexthop)

       Set transparent option for neighbor, as in use as a route server.

   neighbor\
    \<peer address\> passive

       Does not initiate BGP connections--only accepts them.

   neighbor maximum-prefix

   Sets the maximum number of prefixes incuded in a BGP update.

   neighbor distribute-list {in\|out}

   Applies access-list to incoming (in) or outgoing (out) route updates\
        for a peer with .

   neighbor\
    \<peer address\> filter-list \<number\> {in\|out}

       Applies as-path access-list \<number\> to incoming (in) or outgoing\
        (out) route updates for a peer with \<peer address\>.

   neighbor \<\
    peer address\> weight \<num\>

       Set a weight associated with a peer.

   neighbor\
    \<peer address\> trace

       Enable tracing of a BGP peer.

   neighbor route-map {in\|out}

   Applies a route-map to incoming (in) or outgoing (out) route updates\
        for a peer with .

   neighbor route-reflector-client

   Sends routes to an internal peer even if learned from another internal\
        peer (route reflection.)

   neighbor description\
    \<string\>

       Attaches \<string\> to the neighbor as a description.

   neighbor (holdtime\|keepalive\|connectretry\|starttime) \<num\>

   Set the timer for a neighbor.

   neighbor\
    \<name\> neighbor-list \<num\>

       Allows anonymous neighbor peers.

   neighbor bgp4+ (0\|1\|old\|new\|rfc\|auto)

   Specifies BGP4+ packet format. The default is 0.

   redistribute

   Redistributes routes from such as rip to BGP.

   aggregate-address \[summary-only\] \[as-set\]

   Creates an aggregate entry to . summary-only suppresses all more\
        specific routes from updates. as-set merges as paths to generate\
        as-set path attribute.

   bgp router \<id\>

   Defines the router ID used in BGP. The router ID should be an IPv4\
        address assigned to the host. The default is one of the addresses\
        available on the host; which is picked up by MRT automatically.

   bgp cluster-id \<id\>

   Defines the cluster ID used in the BGP reflector. The default is the\
        same as the router ID.

   router rip/ripng\
    \--RIP/RIPng routing

   The following commands are available for the router RIP/RIPng command.

   network {\|}

   Specifies interface(s) by or by name. to turn on RIP/RIPng. All\
        interfaces included under will be enabled.

   distribute-list {in\|out}

   Applies access-list to incoming (in) or outgoing (out) route updates\
        on .

   redistribute

   Redistributes routes from to RIP/RIPng.

      Statistics Collection

   MRTd can log both routing table dumps and binary traces of all BGP\
    events in a format parseable by other MRT (and soon Zebra) tools. So,\
    for example, BGP updates can be recorded via MRTd and later replayed\
    to test peers through bgpsim or sbgp. The MRT Programmer's Manual\
    includes a description of the MRT packet formats.

   dump bgp--\
    dump BGP updates, state changes, and routes

   dump-binary \[{ip\|ipv6}\] bgp routes \[\]

   Dump BGP routing table in binary MRT format. can be in strftime()\
        format. If is specified, the file will be reopened every ,\
        re-evaluating the filename. If ip or ipv6 is specified, only the\
        routes of the address will be dumped.

   dump \[{ip\|ipv6}\] bgp {routes\|updates\|all} \[\]

   Dumps BGP/BGP4+ routes, updates, or all into the file .\
        can be in strftime() format. If is specified, the file will be\
        reopened every , re-evaluating the filename. If ip or ipv6 is\
        specified, only the routes of the address will be dumped.

   dump bgp view \<view number\> \[\]

   Dump routing table for specified view.

  Interactive Interface Commands

   MRTd and BGPsim provide an interactive user interface for management\
    (e.g., viewing the routing table) and configuration.

   The following commands are specific to MRTd and BGPSim. Additional\
    commands are described in Chapter 2, "Getting Started."

    clear bgp \* \<name\> - Close/reset BGP peering session with this peer \*

    config \* - Enter configuration mode

    quit - Exit mode, or exit UII interface

    show - show system information

   show \[{ip\|ipv6}\] bgp

   show \[{ip\|ipv6}\] bgp summary

   Show BGP peers summary

   show \[{ip\|ipv6}\] bgp neighbors

   Show BGP peers and their status

   show bgp neighbors\
    (\<peer address\>\|\<name\>\|\*) errors

       Show recent BGP errors/notifications with this peer.

   show bgp neighbors\
    (\<peer address\>\|\<name\>\|\*) routes

       Show BGP routes sent to this peer

   show \[{ip\|ipv6}\] bgp routes

   Show BGP routing table

   show \[{ip\|ipv6}\] bgp regexp\
    \<as-regular expression\>

       Show BGP routes matching the as-path regular expression.

   show \[{ip\|ipv6}\] bgp prefix\
    \<prefix\>

       Show BGP routes matching this prefix.

   show config

   Show the current configuration

   show interfaces

   Show all interfaces available

   show ip

   Show IPv4 routing table

   show ipv6

   Show IPv6 routing table

   show rib

   Show the central routing table

   show rip

   Show RIP status

   show rip routes

   Show RIP routing table

   show ripng

   Show RIPng status

   show ripng routes

   Show RIPng routing table

   show view\
    \<view number\>

   Show the BGP routing table for this view.

    dump & load - dump and load bgp binary routing table dump to/from disk

   dump \[{ip\|ipv6}\] bgp routes \<filename\>

   Dumps bgp routes into the file \<filename\>.

   load \[{ip\|ipv6}\] bgp routes \<filename\>

   Loads bgp routes from the file \<filename\>. Note that this will\
        introduce inconsistency into the routing table.

    trace - log protocol information to disk or UII

   trace \[{ip\|ipv6}\] bgp\
    \*

       Enable tracing of BGP protocol.

   trace bgp neighbor\
    (\<peer address\>\|\<peer name\>) \*

       Enable tracing on the peer. (The "terminal monitor" command is\
        required to watch this at the UII.)

   trace bgp view (\*\|inet\|inet6\|\<num\>)\
    \*

       Enable tracing of view routing table changes.

    quit--quit the mode or disconnect

       \*\
        Note that if you set \`enable password' in your configuration, the\
        enable command is required in order to execute some potentially\
        dangerous commands, such as clear bgp, config, and trace bgp\
        (marked with an asterisk\* above.)

   Following are examples of the interactive interface commands:\
        \[21\] MRTd\> show ip\
        4 prefixes\
        P Pref Time Destination Next Hop If\
        \*S 1 74:42:37 0.0.0.0/0 198.108.60.1 ep0\
        \*C 0 74:42:37 127.0.0.0/8 0.0.0.0 lo0\
        \*C 0 74:42:37 192.168.12.0/24 0.0.0.0 lo0\
        \*C 0 74:42:37 198.108.60.0/24 0.0.0.0 lo0\
        \[17\] MRTd\> show ripng

       Routing Protocol is "ripng" (Using IPV6)\
        Listening on port 521 (socket 10)\
        Sending updates every 30 seconds +/- 15, next due in 29 seconds\
        Triggered update and split horizon (no poisoned reverse)\
        implemented\
        Invalid after 180 seconds, hold down 180, flushed after 120

       106 ripng routes and 107 ripng attributes active\
        106 hash entries

You can find more documentation in /usr/share/doc/mrt/html/
