BGP
Материал из xapmc.net
- Задача
- Необходимо организовать взаимосвязь по протоколу BGP и обменяться сетями
- Решение
- Воспользуемся для этого протоколом BGPv4, приватными AS 65601 и 65602. Тип соединения eBGP.
- Оборудование, которым располагаем
Вендор | Модель |
---|---|
1. juniper | srx100 |
2. quagga (debian) | 0.99.23.1-1(debian 8) |
- Схема сети
- Debian 8
- Установка quagga
aptitude install quagga
- Создадим файлы для quagga.
touch zebra.conf touch bgpd.conf
- Дадим права на файлы.
chown quagga:quagga /etc/quagga/zebra.conf chown quagga:quagga /etc/quagga/bgpd.conf
- Изменим настройки файла daemons.
zebra=yes bgpd=yes
- Поставим "yes".
- Отредактируем файлы zebra.conf, bgpd.conf
zebra.conf
hostname router password xapmcnet enable password xapmcnet
bgpd.conf
hostname router password xapmcnet enable password xapmcnet
- Где xapmcnet должен стоять ваш пароль.
- В debian8 включаем forward на лету
sysctl -w net.ipv4.ip_forward=1
- В /etc/sysctl.conf снять коммент с
net.ipv4.ip_forward=1
- Настройка bgpd.conf quagga
router bgp 65602 bgp router-id 192.168.2.120 network 10.10.33.0/24 neighbor 192.168.2.33 remote-as 65601
- Настройка juniper srx100
set protocols bgp local-as 65601 set protocols bgp group external type external set protocols bgp group external multipath set protocols bgp group external neighbor 192.168.2.120 import AS65602-IN set protocols bgp group external neighbor 192.168.2.120 export AS65602-OUT set protocols bgp group external neighbor 192.168.2.120 peer-as 65602 set protocols bgp group external neighbor 192.168.2.120 graceful-restart set policy-options policy-statement AS65602-IN term access_in from route-filter 10.0.0.0/8 orlonger set policy-options policy-statement AS65602-IN term access_in then accept set policy-options policy-statement AS65602-OUT term access_out from route-filter 10.10.10.0/24 exact set policy-options policy-statement AS65602-OUT term access_out then accept set policy-options policy-statement AS65602-OUT term deny_out from route-filter 0.0.0.0/0 orlonger set policy-options policy-statement AS65602-OUT term deny_out then reject set routing-options autonomous-system 65601 commit
- Проверка juniper srx100
root@srx100-15# run show route protocol bgp inet.0: 6 destinations, 7 routes (6 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.10.33.0/24 *[BGP/170] 04:52:17, MED 0, localpref 100 AS path: 65602 I > to 192.168.2.120 via fe-0/0/7.0 mpls.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden)
- Проверка quagga
router# sh ip route Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF, I - IS-IS, B - BGP, A - Babel, > - selected route, * - FIB route K>* 0.0.0.0/0 via 192.168.2.1, eth0 B>* 10.10.10.0/24 [20/0] via 192.168.2.33, eth0, 00:04:26 C>* 10.10.33.0/24 is directly connected, eth1 C>* 127.0.0.0/8 is directly connected, lo C>* 192.168.2.0/24 is directly connected, eth0