Настройка маршрутизации между подсетями

Маршрутизация между нашими подсетями в Windows

С чем обязательно придётся столкнуться при сопряжении разных подсетей – это маршрутизация. Ох, сколько раз я задумчиво чесал затылок не понимая, почему узел назначения оставался недоступным. Ну чтож, попробуем это чётко спланировать, чтобы не ошибиться.

Я немного перерисовал исходную схему, чтобы было понятно, как будет проходить маршрутизация и какой интерфейс с каким адресом. Вот план нашей задачи (немного преобразованый):

Настройка маршрутизации между подсетями

Подпишу сетевые интерфейсы:

  1. 192.168.10.2/24
  2. 192.168.10.1/24
  3. 10.0.0.10/24
  4. 10.0.0.20/24
  5. 192.168.20.1/24
  6. 192.168.20.2/24

Всё просто. Шлюзы внутри с адресом .1, снаружи – по номеру подсети .10 – 10-ая подсеть, .20 – 20-ая подсеть. А хосты с адресом .2. Думаю, с этим вопросов не возникло. Чтож, проверим маршрутизацию сейчас. Для этого с каждого узла пропингуем все остальные хосты.

Настройка маршрутизации между подсетями

Доступность узлов в сети

Настройка маршрутизации между подсетями

Как мы видим, доступность есть только у узлов, непосредственно связанных виртуальным сетевым кабелем. Будем это исправлять!

Маршруты будем добавлять с помощью команды ROUTE командной строки. Что нам нужно добавить? Смотрим в табличку и добавляем те назначения, которые мы НЕ видим. И прописываем тот узел, который является следующим шагом для пакета на этом пути. Вот подробности:

  • Для HOST:
    1. назначение – 10.0.0.0/24 направляем на 192.168.10.1
    2. назначение – 192.168.20.0/24 направляем на 192.168.10.1
  • Для SERV:
    1. назначение – 192.168.20.0/24 направляем на 10.0.0.20
  • Для MAIN:
    1. назначение – 192.168.10.0/24 направляем на 10.0.0.10
  • Для ADMIN:
    1. назначение – 192.168.10.0/24 направляем на 192.168.20.1
    2. назначение – 10.0.0.0/24 направляем на 192.168.20.1

Прописываем маршруты Route

Как добавляются маршруты для рабочих станций? Утилита

Синтаксис примерно такой:

route add <network> MASK <mask> <gateway>

  • – адрес сети назначения
  • – маска сети назначения
  • – узел, на который нужно передать пакет для дальнейшего разбирательства. (следующий пункт)

Покажем на примере. Узел . Передавать пакеты на узел . Пробуем послать ping, пакеты не доходят. (см. скриншот выше). Почему? Да потому что наш компьютер не знает, куда передавать пакеты в неизвестную подсеть (узел 10.0.0.10). Это не наша подсеть, поэтому теряемся в догадках.

Задача маршрутизации – обеспечить передачу пакетов в другие сети. Если бы у нас был установлен основной шлюз (default gateway), то все пакеты с неизвестным адресом сети назначения передавались бы именно на него “Пусть сами разбираются”, но такой параметр у нас не указан.

Итак, настраиваем узел host.

route add 10.0.0.0 mask 255.0.0.0 192.168.10.1

Все пакеты, адрес назначения которых стоит “подсеть 10.0.0.0/8” будут отправляться на 192.168.10.1. Что происходит при этом на 192.168.10.1? 192.168.10.1 – это узел , который имеет второй сетевой интерфейс 10.0.0.10. Пакеты на этот интерфейс, посланные с host – дойдут без проблем, так как маршрут до узла мы прописали.

Вот такая занимательная маршрутизация. Итак, маршрут до 10.0.0.10 у нас есть. Сделаем аналогичным образом маршруты до подсети 192.168.20.0/24. Всё-всё-всё посылаем на 192.168.10.1 (так как – это наш единственный “выход” с узла host).

Пришла пора настраивать узел , который стал полновесным маршрутизатором.

Идём в управление сервером и смотрим, чтобы была установлена роль “Маршрутизация и удалённый доступ” (Routing and remote access). Если всё ОК, входим в “Администрирование” в эту оснастку.

Маршрутизация и удалённый доступ в Windows Server 2003

Настройка маршрутизации между подсетями

Настройка маршрутизации между подсетями

Или устанавливаем её. Для этого отключаем службу Windows Firewall

Настройка маршрутизации между подсетями

После добавления роли “Маршрутизация и удалённый доступ” мы видим следующую оснастку. Открываем конфигурирование.

Настройка маршрутизации между подсетями

Начинаем конфигурирование. Настраивать будем всё вручную, чтобы лучше разобраться в маршрутизации.

Настройка маршрутизации между подсетями

А в этом окне мастера настройки маршрутизации и удалённого доступа выбираем “маршрутизацию между сетями”. Как раз то, что нужно.

Настройка маршрутизации между подсетями

И у нас появилось вот такое дерево в консоли MMC. Интересует нас “статические маршруты”.

Настройка маршрутизации между подсетями

Настройка маршрутизации между подсетями

Подобную ситуцию сделаем и на

Настройка маршрутизации между подсетями

В общем виде – то же самое. Указываем “ОТКУДА”, “КУДА” и “КУДА ПОСЫЛАТЬ”. На метрику внимания не обращаем, это для приоретизации одних маршрутов перед другими, когда из одной точки можно добраться в другую разными путями.

Маршруты настроили. Простая проверка PING доказывает. Все узлы доступны друг для друга!

Настройка маршрутизации между подсетями
Друзья! Вступайте в нашу группу Вконтакте, чтобы не пропустить новые статьи! Хотите сказать спасибо? Ставьте Like, делайте репост! Это лучшая награда для меня от вас! Так я узнаю о том, что статьи подобного рода вам интересны и пишу чаще и с большим энтузиазмом!


Настройка маршрутизации между подсетями

Что такое маршрутизация

Вся цифровая информация передаётся по сети в виде пакетов данных. По пути от отправителя к адресату они проходят через цепочку промежуточных устройств – маршрутизаторов (роутеров) и/или соответственно настроенных компьютеров.

Маршрутизация – это процесс определения пути (сетевого маршрута) для установки соединения между хост-устройствами. Этот путь настраивается как внутри локального устройства, так и на маршрутизаторе.

Построение сетевого маршрута происходит на основе информации из таблиц маршрутизации. Для их формирования применяются протоколы маршрутизации или инструкции сетевого администратора.

Каждая таблица содержит ряд параметров, позволяющих правильно идентифицировать и читать сетевой маршрут. Таблица содержит минимум 5 разделов:

  • Destination (Target). IP-адрес сети назначения – конечной цели для передаваемых данных.
  • Netmask (Genmask). Маска сети.
  • Gateway. IP-адрес шлюза, через который можно добраться до цели.
  • Interface. Адрес сетевого интерфейса, по которому доступен шлюз.
  • Metric. Числовой показатель, задающий предпочтительность маршрута.

Опционально в таблице также может содержаться следующая информация:

  • адрес отправителя (source);
  • размер TCP-окна (window);
  • максимальная величина пакета (MSS) и типы записей.

Как посмотреть таблицу маршрутизации

Таблицу маршрутизации в Linux (например, в популярных серверных ОС типа Ubuntu или CentOS) можно посмотреть с помощью нескольких команд.

Команда route

Программа используется для настройки параметров статической маршрутизации. Просмотр таблицы можно осуществить с помощью команды:

route -n

Настройка маршрутизации между подсетями

Команда netstat

Утилита используется для сбора информации о состоянии сетевых соединений. Вывести таблицу можно с помощью команды:

netstat -r

Построение таблицы маршрутизации

Существует несколько основных утилит для настройки таблицы маршрутизации (добавления, обновления, удаления старых и новых маршрутов):

  • Route. Устаревшая утилита, входящая в состав пакета net-tools. Служит для отображения таблицы маршрутизации и построения статических маршрутов.
  • IP Route. Обновленный инструмент, призванный заменить Route. Имеет большую функциональность, по сравнению со своим предшественником.

Оба инструмента могут использоваться для выполнения аналогичных задач. Далее будет рассмотрен синтаксис каждого в пределе основных возможностей.

Команда имеет следующий вид:

route [-f] [-p] command -net [destination] netmask [MASK netmask] gw [gateway] metric [METRIC metric] dev [IF interface]

Ключи

  • -f – очистка таблиц от записей всех шлюзов.
  • -p – сохранение маршрута в качестве постоянного при использовании ADD. По умолчанию все маршруты временные и после перезагрузки системы сбрасываются.

Основные опции (command)

  • add – добавление маршрута.
  • del – удаление маршрута.
  • replace – замена маршрута.
  • change – изменение или настройка параметров маршрута.

Обозначения

  • [destination] – адрес сети назначения.
  • [MASK netmask] – маска подсети.
  • [gateway] – адрес шлюза.
  • [METRIC metric] – числовой показатель, задающий предпочтительность маршрута (используется в том случае, если устройство является маршрутизатором).
  • [IF interface] – сетевой интерфейс.

Опции для указания вводных данных

  • -net – целевая сеть.
  • -host – целевой хост.
  • gw – шлюз (Gateway).
  • dev – сетевой интерфейс.
  • netmask – маска подсети.
  • metric – метрика.

IP Route

Команда имеет следующий вид:

ip route command [destination] netmask [MASK netmask] via [gateway] metric [METRIC metric] dev [IF interface]

Основные опции (command)

  • add – добавление маршрута.
  • del – удаление маршрута.
  • replace – замена маршрута.
  • change – изменение или настройка параметров маршрута.

Обозначения

  • [destination] – адрес сети назначения.
  • [MASK netmask] – маска подсети.
  • [gateway] – адрес шлюза.
  • [METRIC metric] – числовой показатель, задающий предпочтительность маршрута (используется в том случае, если устройство является маршрутизатором).
  • [IF interface] – сетевой интерфейс.

Опции для указания вводных данных

  • via – используется в значении «через» для указания шлюза.
  • dev – сетевой интерфейс.
  • netmask – маска подсети.
  • metric – метрика.

Примеры статической маршрутизации

Составление нового маршрута

Можно представить два офиса: A и B. В каждом стоят маршрутизаторы на Linux, которые соединены между собой IP-IP туннелем.

Настройка маршрутизации между подсетями

Чтобы подключение к локальной сеть маршрутизатора A стало возможным из локальной сети маршрутизатора B и наоборот, нужно прописать на маршрутизаторе B:

route add -net 172.16.10.0/24 gw 192.168.1.1

Будет произведена установка шлюза «192.168.1.1» для сети «172.16.10.0/24».

Также необходимо прописать на маршрутизаторе A обратный маршрут в локальную сеть маршрутизатора B:

route add -net 172.20.0.0/24 gw 192.168.1.2

Изменение локальной сети

В случае изменения локальной сети маршрутизатора B, необходимо удалить старую запись:

route del -net 172.20.0.0/24 gw 192.168.1.2

А после добавить новый маршрут на маршрутизаторе А:

route add -net 172.20.0.0/24 gw 192.168.1.2

Настройка маршрутизации между подсетями

Изменение адреса тоннеля

ip route replace 172.16.10.0/24 via 192.168.1.3

После выполнения команды адрес шлюза для подсети «172.16.10.0/24» будет изменён.

Настройка маршрутизации между подсетями

Изменение провайдера

Чтобы перенаправить трафик через другого провайдера («ISP2»), следует изменить маршрут «по умолчанию» («default»):

ip route replace default via 5.215.98.7

Настройка маршрутизации между подсетями

Маршрутизация в WindowsМаршрутизация в Windows
Маршрутизация – это процесс передачи IP-трафика адресатам в сети, то есть процесс передачи пакетов от хоста-источника к  хосту-адресату через промежуточные маршрутизаторы. Изучая эту статью предполагается что вы изучили материал основы компьютерных сетей.

Изучим как работает маршрутизация в Windows, что бы понять как она работает, а не просто прочитать и забыть, вам необходимо несколько виртуальных машин, а именно:

  • ВМ с Windows XP.
  • 2 ВМ с Windows Server 2003.

Учтите, что при настройке виртуальных машин, в настройках сети нужно указать «Внутренняя сеть» и задать одинаковое имя сети для всех машин.

Если вы не поленитесь и установите три виртуальные машины, а так же изучите этот материал до конца, то у вас будет практическое понимание работы сети в операционных системах семейства Windows.

Для простоты передачи данных хост-источник и маршрутизатор принимают решения о передаче пакетов на основе своих таблиц IP-маршрутизации. Записи таблицы создаются при помощи:

  1. Программного обеспечения стека TCP/IP.
  2. Администратора, путем конфигурирования статических маршрутов.
  3. Протоколов маршрутизации, одним из которых является протокол передачи маршрутной информации – RIP.

Пример маршрутизации в Windows

Допустим, у нас есть три узла:

  • Windows XP.
  • Windows Server 2003 – 1.
  • Windows Server 2003 – 2.

Схема сети

Таблица маршрутизации

Таблица маршрутизации по умолчанию создается на узле автоматически с помощью программного обеспечения стека TCP/IP.

Что бы просмотреть таблицы маршрутизации на узле XP выполним команду route print в командной строке (Пуск -> Выполнить -> cmd).

Простая таблица маршрутизации

Таблица маршрутизации содержит для каждой записи следующие поля: Сетевой адрес (Network Destination), Маска сети (Netmask), Адрес шлюза (Gateway), Интерфейс (Interface) и Метрика (Metric). Разберем каждое поле подробнее.

Интерфейс. Данное поле содержит адрес логического или физического интерфейса, используемого для продвижения пакетов, соответствующих данной записи таблицы маршрутизации.

Метрика. Используется для выбора маршрута, в случае если имеется несколько записей, которые соответствуют одному адресу назначения с одной и той же маской, то есть в случае если одного адресата можно достичь разными путями, через разные маршруты. При этом, чем меньше значение метрики тем короче маршрут.

На начальном этапе работы (т.е. с таблицами маршрутизации по умолчанию) маршрутизатор (хост) знает только, как достичь сетей, с которыми он соединен непосредственно. Пути в другие сети могут быть «выяснены» следующими способами:

  • с помощью статических маршрутов;
  • с помощью маршрутов по умолчанию;
  • с помощью маршрутов, определенных протоколами динамической маршрутизации.

Рассмотрим каждый из способов по порядку.

Статическая маршрутизация

Статические маршруты задаются вручную. Плюс статических маршрутов в том, что они не требуют рассылки широковещательных пакетов с маршрутной информацией, которые занимают полосу пропускания сети.

Минус статических маршрутов состоит в том, что при изменении топологии сети администратор должен вручную изменить все статические маршруты, что довольно трудоемко, в случае если сеть имеет сложную структуру с большим количеством узлов.

Второй минус заключается в том, что при отказе какого-либо канала статический маршрут перестанет работать, даже если будут доступны другие каналы передачи данных, так как для них не задан статический маршрут.

Но вернемся к нашему примеру. Наша задача, имя исходные данные, установить соединения между хостом XP и Server2 который находится в сети Net3, то есть нужно что бы проходил пинг на 192.168.2.1.

Начнем выполнять на хосте XP команды ping постепенно удаляясь от самого хоста. Выполните в Командной строке команды ping для адресов 192.168.0.2, 192.168.0.1, 192.168.1.1.

Мы видим, что команды ping по адресу собственного интерфейса хоста XP и по адресу ближайшего интерфейса соседнего маршрутизатора Server1 выполняются успешно.

Пинг узла на себя

Пинг на Server1

Однако при попытке получить ответ от второго интерфейса маршрутизатора Server1 выводится сообщение «Заданный узел недоступен» или «Превышен интервал ожидания для запроса».

Пинг на сервер 2

Это связано с тем, что в таблице маршрутизации по умолчанию хоста XP имеются записи о маршруте к хосту 192.168.0.2 и о маршруте к сети 192.168.0.0, к которой относится интерфейс маршрутизатора Server1 с адресом 192.168.0.1. Но в ней нет записей ни о маршруте к узлу 192.168.1.1, ни о маршруте к сети 192.168.1.0.

Добавим в таблицу маршрутизации XP запись о маршруте к сети 192.168.1.0. Для этого введем команду route add с необходимыми параметрами:

Параметры команды имеют следующие значения:

  • адресат — адрес сети или хоста, для которого добавляется маршрут;
  • mask — если вводится это ключевое слово, то следующий параметр интерпретируется как маска подсети, соответственно маска — значение маски;
  • шлюз — адрес шлюза;
  • metric — после этого ключевого слова указывается метрика маршрута до адресата (метрика);
  • if — после этого ключевого слова указывается индекс интерфейса, через который будут направляться пакеты заданному адресату.

Индекс интерфейса можно определить из секции Список интерфейсов (Interface List) выходных данных команды route print.

Выполним команду route print.
Команда route print

Теперь мы видим , что хост XP имеет два интерфейса: логический интерфейс замыкания на себя (Loopback) и физический интерфейс с сетевым адаптером Intel(R) PRO/1000. Индекс физического интерфейса – 0x2.

Теперь, зная индекс физического интерфейса, на хосте добавьте нужный маршрут, выполнив следующую команду:

route add 192.168.1.0 mask 255.255.255.0 192.168.0.1 metric 2 if 0x2

Данная команда сообщает хосту XP о том, что для того, чтобы достичь сети 192.168.1.0 с маской 255.255.255.0, необходимо использовать шлюз 192.168.0.1 и интерфейс с индексом 0x2, причем сеть 192.168.1.0 находится на расстоянии двух транзитных участка от хоста XP.

Выполним пинг на 192.168.1.1 и убедимся, что связь есть.

Получаем сообщение «Превышен интервал ожидания запроса». В данном случае это означает что наш хост XP знает как отправлять данные адресату, но он не получает ответа.

Это происходит по тому, что хост Server2 не имеет информации о маршруте до хоста 192.168.0.1 и до сети 192.168.0.0 соответственно, поэтому он не может отправить ответ.

Для этого необходимо выполнить команду route add с соответствующими параметрами, однако сначала необходимо узнать индекс интерфейса с адресом 192.168.1.2.

На Server2 выполним команду route print и посмотрим индекс первого физического интерфейса. Далее, с помощью команды route add добавьте на Server2 маршрут до сети Net1, аналогично тому, как мы добавляли маршрут хосту XP.
В моем случае это команда:

:/>  Как запустить новый экземпляр в powershell

route add 192.168.0.0 mask 255.255.255.0 192.168.1.1 metric 2 if 0x10003

0x10003 — это индекс физического интерфейса сервера 2.

Индекс физического интерфейса

Индекс физического интерфейса может быть разным, обязательно обращайте на него внимание.

Вместо ответа вы получите сообщение «Заданный узел недоступен». С этой проблемой мы сталкивались еще в самом начале лабораторной работы, машина XP не знает путей до сети 192.168.2.0.

Добавьте в таблицу маршрутизации хоста XP запись о маршруте к сети 192.168.2.0. Это можно сделать путем ввода в командной строке хоста XP команды route add с соответствующими параметрами:

route add 192.168.2.0 mask 255.255.255.0 192.168.0.1 metric 3 if 0x2

Я не буду подробно описывать как полностью настроить статическую маршрутизацию между узлами, думаю что суть ясна. Если у вас появились вопросы — задавайте их в комментариях.

Маршрутизация по умолчанию

Второй способ настройки маршрутизации в Windows — то маршрутизация по умолчанию.

Для маршрутизации по умолчанию необходимо задать на всех узлах сети маршруты по умолчанию.

Для добавления такого маршрута на хосте XP выполните следующую команду:

route add 0.0.0.0 mask 0.0.0.0 192.168.0.1 metric 2 if 0x10003

Эта команда сообщает хосту XP о том, что для того, чтобы достичь любой сети, маршрут к которой отсутствует в таблице маршрутизации, необходимо использовать шлюз 192.168.0.1 и интерфейс с индексом 0x10003.

Это так называемый маршрут по умолчанию.

Проверьте работоспособность с помощью команды ping.

Динамическая маршрутизация, протокол RIP

Протокол RIP (Routing Information Protocol или Протокол передачи маршрутной информации) является одним из самых распространенных протоколов динамической маршрутизации.

Его суть заключается в том, что маршрутизатор использующий RIP передает во все подключенные к нему сети содержимое своей таблицы маршрутизации и получает от соседних маршрутизаторов их таблицы.

Есть две версии протокола RIP. Версия 1 не поддерживает маски, поэтому между сетями распространяется только информация о сетях и расстояниях до них. При этом для корректной работы RIP на всех интерфейсах всех маршрутизаторов составной сети должна быть задана одна и та же маска.

Протокол RIP полностью поддерживается только серверной операционной системой, тогда как клиентская операционная система (например, Windows XP) поддерживает только прием маршрутной информации от других маршрутизаторов сети, а сама передавать маршрутную информацию не может.

Настраивать RIP можно двумя способами:

  • В графическом режиме с помощью оснастки “Маршрутизация и удаленный доступ”.
  • В режиме командной строки с помощью утилиты netsh.

Рассмотрим настройку в режиме командной строки с помощью утилиты netsh.

Netsh – это утилита командной строки и средство выполнения сценариев для сетевых компонентов операционных систем семейства Windows (начиная с Windows 2000).

Введите в командной строке команду netsh, после появления netsh> введите знак вопроса и нажмите Enter, появиться справка по команде.

Введите последовательно команды:

  1. routing
  2. rip

Вы увидите, что среди доступных команд этого контекста есть команда add interface, позволяющая настроить RIP на заданном интерфейсе. Простейший вариант этой команды – add interface «Имя интерфейса».

Если ввести в Windows XP в контексте netsh routing ip rip команду add interface "Net1", то получим сообщение «RIP должен быть установлен первым». Дело в том, что Установить RIP можно только в серверной операционной системе. В Windows Server 2003 в RIP включается в оснастке «Маршрутизация и удаленный доступ» (Пуск –> Программы –> Администрирование –> Маршрутизация и удаленный доступ). Таким образом, включить RIP в нашем случае можно только на маршрутизаторах Server1 и Server2.

Настроим RIP на Server1. Но сначала нужно выключит брандмауэр.

Теперь в оснастке «Маршрутизация и удаленный доступ» в контекстном меню пункта SERVER1 (локально) выберите пункт «Настроить и включить Маршрутизация ЛВСНастроить и включить маршрутизацию и удаленный доступмаршрутизацию и удаленный доступ».

В появившемся окне мастера нажмите «Далее».
Мастер установки сервера и удаленной маршрутизации

На следующем этапе выберите «Особая конфигурация» и нажмите «Далее».
Особая конфигурация

После чего нужно выбрать «Маршрутизация ЛВС» и завершить работу мастера.
Маршрутизация ЛВС

То же самое нужно выполнить на Server2.

Настройка через оснастку

В контекстном меню вкладки «Общие» (SERVER1 –> IP-маршрутизация –> Общие) нужно выбрать пункт «Новый протокол маршрутизации».

Новый протокол маршрутизации

Затем выделяем строку «RIP версии 2 для IP».
RIP версии 2 для IP
В контекстном меню появившейся вкладки «RIP» выберите «Новый интерфейс». Выделите строку «Подключение по локальной сети» и нажмите ОК.
Новый интерфейс RIP
Перед вами появиться окно.
Свойства интерфейса RIP

В появившемся окне необходимо задать следующие настройки:

  • Режим работы –> Режим периодического обновления.
  • Протокол для исходящих пакетов –> Для RIP версии 1.
  • Протокол входящих пакетов –> Только для RIP версии 1.

Оставьте оставшиеся настройки по умолчанию и нажмите ОК.

Далее необходимо выполнить эти действия для второго сетевого интерфейса.

После выполните те же действия для Sever2.

Проверьте, с помощью команды ping, работу сети.

Проверка работы сет ping

Поздравляю! Маршрутизация в Windows изучена.

Provided by: net-tools_1.60-25ubuntu2_amd64 bug

NAME

 route - show / manipulate the IP routing table

SYNOPSIS

 route [-CFvnee] route [-v] [-A family] add [-net|-host] target [netmask Nm] [gw Gw] [metric N] [mss M] [window W] [irtt I] [reject] [mod] [dyn] [reinstate] [[dev] If] route [-v] [-A family] del [-net|-host] target [gw Gw] [netmask Nm] [metric N] [[dev] If] route [-V] [--version] [-h] [--help]

DESCRIPTION

 Route manipulates the kernel's IP routing tables. Its primary use is to set up static routes to specific hosts or networks via an interface after it has been configured with the ifconfig(8) program. When the add or del options are used, route modifies the routing tables. Without these options, route displays the current contents of the routing tables.

OPTIONS

 -A family use the specified address family (eg `inet'; use `route --help' for a full list). -F operate on the kernel's FIB (Forwarding Information Base) routing table. This is the default. -C operate on the kernel's routing cache. -v select verbose operation. -n show numerical addresses instead of trying to determine symbolic host names. This is useful if you are trying to determine why the route to your nameserver has vanished. -e use netstat(8)-format for displaying the routing table. -ee will generate a very long line with all parameters from the routing table. del delete a route. add add a new route. target the destination network or host. You can provide IP addresses in dotted decimal or host/network names. -net the target is a network. -host the target is a host. netmask NM when adding a network route, the netmask to be used. gw GW route packets via a gateway. NOTE: The specified gateway must be reachable first. This usually means that you have to set up a static route to the gateway beforehand. If you specify the address of one of your local interfaces, it will be used to decide about the interface to which the packets should be routed to. This is a BSDism compatibility hack. metric M set the metric field in the routing table (used by routing daemons) to M. mss M set the TCP Maximum Segment Size (MSS) for connections over this route to M bytes. The default is the device MTU minus headers, or a lower MTU when path mtu discovery occurred. This setting can be used to force smaller TCP packets on the other end when path mtu discovery does not work (usually because of misconfigured firewalls that block ICMP Fragmentation Needed) window W set the TCP window size for connections over this route to W bytes. This is typically only used on AX.25 networks and with drivers unable to handle back to back frames. irtt I set the initial round trip time (irtt) for TCP connections over this route to I milliseconds (1-12000). This is typically only used on AX.25 networks. If omitted the RFC 1122 default of 300ms is used. reject install a blocking route, which will force a route lookup to fail. This is for example used to mask out networks before using the default route. This is NOT for firewalling. mod, dyn, reinstate install a dynamic or modified route. These flags are for diagnostic purposes, and are generally only set by routing daemons. dev If force the route to be associated with the specified device, as the kernel will otherwise try to determine the device on its own (by checking already existing routes and device specifications, and where the route is added to). In most normal networks you won't need this. If dev If is the last option on the command line, the word dev may be omitted, as it's the default. Otherwise the order of the route modifiers (metric - netmask - gw - dev) doesn't matter.

EXAMPLES

 route add -net 127.0.0.0 netmask 255.0.0.0 dev lo adds the normal loopback entry, using netmask 255.0.0.0 and associated with the "lo" device (assuming this device was previously set up correctly with ifconfig(8)). route add -net 192.56.76.0 netmask 255.255.255.0 dev eth0 adds a route to the local network 192.56.76.x via "eth0". The word "dev" can be omitted here. route del default deletes the current default route, which is labeled "default" or 0.0.0.0 in the destination field of the current routing table. route add default gw mango-gw adds a default route (which will be used if no other route matches). All packets using this route will be gatewayed through "mango-gw". The device which will actually be used for that route depends on how we can reach "mango-gw" - the static route to "mango-gw" will have to be set up before. route add ipx4 sl0 Adds the route to the "ipx4" host via the SLIP interface (assuming that "ipx4" is the SLIP host). route add -net 192.57.66.0 netmask 255.255.255.0 gw ipx4 This command adds the net "192.57.66.x" to be gatewayed through the former route to the SLIP interface. route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0 This is an obscure one documented so people know how to do it. This sets all of the class D (multicast) IP routes to go via "eth0". This is the correct normal configuration line with a multicasting kernel. route add -net 10.0.0.0 netmask 255.0.0.0 reject This installs a rejecting route for the private network "10.x.x.x."

OUTPUT

 The output of the kernel routing table is organized in the following columns Destination The destination network or destination host. Gateway The gateway address or '*' if none set. Genmask The netmask for the destination net; '255.255.255.255' for a host destination and '0.0.0.0' for the default route. Flags Possible flags include U (route is up) H (target is a host) G (use gateway) R (reinstate route for dynamic routing) D (dynamically installed by daemon or redirect) M (modified from routing daemon or redirect) A (installed by addrconf) C (cache entry) ! (reject route) Metric The 'distance' to the target (usually counted in hops). It is not used by recent kernels, but may be needed by routing daemons. Ref Number of references to this route. (Not used in the Linux kernel.) Use Count of lookups for the route. Depending on the use of -F and -C this will be either route cache misses (-F) or hits (-C). Iface Interface to which packets for this route will be sent. MSS Default maximum segment size for TCP connections over this route. Window Default window size for TCP connections over this route. irtt Initial RTT (Round Trip Time). The kernel uses this to guess about the best TCP protocol parameters without waiting on (possibly slow) answers. HH (cached only) The number of ARP entries and cached routes that refer to the hardware header cache for the cached route. This will be -1 if a hardware address is not needed for the interface of the cached route (e.g. lo). Arp (cached only) Whether or not the hardware address for the cached route is up to date.

FILES

 /proc/net/ipv6_route /proc/net/route /proc/net/rt_cache

SEE ALSO

 ifconfig(8), netstat(8), arp(8), rarp(8)

HISTORY

 Route for Linux was originally written by Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> and then modified by Johannes Stille and Linus Torvalds for pl15. Alan Cox added the mss and window options for Linux 1.1.22. irtt support and merged with netstat from Bernd Eckenfels.

AUTHOR

 Currently maintained by Phil Blundell <Philip.Blundell@pobox.com> and Bernd Eckenfels <net-tools@lina.inka.de>.

Provided by: net-tools_1.60+git20161116.90da8a0-1ubuntu1_amd64 bug

NAME

 route - show / manipulate the IP routing table

SYNOPSIS

 route [-CFvnNee] [-A family |-4|-6] route [-v] [-A family |-4|-6] add [-net|-host] target [netmask Nm] [gw Gw] [metric N] [mss M] [window W] [irtt I] [reject] [mod] [dyn] [reinstate] [[dev] If] route [-v] [-A family |-4|-6] del [-net|-host] target [gw Gw] [netmask Nm] [metric M] [[dev] If] route [-V] [--version] [-h] [--help]

DESCRIPTION

 Route manipulates the kernel's IP routing tables. Its primary use is to set up static routes to specific hosts or networks via an interface after it has been configured with the ifconfig(8) program. When the add or del options are used, route modifies the routing tables. Without these options, route displays the current contents of the routing tables.

OPTIONS

 -A family use the specified address family (eg `inet'). Use route --help for a full list. You can use -6 as an alias for --inet6 and -4 as an alias for -A inet -F operate on the kernel's FIB (Forwarding Information Base) routing table. This is the default. -C operate on the kernel's routing cache. -v select verbose operation. -n show numerical addresses instead of trying to determine symbolic host names. This is useful if you are trying to determine why the route to your nameserver has vanished. -e use netstat(8)-format for displaying the routing table. -ee will generate a very long line with all parameters from the routing table. del delete a route. add add a new route. target the destination network or host. You can provide an addresses or symbolic network or host name. Optionally you can use /prefixlen notation instead of using the netmask option. -net the target is a network. -host the target is a host. netmask NM when adding a network route, the netmask to be used. gw GW route packets via a gateway. NOTE: The specified gateway must be reachable first. This usually means that you have to set up a static route to the gateway beforehand. If you specify the address of one of your local interfaces, it will be used to decide about the interface to which the packets should be routed to. This is a BSDism compatibility hack. metric M set the metric field in the routing table (used by routing daemons) to M. If this option is not specified the metric for inet6 (IPv6) address family defaults to '1', for inet (IPv4) it defaults to '0'. You should always specify an explicit metric value to not rely on those defaults - they also differ from iproute2. mss M sets MTU (Maximum Transmission Unit) of the route to M bytes. Note that the current implementation of the route command does not allow the option to set the Maximum Segment Size (MSS). window W set the TCP window size for connections over this route to W bytes. This is typically only used on AX.25 networks and with drivers unable to handle back to back frames. irtt I set the initial round trip time (irtt) for TCP connections over this route to I milliseconds (1-12000). This is typically only used on AX.25 networks. If omitted the RFC 1122 default of 300ms is used. reject install a blocking route, which will force a route lookup to fail. This is for example used to mask out networks before using the default route. This is NOT for firewalling. mod, dyn, reinstate install a dynamic or modified route. These flags are for diagnostic purposes, and are generally only set by routing daemons. dev If force the route to be associated with the specified device, as the kernel will otherwise try to determine the device on its own (by checking already existing routes and device specifications, and where the route is added to). In most normal networks you won't need this. If dev If is the last option on the command line, the word dev may be omitted, as it's the default. Otherwise the order of the route modifiers (metric netmask gw dev) doesn't matter.

EXAMPLES

 route add -net 127.0.0.0 netmask 255.0.0.0 metric 1024 dev lo adds the normal loopback entry, using netmask 255.0.0.0 and associated with the "lo" device (assuming this device was previously set up correctly with ifconfig(8)). route add -net 192.56.76.0 netmask 255.255.255.0 metric 1024 dev eth0 adds a route to the local network 192.56.76.x via "eth0". The word "dev" can be omitted here. route del default deletes the current default route, which is labeled "default" or 0.0.0.0 in the destination field of the current routing table. route del -net 192.56.76.0 netmask 255.255.255.0 deletes the route. Since the Linux routing kernel uses classless addressing, you pretty much always have to specify the netmask that is same as as seen in 'route -n' listing. route add default gw mango adds a default route (which will be used if no other route matches). All packets using this route will be gatewayed through the address of a node named "mango". The device which will actually be used for that route depends on how we can reach "mango" - "mango" must be on directly reachable route. route add mango sl0 Adds the route to the host named "mango" via the SLIP interface (assuming that "mango" is the SLIP host). route add -net 192.57.66.0 netmask 255.255.255.0 gw mango This command adds the net "192.57.66.x" to be gatewayed through the former route to the SLIP interface. route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0 This is an obscure one documented so people know how to do it. This sets all of the class D (multicast) IP routes to go via "eth0". This is the correct normal configuration line with a multicasting kernel. route add -net 10.0.0.0 netmask 255.0.0.0 metric 1024 reject This installs a rejecting route for the private network "10.x.x.x." route -6 add 2001:0002::/48 metric 1 dev eth0 This adds a IPv6 route with the specified metric to be directly reachable via eth0.

OUTPUT

 The output of the kernel routing table is organized in the following columns Destination The destination network or destination host. Gateway The gateway address or '*' if none set. Genmask The netmask for the destination net; '255.255.255.255' for a host destination and '0.0.0.0' for the default route. Flags Possible flags include U (route is up) H (target is a host) G (use gateway) R (reinstate route for dynamic routing) D (dynamically installed by daemon or redirect) M (modified from routing daemon or redirect) A (installed by addrconf) C (cache entry) ! (reject route) Metric The 'distance' to the target (usually counted in hops). Ref Number of references to this route. (Not used in the Linux kernel.) Use Count of lookups for the route. Depending on the use of -F and -C this will be either route cache misses (-F) or hits (-C). Iface Interface to which packets for this route will be sent. MSS Default maximum segment size for TCP connections over this route. Window Default window size for TCP connections over this route. irtt Initial RTT (Round Trip Time). The kernel uses this to guess about the best TCP protocol parameters without waiting on (possibly slow) answers. HH (cached only) The number of ARP entries and cached routes that refer to the hardware header cache for the cached route. This will be -1 if a hardware address is not needed for the interface of the cached route (e.g. lo). Arp (cached only) Whether or not the hardware address for the cached route is up to date.

FILES

 /proc/net/ipv6_route /proc/net/route /proc/net/rt_cache

SEE ALSO

 ifconfig(8), netstat(8), arp(8), rarp(8), ip(8)

HISTORY

 Route for Linux was originally written by Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> and then modified by Johannes Stille and Linus Torvalds for pl15. Alan Cox added the mss and window options for Linux 1.1.22. irtt support and merged with netstat from Bernd Eckenfels.

AUTHOR

 Currently maintained by Phil Blundell <Philip.Blundell@pobox.com> and Bernd Eckenfels <net-tools@lina.inka.de>.

Provided by: net-tools_1.60-26ubuntu1_amd64 bug

NAME

 route - show / manipulate the IP routing table

SYNOPSIS

 route [-CFvnee] route [-v] [-A family] add [-net|-host] target [netmask Nm] [gw Gw] [metric N] [mss M] [window W] [irtt I] [reject] [mod] [dyn] [reinstate] [[dev] If] route [-v] [-A family] del [-net|-host] target [gw Gw] [netmask Nm] [metric N] [[dev] If] route [-V] [--version] [-h] [--help]

DESCRIPTION

 Route manipulates the kernel's IP routing tables. Its primary use is to set up static routes to specific hosts or networks via an interface after it has been configured with the ifconfig(8) program. When the add or del options are used, route modifies the routing tables. Without these options, route displays the current contents of the routing tables.

OPTIONS

 -A family use the specified address family (eg `inet'; use `route --help' for a full list). -F operate on the kernel's FIB (Forwarding Information Base) routing table. This is the default. -C operate on the kernel's routing cache. -v select verbose operation. -n show numerical addresses instead of trying to determine symbolic host names. This is useful if you are trying to determine why the route to your nameserver has vanished. -e use netstat(8)-format for displaying the routing table. -ee will generate a very long line with all parameters from the routing table. del delete a route. add add a new route. target the destination network or host. You can provide IP addresses in dotted decimal or host/network names. -net the target is a network. -host the target is a host. netmask NM when adding a network route, the netmask to be used. gw GW route packets via a gateway. NOTE: The specified gateway must be reachable first. This usually means that you have to set up a static route to the gateway beforehand. If you specify the address of one of your local interfaces, it will be used to decide about the interface to which the packets should be routed to. This is a BSDism compatibility hack. metric M set the metric field in the routing table (used by routing daemons) to M. mss M set the TCP Maximum Segment Size (MSS) for connections over this route to M bytes. The default is the device MTU minus headers, or a lower MTU when path mtu discovery occurred. This setting can be used to force smaller TCP packets on the other end when path mtu discovery does not work (usually because of misconfigured firewalls that block ICMP Fragmentation Needed) window W set the TCP window size for connections over this route to W bytes. This is typically only used on AX.25 networks and with drivers unable to handle back to back frames. irtt I set the initial round trip time (irtt) for TCP connections over this route to I milliseconds (1-12000). This is typically only used on AX.25 networks. If omitted the RFC 1122 default of 300ms is used. reject install a blocking route, which will force a route lookup to fail. This is for example used to mask out networks before using the default route. This is NOT for firewalling. mod, dyn, reinstate install a dynamic or modified route. These flags are for diagnostic purposes, and are generally only set by routing daemons. dev If force the route to be associated with the specified device, as the kernel will otherwise try to determine the device on its own (by checking already existing routes and device specifications, and where the route is added to). In most normal networks you won't need this. If dev If is the last option on the command line, the word dev may be omitted, as it's the default. Otherwise the order of the route modifiers (metric - netmask - gw - dev) doesn't matter.

EXAMPLES

 route add -net 127.0.0.0 netmask 255.0.0.0 dev lo adds the normal loopback entry, using netmask 255.0.0.0 and associated with the "lo" device (assuming this device was previously set up correctly with ifconfig(8)). route add -net 192.56.76.0 netmask 255.255.255.0 dev eth0 adds a route to the local network 192.56.76.x via "eth0". The word "dev" can be omitted here. route del default deletes the current default route, which is labeled "default" or 0.0.0.0 in the destination field of the current routing table. route add default gw mango-gw adds a default route (which will be used if no other route matches). All packets using this route will be gatewayed through "mango-gw". The device which will actually be used for that route depends on how we can reach "mango-gw" - the static route to "mango-gw" will have to be set up before. route add ipx4 sl0 Adds the route to the "ipx4" host via the SLIP interface (assuming that "ipx4" is the SLIP host). route add -net 192.57.66.0 netmask 255.255.255.0 gw ipx4 This command adds the net "192.57.66.x" to be gatewayed through the former route to the SLIP interface. route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0 This is an obscure one documented so people know how to do it. This sets all of the class D (multicast) IP routes to go via "eth0". This is the correct normal configuration line with a multicasting kernel. route add -net 10.0.0.0 netmask 255.0.0.0 reject This installs a rejecting route for the private network "10.x.x.x."

OUTPUT

 The output of the kernel routing table is organized in the following columns Destination The destination network or destination host. Gateway The gateway address or '*' if none set. Genmask The netmask for the destination net; '255.255.255.255' for a host destination and '0.0.0.0' for the default route. Flags Possible flags include U (route is up) H (target is a host) G (use gateway) R (reinstate route for dynamic routing) D (dynamically installed by daemon or redirect) M (modified from routing daemon or redirect) A (installed by addrconf) C (cache entry) ! (reject route) Metric The 'distance' to the target (usually counted in hops). It is not used by recent kernels, but may be needed by routing daemons. Ref Number of references to this route. (Not used in the Linux kernel.) Use Count of lookups for the route. Depending on the use of -F and -C this will be either route cache misses (-F) or hits (-C). Iface Interface to which packets for this route will be sent. MSS Default maximum segment size for TCP connections over this route. Window Default window size for TCP connections over this route. irtt Initial RTT (Round Trip Time). The kernel uses this to guess about the best TCP protocol parameters without waiting on (possibly slow) answers. HH (cached only) The number of ARP entries and cached routes that refer to the hardware header cache for the cached route. This will be -1 if a hardware address is not needed for the interface of the cached route (e.g. lo). Arp (cached only) Whether or not the hardware address for the cached route is up to date.

FILES

 /proc/net/ipv6_route /proc/net/route /proc/net/rt_cache

SEE ALSO

 ifconfig(8), netstat(8), arp(8), rarp(8)

HISTORY

 Route for Linux was originally written by Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> and then modified by Johannes Stille and Linus Torvalds for pl15. Alan Cox added the mss and window options for Linux 1.1.22. irtt support and merged with netstat from Bernd Eckenfels.

AUTHOR

 Currently maintained by Phil Blundell <Philip.Blundell@pobox.com> and Bernd Eckenfels <net-tools@lina.inka.de>.

The Mediawiki system (the ‘software’ that runs this site) capitalises all articles. Please note that commands on most UNIX and Unix-like systems are entered in lower case. As an example the article documenting the Ln command would be issued from the command line as ‘ln’.

Typically the route command is not required since advanced routing requirements would ordinarily be maintained by the routed daemon.

:/>  Использовать сервисную функцию другой клавиши и Назначение функциональных клавиш, как изменить режим их использования в ноутбуке

Contents

Usage

The -d option executes the request but does not implement it. It allows the request to be tested to ensure there are no issues arising from doing so.

The -n option instructs the route command to not resolve IP addresses to DNS names. This is useful where name resolution may slow down the presentation of information or otherwise where no DNS name servers are available or configured for use.

The -v option presents additional information on the screen.

The -q option suppresses information for certain commands, namely; ‘add’, ‘change’ and ‘flush’ (see below).

The add command creates a new route entry into the routing table.

The flush command removes all routes from the routing table (use with caution).

The delete command removes a single route entry from the routing table.

The change command changes a specific element of a route already in the routing table.

The get command displays a specific entry of the routing table.

The monitor command continuously displays changes to or queries from the routing table.

Example use

Default route (gateway)

#route add -net default 192.168.0.1
add net default: gateway 192.168.0.1

The ‘default’ option is an inbuilt alias for the default gateway and ‘192.168.0.1’ is the router IP in this instance.

#route add -net 192.168.20.0/24 192.168.0.2
add net 192.168.20.0: gateway 192.168.0.2

The ‘192.168.20.0/24’ is the subnet of the remote network, which would have been specified as ‘192.168.20.0 mask 255.255.255.0’ on Microsoft Windows or ‘192.168.20.0 netmask 255.255.255.0’ on Linux and other platforms. The ‘192.168.0.2’ is the router IP connecting to the remote network.

:/>  windows - The process "ati2evxx.exe" clogs half my RAM, how can I disable it? - Super User

#route delete 192.168.20.0
delete net 192.168.20.0

The ‘192.168.20.0’ is the route entry being deleted. This can also be specified as ‘192.168.20.0/24’ where a more specific route is used.

Microsoft Windows equivalents

$ netstat -rRouting tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 172.27.0.1 UGS 0 1822642 fxp0
localhost localhost UH 0 3946 lo0
172.27/24 link#1 UC 0 0 fxp0
172.27.0.1 00:02:a5:77:5c:29 UHLW 2 0 fxp0 1193
mail 00:02:a5:84:d3:10 UHLW 1 22373 lo0
Internet6:
Destination Gateway Flags Netif Expire
localhost.domain localhost.domain UH lo0
fe80::%fxp0 link#1 UC fxp0
fe80::202:a5ff:fe8 00:02:a5:84:d3:10 UHL lo0
fe80::%lo0 fe80::1%lo0 U lo0
fe80::1%lo0 link#3 UHL lo0
ff01:1:: link#1 UC fxp0
ff01:3:: localhost.domain UC lo0
ff02::%fxp0 link#1 UC fxp0
ff02::%lo0 localhost.domain UC lo0

See also the articles on netstat, Network Configuration (basic) and Network Configuration (Advanced).

route – Man Page

show / manipulate the IP routing table

Examples (TL;DR)

  • Display the information of route table: route -n
  • Add route rule: sudo route add -net ip_address netmask netmask_address gw gw_address
  • Delete route rule: sudo route del -net ip_address netmask netmask_address dev gw_address

Synopsis

route
route
route

Note

This program is obsolete. For replacement check ip route.

Description

Route manipulates the kernel’s IP routing tables.  Its primary use is to set up static routes to specific hosts or networks via an interface after it has been configured with the ifconfig(8) program.

When the add or del options are used, route modifies the routing tables.  Without these options, route displays the current contents of the routing tables.

Options

-A family

use the specified address family (eg `inet’). Use route –help for a full list. You can use -6 as an alias for –inet6 and -4 as an alias for -A inet

-F

operate on the kernel’s FIB (Forwarding Information Base) routing table.  This is the default.

-C

operate on the kernel’s routing cache.

-v

select verbose operation.

-n

show numerical addresses instead of trying to determine symbolic host names. This is useful if you are trying to determine why the route to your nameserver has vanished.

-e

use netstat(8)-format for displaying the routing table. -ee will generate a very long line with all parameters from the routing table.

del

delete a route.

add

add a new route.

target

the destination network or host. You can provide an addresses or symbolic  network or host name. Optionally you can use /prefixlen notation instead of using the netmask option.

-net

the target is a network.

-host

the target is a host.

netmask NM

when adding a network route, the netmask to be used.

gw GW

route packets via a gateway.
Note: The specified gateway must be reachable first. This usually means that you have to set up a static route to the gateway beforehand. If you specify the address of one of your local interfaces, it will be used to decide about the interface to which the packets should be routed to. This is a BSDism compatibility hack.

metric M

set the metric field in the routing table (used by routing daemons) to M. If this option is not specified the metric for inet6 (IPv6) address family defaults to ‘1’, for inet (IPv4) it defaults to ‘0’. You should always specify an explicit metric value to not rely on those defaults – they also differ from iproute2.

mss M

sets MTU (Maximum Transmission Unit) of the route to M bytes. Note that the current implementation of the route command does not allow the option to set the Maximum Segment Size (MSS).

window W

set the TCP window size for connections over this route to W bytes. This is typically only used on AX.25 networks and with drivers unable to handle back to back frames.

irtt I

set the initial round trip time (irtt) for TCP connections over this route to I milliseconds (1-12000). This is typically only used on AX.25 networks. If omitted the RFC 1122 default of 300ms is used.

reject
mod, dyn, reinstate

install a dynamic or modified route. These flags are for diagnostic purposes, and are generally only set by routing daemons.

dev If

force the route to be associated with the specified device, as the kernel will otherwise try to determine the device on its own (by checking already existing routes and device specifications, and where the route is added to). In most normal networks you won’t need this.

If dev If is the last option on the command line, the word dev may be omitted, as it’s the default. Otherwise the order of the route modifiers (metric netmask gw dev) doesn’t matter.

Examples

route add -net 127.0.0.0 netmask 255.0.0.0 metric 1024 dev lo

adds the normal loopback entry, using netmask 255.0.0.0 and associated with the  “lo” device (assuming this device was previously set up correctly with ifconfig(8)).

route add -net 192.56.76.0 netmask 255.255.255.0 metric 1024 dev eth0

adds a route to the local network 192.56.76.x via  “eth0”.  The word “dev” can be omitted here.

route del default

deletes the current default route, which is labeled “default” or 0.0.0.0 in the destination field of the current routing table.

route add default gw mango

adds a default route (which will be used if no other route matches). All packets using this route will be gatewayed through the address of a node named “mango”. The device which will actually be used for that route depends on how we can reach “mango” – “mango” must be on directly reachable route.

route add mango sl0

Adds the route to the host named “mango” via the SLIP interface (assuming that “mango” is the SLIP host).

route add -net 192.57.66.0 netmask 255.255.255.0 gw mango

This command adds the net “192.57.66.x” to be gatewayed through the former route to the SLIP interface.

route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0

This is an obscure one documented so people know how to do it. This sets all of the class D (multicast) IP routes to go via “eth0”. This is the correct normal configuration line with a multicasting kernel.

route add -net 10.0.0.0 netmask 255.0.0.0 metric 1024 reject

This installs a rejecting route for the private network “10.x.x.x.”

route -6 add 2001:0002::/48 metric 1 dev eth0

This adds a IPv6 route with the specified metric to be directly reachable via eth0.

Output

Destination

The destination network or destination host.

Gateway

The gateway address or ‘*’ if none set.

Genmask

The netmask for the destination net; ‘255.255.255.255’ for a host destination and ‘0.0.0.0’ for the default route.

Flags

Possible flags include
U (route is up)
H (target is a host)
G (use gateway)
R (reinstate route for dynamic routing)
D (dynamically installed by daemon or redirect)
M (modified from routing daemon or redirect)
A (installed by addrconf)
C (cache entry)
! (reject route)

Metric

The ‘distance’ to the target (usually counted in hops).

Ref

Number of references to this route. (Not used in the Linux kernel.)

Use

Count of lookups for the route.  Depending on the use of -F and -C this will be either route cache misses (-F) or hits (-C).

Iface

Interface to which packets for this route will be sent.

MSS

Default maximum segment size for TCP connections over this route.

Window

Default window size for TCP connections over this route.

irtt

Initial RTT (Round Trip Time). The kernel uses this to guess about the best TCP protocol parameters without waiting on (possibly slow) answers.

HH (cached only)

The number of ARP entries and cached routes that refer to the hardware header cache for the cached route. This will be -1 if a hardware address is not needed for the interface of the cached route (e.g. lo).

Arp (cached only)

Whether or not the hardware address for the cached route is up to date.

Files

See Also

History

Author

Referenced By

arptables-legacy(8), ebtables-legacy(8), ipsec_import(8), ipsec_pluto(8), netmask(1), netstat(8), networks(5), openvpn(8), proc(5), rip98d(8), rip98d.conf(5), tayga.conf(5).

    Introduction

    This document describes how to use the Microsoft Windows route command. 

    Prerequisites

    Requirements

    Cisco recommends that you have knowledge of these topics:

    • How to troubleshoot Cisco ICM

    • How to configure and troubleshoot TCP/IP

    • How to troubleshoot Microsoft Windows

    Components Used

    The information in this document is based on these software versions:

    • Microsoft Windows NT

    The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, ensure that you understand the potential impact of any command.

    Conventions

    Background Information

    This document describes the use of the Microsoft Windows route command. You can modify this information when you troubleshoot the Cisco Intelligent Contact Management (ICM) software.

    Use the Route Command

    You can use the route command to view, add and delete routes on a Microsoft Windows NT server that runs Cisco ICM. You can use these options with the route command:

    route [-f] [-p] [command [destination] [mask subnetmask] [gateway] [metric costmetric]]

    Command Options

    This section explains each of the options that you can use with the route command:

    • The -f option clears the routing tables of all gateway entries. If you use the -f option in conjunction with one of the commands, the tables are cleared before you run the command.

    • By default, routes are not preserved when you restart the system. Use the -p option with the add command to make a route persistent. Use the-p option with the print command to view the list of registered persistent routes.

    • The command option specifies one of the six commands in this table:

    • The destination specifies the network destination of the route. The destination can be an IP network address, an IP address for a host route, or a default route.

    • A netmask is a 32-bit mask that you can use to divide an IP address into subnets and specify the available hosts in the network. If you do not specify a netmask the default value 255.255.255.255 applies.

    • The gateway option specifies the default gateway. All symbolic names used for the destination or gateway are looked up in the network and computer name database files NETWORKS and HOSTS. If the command is print or delete , you can use wildcards for the destination and gateway, or you can omit the gateway.

    • The metric option assigns an integer cost metric (that ranges from 1 to 9999) which you can use to calculate the fastest, most reliable, and least expensive routes.

    “IF” specifies the interface index for the interface over which the destination is reachable. If you do not specify IF , an attempt is made to find the best interface for a given gateway.

    Here is an example of the route command:

    Example of the Route CommandExample of the Route Command

    Examples

    In order to view the entire contents of the IP routing table, issue the route print command.

    In order to add a persistent route to the destination 10.19.0.0 with the subnet mask of 255.255.0.0 and the next hop address of 10.10.0.1, issue the route -p add 10.19.0.0 mask 255.255.0.0 10.10.0.1 command.

    In order to view the routes in the IP routing table that begin with “172.”, issue the route print 172.* command.

    In order to delete all routes in the IP routing table that begin with “172.”, issue theroute delete 172.*command.

    Related Information

    • Cisco Technical Support & Downloads