Jump to content

Recommended Posts

Posted (edited)

Добавить строчки в файл /etc/iproute2/rt_tables, чтобы задать читаемые имена таблицам маршрутизации

...
# Custom Tables
10    UPLINK_1_DEFAULT_GATEWAY
20    UPLINK_2_DEFAULT_GATEWAY
...

 

# Input interface
ip addr add 192.168.1.1/30 dev eth0
ip link set eth0 up

# Uplink 1 interface
ip addr add 10.10.10.1/30 dev eth1
ip link set eth1 up

# Uplink 2 interface
ip addr add 10.10.20.1/30 dev eth2
ip link set eth2 up

ip rule add from 172.27.18.0/24 iif eth0 lookup UPLINK_1_DEFAULT_GATEWAY
ip route add default via 10.10.10.2 table UPLINK_1_DEFAULT_GATEWAY

ip rule add from 172.27.19.0/24 iif eth0 lookup UPLINK_2_DEFAULT_GATEWAY
ip route add default via 10.10.20.2 table UPLINK_2_DEFAULT_GATEWAY

 

Пакеты с адресами источников 172.27.18.0/24 и 172.27.19.0/24 будут уходить в соответсвующий основной шлюз у аплинков

 

"iif eth0" можно опустить, это проверка на входящий интерфейс

Edited by Painter

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...
На сайте используются файлы cookie и сервисы аналитики для корректной работы форума и улучшения качества обслуживания. Продолжая использовать сайт, вы соглашаетесь с использованием файлов cookie и с Политикой конфиденциальности.