ip route – семейство команд для настройки IP-маршрутов

ip route <subnet> netmask <mask> vrf <vrf-name> interface <interface-name> (dc|gateway <address>) [ad <number>]

ip route <subnet> netmask <mask> vrf <vrf-name> gateway <address> (without-interface|interface <interface-name>) [ad <number>]

Добавить статический unicast-маршрут.

Используйте параметр dc, чтобы добавить непосредственно подключенный (directly connected) маршрут. В этом случае параметр gateway излишний, но не исключающий.

Используйте параметр without-interface, чтобы добавить маршрут для виртуального маршрутизатора (Virtual Routing and Forwarding или VRF) без указания интерфейса.

По умолчанию административная дистанция (параметр ad) равна 1.

ip route <subnet> netmask <mask> vrf <vrf-name> blackhole [ad <number>]

Добавить статический blackhole-маршрут. По умолчанию административная дистанция (параметр ad) равна 200.

Примеры:

ngfw> ip route 0.0.0.0 netmask 0.0.0.0 vrf Main blackhole
ngfw> ip route 10.0.2.3 netmask 255.255.255.0 vrf test gateway 10.0.2.4 without-interface ad 2
ngfw> ip route 192.168.0.1 netmask 240.0.0.0 vrf Main gateway 192.168.0.2 interface port2

no ip route <subnet> netmask <mask> vrf <vrf-name> (gateway <address>|interface <iface-name> (dc|gateway <address>))

Удалить статический unicast-маршрут.

no ip route <subnet> netmask <mask> vrf <vrf-name> blackhole

Удалить статический blackhole-маршрут.

show routes

Показать таблицу маршрутизации.

show routes rib all

Показать всю RIB-таблицу. Пример:

ngfw> show routes rib all
{
  "ngfw-routing:routing": {
    "rib": {
      "routes": {
        "route": [
          {
            "destination": "192.168.0.0/24",
            "vrfName": "Main",
            "protocol": "connected",
            "distance": 0,
            "metric": 0,
            "table": 254,
            "uptime": "00:00:02",
            "nexthop": [
              {
                "id": 0,
                "interfaceName": "port2",
                "flags": 3,
                "fib": true,
                "directlyConnected": true,
                "active": true
              }
            ]
          },
          {
            "destination": "0.0.0.0/0",
            "vrfName": "Management",
            "protocol": "kernel",
            "distance": 0,
            "metric": 1024,
            "table": 2,
            "uptime": "00:00:02",
            "nexthop": [
              {
                "id": 0,
                "interfaceName": "port1",
                "flags": 3,
                "fib": true,
                "directlyConnected": false,
                "ip": "10.0.2.2",
                "afi": "ipv4",
                "active": true,
                "source": "10.0.2.15"
              }
            ]
          },
          {
            "destination": "10.0.2.0/24",
            "vrfName": "Management",
            "protocol": "connected",
            "distance": 0,
            "metric": 1024,
            "table": 2,
            "uptime": "00:00:02",
            "nexthop": [
              {
                "id": 0,
                "interfaceName": "port1",
                "flags": 3,
                "fib": true,
                "directlyConnected": true,
                "active": true
              }
            ]
          },
          {
            "destination": "10.0.2.2/32",
            "vrfName": "Management",
            "protocol": "kernel",
            "distance": 0,
            "metric": 1024,
            "table": 2,
            "uptime": "00:00:02",
            "nexthop": [
              {
                "id": 0,
                "interfaceName": "port1",
                "flags": 3,
                "fib": true,
                "directlyConnected": true,
                "active": true
              }
            ]
          },
          {
            "destination": "10.0.2.3/32",
            "vrfName": "Management",
            "protocol": "kernel",
            "distance": 0,
            "metric": 1024,
            "table": 2,
            "uptime": "00:00:02",
            "nexthop": [
              {
                "id": 0,
                "interfaceName": "port1",
                "flags": 3,
                "fib": true,
                "directlyConnected": true,
                "active": true
              }
            ]
          }
        ]
      }
    }
  }
}

show routes rib destination <address> vrf (<vrf-name>|all)

Показать RIB-таблицу с фильтрацией по адресу назначения и по виртуальному маршрутизатору (Virtual Routing and Forwarding или VRF).

Примеры:

show routes rib destination 0.0.0.0 vrf all
show routes rib destination 0.0.0.0/0 vrf Main
show routes rib destination 0.0.0.0/0 vrf Management
ngfw> show routes rib destination 0.0.0.0 vrf Main
{
  "ngfw-routing:filter-by-destination": {
    "route": [
      {
        "destination": "0.0.0.0/0",
        "vrfName": "Main",
        "protocol": "static",
        "distance": 1,
        "metric": 0,
        "table": 254,
        "uptime": "00:04:39",
        "nexthop": [
          {
            "id": 0,
            "interfaceName": "port2",
            "flags": 3,
            "fib": true,
            "directlyConnected": false,
            "ip": "192.168.0.1",
            "afi": "ipv4",
            "active": true
          }
        ]
      }
    ]
  }
}

ngfw> show routes rib destination 0.0.0.0/0 vrf Main
Формат вывода аналогичен команде выше.

show routes rib longer-prefixes <address> vrf (<vrf-name>|all)

Показать RIB-таблицу с фильтрацией по адресу назначения и по VRF, при этом разрешены более длинные маски.

ngfw> show routes rib longer-prefixes 10.0.3.0/23 vrf Management
{
  "ngfw-routing:longer-prefix": {
    "route": [
      {
        "destination": "10.0.2.0/24",
        "vrfName": "Management",
        "protocol": "connected",
        "distance": 0,
        "metric": 1024,
        "table": 2,
        "uptime": "00:01:16",
        "nexthop": [
          {
            "id": 0,
            "interfaceName": "port1",
            "flags": 3,
            "fib": true,
            "directlyConnected": true,
            "active": true
          }
        ]
      },
      {
        "destination": "10.0.2.2/32",
        "vrfName": "Management",
        "protocol": "kernel",
        "distance": 0,
        "metric": 1024,
        "table": 2,
        "uptime": "00:01:16",
        "nexthop": [
          {
            "id": 0,
            "interfaceName": "port1",
            "flags": 3,
            "fib": true,
            "directlyConnected": true,
            "active": true
          }
        ]
      },
      {
        "destination": "10.0.2.3/32",
        "vrfName": "Management",
        "protocol": "kernel",
        "distance": 0,
        "metric": 1024,
        "table": 2,
        "uptime": "00:01:16",
        "nexthop": [
          {
            "id": 0,
            "interfaceName": "port1",
            "flags": 3,
            "fib": true,
            "directlyConnected": true,
            "active": true
          }
        ]
      }
    ]
  }
}

show routes rib vrf <vrf-name>

Показать RIB-таблицу с фильтрацией по VRF.

Пример:

ngfw> show routes rib vrf Main
{
  "ngfw-routing:routing": {
    "rib": {
      "routes": {
        "route": [
          {
            "destination": "192.168.0.0/24",
            "vrfName": "Main",
            "protocol": "connected",
            "distance": 0,
            "metric": 0,
            "table": 254,
            "uptime": "00:02:01",
            "nexthop": [
              {
                "id": 0,
                "interfaceName": "port2",
                "flags": 3,
                "fib": true,
                "directlyConnected": true,
                "active": true
              }
            ]
          }
        ]
      }
    }
  }
}

show routes rib interface <interface> vrf (<vrf-name>|all)

Показать RIB-таблицу с фильтрацией по имени интерфейса и по VRF.

Пример:

ngfw> show routes rib interface Ge2 vrf Main
{
  "ngfw-routing:filter-by-interface": {
    "route": [
      {
        "destination": "0.0.0.0/0",
        "vrfName": "Main",
        "protocol": "static",
        "distance": 1,
        "metric": 0,
        "table": 254,
        "uptime": "00:01:57",
        "nexthop": [
          {
            "id": 0,
            "interfaceName": "port2",
            "flags": 3,
            "fib": true,
            "directlyConnected": false,
            "ip": "192.168.0.1",
            "afi": "ipv4",
            "active": true
          }
        ]
      },
      {
        "destination": "192.168.0.0/24",
        "vrfName": "Main",
        "protocol": "connected",
        "distance": 0,
        "metric": 0,
        "table": 254,
        "uptime": "00:01:57",
        "nexthop": [
          {
            "id": 0,
            "interfaceName": "port2",
            "flags": 3,
            "fib": true,
            "directlyConnected": true,
            "active": true
          }
        ]
      }
    ]
  }
}

show routes fib all

Показать всю FIB-таблицу. Пример:

ngfw> interface port2
ngfw> interface=['port2']> protocol staticIpv4
ngfw> interface=['port2']> ip 192.168.0.1/24
ngfw> interface=['port2']> up
ngfw> interface=['port2']> exit
ngfw> commit
ngfw> ip route 0.0.0.0 netmask 0.0.0.0 vrf Main interface port2 gateway 192.168.0.1
ngfw> ip route 0.0.0.0 netmask 0.0.0.0 vrf Main interface port2 gateway 192.168.0.2
ngfw> ip route 0.0.0.0 netmask 0.0.0.0 vrf Main interface port2 gateway 192.168.0.3
ngfw> commit
ngfw> show routes fib all
{
  "ngfw-routing:routing": {
    "static": {
      "route": [
        {
          "id": "1",
          "vrfName": "Main",
          "target": "0.0.0.0",
          "netmask": "0.0.0.0",
          "gateway": "192.168.0.1",
          "interface": "port2"
        },
        {
          "id": "2",
          "vrfName": "Main",
          "target": "0.0.0.0",
          "netmask": "0.0.0.0",
          "gateway": "192.168.0.2",
          "interface": "port2"
        },
        {
          "id": "3",
          "vrfName": "Main",
          "target": "0.0.0.0",
          "netmask": "0.0.0.0",
          "gateway": "192.168.0.3",
          "interface": "port2"
        },
        {
          "id": "4",
          "vrfName": "Main",
          "target": "192.168.0.1",
          "netmask": "255.255.255.0",
          "interface": "port2"
        },
        {
          "id": "5",
          "vrfName": "Main",
          "target": "192.168.0.0",
          "netmask": "255.255.255.255"
        },
        {
          "id": "6",
          "vrfName": "Main",
          "target": "192.168.0.1",
          "netmask": "255.255.255.255",
          "gateway": "192.168.0.1",
          "interface": "port2"
        },
        {
          "id": "7",
          "vrfName": "Main",
          "target": "192.168.0.255",
          "netmask": "255.255.255.255"
        }
      ]
    }
  }
}

show routes fib destination <address> vrf (<vrf-name>|all)

Показать FIB-таблицу с фильтрацией по адресу назначения и по VRF.

Примеры:

ngfw> show routes fib destination 10.0.3.1 vrf all
ngfw> show routes fib destination 10.0.3.1/24 vrf Main

Формат вывода аналогичен команде show routes fib all.

show routes fib interface <interface> vrf (<vrf-name>|all)

Показать FIB-таблицу с фильтрацией по имени интерфейса и по VRF.

Пример:

ngfw> show routes fib interface port2 vrf all

Формат вывода аналогичен команде show routes fib all.

show routes fib vrf <vrf-name>

Показать FIB-таблицу с фильтрацией по VRF.

Пример:

ngfw> show routes fib vrf Main

Формат вывода аналогичен команде show routes fib all.

show routes config

Показать конфигурацию статических маршрутов.

Пример:

ngfw> show routes config
{
  "ngfw-routing:routing": {
    "static": {
      "route": [
        {
          "id": "65d5d134-032b-456d-ab95-910f5e66368b",
          "vrfName": "test",
          "target": "0.0.0.0",
          "netmask": "0.0.0.0",
          "interface": "port5",
          "type": "unicast",
          "ad": 1,
          "nextHopVrf": "test"
        }
      ]
    }
  }
}

| Prev | Home | Next |