Posted in : Azure By Simon Gottschlag Translate with Google ⟶

7 years ago

I mitt tidigare inlägg beskrev jag hur IPSec-tunnlar kan sättas upp med hjälp av CentOS och StrongSwan. För att slutföra det hela vill vi ju så klart skapa en dynamisk routing mellan noderna så vi inte behöver sitta och konfigurera sånt manuellt.
Installation och grundkonfiguration:

yum install quagga
cp /usr/share/doc/quagga-0.99.22.4/zebra.conf.sample /etc/quagga/zebra.conf
cp /usr/share/doc/quagga-0.99.22.4/ospfd.conf.sample /etc/quagga/ospfd.conf
chown quagga:quagga /etc/quagga/zebra.conf
chown quagga:quagga /etc/quagga/ospfd.conf
vim /etc/quagga/zebra.conf
[...]
hostname <hostname>
password <password>
enable password <password>
log file /var/log/quagga/quagga.log
[...]
vim /etc/quagga/ospfd.conf
[...]
hostname <hostname>
password <password>
enable password <password>
log file /var/log/quagga/ospfd.log
[...]
systemctl enable zebra
systemctl enable ospfd
systemctl start zebra
systemctl start ospfd

Därefter, konfigurera en statisk route till ”Client” nätet för respektive router och konfigurera dem för OSPF.

vtysh
configure terminal
#
# UK South Router
#
interface vti100
 ip ospf dead-interval 15
 ip ospf hello-interval 5
 ip ospf network broadcast
interface vti200
 ip ospf dead-interval 15
 ip ospf hello-interval 5
 ip ospf network broadcast
router ospf
 ospf router-id 10.18.16.20
 redistribute static metric 100
 network 169.254.0.0/30 area 0.0.0.0
 network 169.254.0.4/30 area 0.0.0.0
ip route 10.18.0.0/16 10.18.16.1
ip forwarding
do write
#
# West Europe Router
#
interface vti100
 ip ospf dead-interval 15
 ip ospf hello-interval 5
 ip ospf network broadcast
interface vti300
 ip ospf dead-interval 15
 ip ospf hello-interval 5
 ip ospf network broadcast
ip route 10.17.0.0/16 10.17.16.1
ip forwarding
do write
#
# West US Router
#
interface vti200
 ip ospf dead-interval 15
 ip ospf hello-interval 5
 ip ospf network broadcast
interface vti300
 ip ospf dead-interval 15
 ip ospf hello-interval 5
 ip ospf network broadcast
router ospf
 ospf router-id 10.16.16.20
 redistribute static metric 100
 network 169.254.0.4/30 area 0.0.0.0
 network 169.254.0.8/30 area 0.0.0.0
ip route 10.16.0.0/16 10.16.16.1
ip forwarding
do write

Nu kan du verifiera att det fungerar genom exempelvis köra följande på en av dem:

vm-dev-uks-vti-rtr01# show ip ospf neighbor
    Neighbor ID Pri State           Dead Time Address         Interface            RXmtL RqstL DBsmL
10.17.16.20       1 Full/Backup       12.696s 169.254.0.2     vti100:169.254.0.1       0     0     0
10.16.16.20       1 Full/Backup       11.853s 169.254.0.6     vti200:169.254.0.5       0     0     0
vm-dev-uks-vti-rtr01# show ip ospf route
============ OSPF network routing table ============
N    169.254.0.0/30        [10] area: 0.0.0.0
                           directly attached to vti100
N    169.254.0.4/30        [10] area: 0.0.0.0
                           directly attached to vti200
N    169.254.0.8/30        [20] area: 0.0.0.0
                           via 169.254.0.2, vti100
                           via 169.254.0.6, vti200
============ OSPF router routing table =============
R    10.16.16.20           [10] area: 0.0.0.0, ASBR
                           via 169.254.0.6, vti200
R    10.17.16.20           [10] area: 0.0.0.0, ASBR
                           via 169.254.0.2, vti100
============ OSPF external routing table ===========
N E2 10.16.0.0/16          [10/100] tag: 0
                           via 169.254.0.6, vti200
N E2 10.17.0.0/16          [10/100] tag: 0
                           via 169.254.0.2, vti100

Genom att vi kör broadcast kan du testa att stänga av olika vti och se hur trafiken ändrar path. I mitt fall använde jag Windows 10-maskiner på mina ”Client” subnät som kommunicerade med varandra. Värt att tänka på är att inte glömma user defined routes för subnät 01.

Tags : Azure, centos, Linux, OSPF, Quagga, StrongSwan

Personlig rådgivning

Vi erbjuder personlig rådgivning med författaren för 1400 SEK per timme. Anmäl ditt intresse i här så återkommer vi så snart vi kan.

Add comment

Your comment will be revised by the site if needed.