OpenBGPD kasutamine OpenBSDga

Allikas: Kuutõrvaja
Redaktsioon seisuga 26. juuli 2009, kell 23:10 kasutajalt Imre (arutelu | kaastöö) (Testvõrgu ettevalmistamine)

Sissejuhatus

Internet koosneb võrkude haldajatele usaldatud suurtest võrkudest, mida nimetatakse autonoomseteks süsteemideks (AS - Autonomous System). Üheks oluliseks ülesandeks nende võrkude pidamisel on ruutingute haldamine, reeglina räägitakse võrkude vahel EGP protokolli ja võrgude sees IGP protokolli.

  • EGP (Exterior Gateway Protocol) - nt BGP4 (Border Gateway Protocol) protokoll ja implementatsioon OpenBGPD; BGP4 on 2009 aastal praktiliselt ainus levinud EGP
  • IGP (Interior Gateway Protocol) - nt OSPF (Open Shortest Path First) protokoll ja impementatsioon OpenOSPFD; OSPF on 2009 aastal tõenäoliselt kõige levinum IGP, lisaks on palju kasutusel IS-IS

Border Gateway Protocol (BGP) kasutusalad

  • nn suurte võrkude omavahel ühendamiseks (nt ISP'ide vahelised ühendused)
  • kasutaja ühendamiseks võrku mitme erineva ISP ühenduse abil

BGP tööpõhimõte

TODO

Mõisted

  • AS numbrid vahemikus 64512 - 65535 ei ole avalikult kasutuses ja on mõeldud privaatseks kasutamiseks.
  • stub AS - AS omab ainult ühte ühendust ühe teise AS'iga; AS sees liigub ainult kohalik liiklus (ingl. k. local traffic)
  • multihomed AS - AS omab ühendusi enam kui ühe teise AS'iga; AS sees liigub ainult kohalik liiklus
  • transit AS - AS omab ühendusi enam kui ühe teise AS'iga; AS sees liigub kohalik liiklus ja teatud tingimustel läbiv liiklus (ingl. k. transit traffic)

eBGP kasutuse eesmärk

Olgu kasutada selliselt seadistatud võrk

  • arvutites on seadistatud võrguseadmed
  • vaikelüüs on seadistamata
  • ip forwarding on sisselülitatud
                                             RNW - 10.2.0.0/24
haapsalu                                     tallinn                                    narva
AS 65101                                     AS 65102                                   AS 65103
          ___  em0 - 192.168.12.101 (r-id)     ___  em1 - 192.168.23.102 (r-id)     ___
         |   |                                |   |                                |   |
         | 1 |--------------------------------| 2 |--------------------------------| 3 |
         |___|           192.168.12.102 - em0 |___|           192.168.23.103 - em0 |___|
           |                                    |                                    |   em1 - 192.168.37.103 (r-id)
           | em1 - 192.168.14.101               |                                    |  
           |                                    |                                    |
           |                                    |                                    |
           |                                    |                                    |
           |                                    |                                    |
           |                                    |                                    |
           | em0 - 192.168.14.104               |                                    |
parnu      |                                    |   tartu                            |
AS 65104  _|_  em1 - 192.168.45.104            _|_  AS 65105                         |
         |   |                                |   |                                  |
         | 4 |--------------------------------| 5 | em1 - 192.168.23.105             |
         |___|     192.168.45.105 (r-id)- em0 |___|                                  |
           |                                    |   em2 -  192.168.56.105            |
           | em2 - 192.168.46.104 (r-id)        |                                    |
           |                                    |                                    |
           |                                    |                                    | 
           |                                    |                                    |
           |                                    |                                    |
           |                                    |                                    |
           |                                    |                                    |
           | em0 - 192.168.46.106               |                                    |
          _|_   em1 - 192.168.56.106 (r-id)     |                                   _|_  em1 - 192.168.37.107
         |   |                                  |                                  |   |
         | 6 |----------------------------------'     192.168.67.107 (r-id) - em0  | 7 | 
         |___|---------------------------------------------------------------------|___|
           em2 - 192.168.67.106
voru                                                                                     pihkva
AS 65106                                                                                 AS 65107
RNW - 10.6.0.0/24

ning eesmärgiks kasutades OpenBSD OpenBGPD tarkvara

  • seadistada iga arvutid tööle BGP ruuteritena oma Autonomous System (AS) jaoks (nt AS 65101)
  • ruuterid levitavad üle BGP kuuldud ruutinguid
  • 10.6.0.0/24 ja 10.2.0.0/24 võrgus töötavad arvutid peavad saama omavahel suhelda (RNW - routed network, ingl. k. ruuditud võrk)

Testvõrgu ettevalmistamine

Tundub, et 2009 aasta suvel on kõige otstarbekam BGP testiks kasutada tarkvara VMware Server v. 2 abil moodustatud virtuaalset keskkonda. Antud juhtumil on WMware keskkonnas seadistatud

  • igale ruuterite omavahelisele ühendusele vastav nn hostonly võrk
  • igale ruuterile vastav virtuaalne arvuti
  • eemalt üle ssh ligipääsuks on tallinn ja voru arvutitele seadistatud lisaks üks sillatud režiimis töötav võrguseade; läbi nende arvutite pääseb seadistama ssh abil ka ülejäänud arvuteid

Openbgpd-1.gif

BGP seadistamine

AS 65101 - Haapsalu

 # cat /etc/bgpd.conf
 # global configuration
 AS 65101
 router-id 192.168.12.101
 
 neighbor 192.168.12.102 {
         remote-as       65102
         descr           AS65102 
         announce        all
 }
 
 neighbor 192.168.14.104 {
         remote-as       65104
         descr           AS65104
         announce        all
 }
 
 # filter out prefixes longer than 24 or shorter than 8 bits
 deny from any
 allow from any inet prefixlen 8 - 24
 # do not accept a default route
 deny from any prefix 0.0.0.0/0
 
 # filter bogus networks
 deny from any prefix 169.254.0.0/16 prefixlen >= 16
 deny from any prefix 192.0.2.0/24 prefixlen >= 24
 deny from any prefix 224.0.0.0/4 prefixlen >= 4
 deny from any prefix 240.0.0.0/4 prefixlen >= 4

AS 65102 - Tallinn

 # cat /etc/bgpd.conf                                                                          
 # global configuration
 AS 65102
 router-id 192.168.23.102
 network 10.2.0.0/24
 
 neighbor 192.168.12.101 {
          remote-as       65101
          descr           AS65101
 }
 
 neighbor 192.168.23.103 {
          remote-as       65103
          descr           AS65103
 }
 
 neighbor 192.168.25.105 {
          remote-as       65105
          descr           AS65105
 }
 
 # filter out prefixes longer than 24 or shorter than 8 bits
 deny from any
 allow from any inet prefixlen 8 - 24
 # do not accept a default route
 deny from any prefix 0.0.0.0/0
 
 # filter bogus networks
 deny from any prefix 169.254.0.0/16 prefixlen >= 16
 deny from any prefix 192.0.2.0/24 prefixlen >= 24
 deny from any prefix 224.0.0.0/4 prefixlen >= 4
 deny from any prefix 240.0.0.0/4 prefixlen >= 4

AS 65103 - Narva

 # cat /etc/bgpd.conf 
 # global configuration
 AS 65103
 router-id 192.168.37.103
 
 neighbor 192.168.23.102 {
          remote-as       65102
          descr           AS65102 
          announce all    
 }
 
 neighbor 192.168.37.107 {
          remote-as       65107
          descr           AS65107
          announce all
 }
 
 # filter out prefixes longer than 24 or shorter than 8 bits
 deny from any
 allow from any inet prefixlen 8 - 24
 # do not accept a default route
 deny from any prefix 0.0.0.0/0
 
 # filter bogus networks
 deny from any prefix 169.254.0.0/16 prefixlen >= 16
 deny from any prefix 192.0.2.0/24 prefixlen >= 24
 deny from any prefix 224.0.0.0/4 prefixlen >= 4
 deny from any prefix 240.0.0.0/4 prefixlen >= 4

AS 65104 - Pärnu

 # cat /etc/bgpd.conf 
 # global configuration
 AS 65104
 router-id 192.168.46.104
 
 neighbor 192.168.14.101 {
          remote-as       65101
          descr           AS65101
          announce        all
 }
 
 neighbor 192.168.45.105 {
          remote-as       65105
          descr           AS65105
          announce        all     
 }
  
 neighbor 192.168.46.106 {
          remote-as       65106
          descr           AS65106
          announce all
 }
  
 # filter out prefixes longer than 24 or shorter than 8 bits
 deny from any
 allow from any inet prefixlen 8 - 24
 # do not accept a default route
 deny from any prefix 0.0.0.0/0
 
 # filter bogus networks
 deny from any prefix 169.254.0.0/16 prefixlen >= 16
 deny from any prefix 192.0.2.0/24 prefixlen >= 24
 deny from any prefix 224.0.0.0/4 prefixlen >= 4
 deny from any prefix 240.0.0.0/4 prefixlen >= 4

AS 65105 - Tartu

 # cat /etc/bgpd.conf 
 # global configuration
 AS 65105
 router-id 192.168.45.105
 
 neighbor 192.168.45.104 {
          remote-as       65104
          descr           AS65104 
 }
 
 neighbor 192.168.25.102 {
          remote-as       65102
          descr           AS65102
          announce all
 }
 
 neighbor 192.168.56.106 {
          remote-as       65106
          descr           AS65106
          announce all
 }
 
 # filter out prefixes longer than 24 or shorter than 8 bits
 deny from any
 allow from any inet prefixlen 8 - 24
 # do not accept a default route
 deny from any prefix 0.0.0.0/0
 
 # filter bogus networks
 deny from any prefix 169.254.0.0/16 prefixlen >= 16
 deny from any prefix 192.0.2.0/24 prefixlen >= 24
 deny from any prefix 224.0.0.0/4 prefixlen >= 4
 deny from any prefix 240.0.0.0/4 prefixlen >= 4

AS 65106 - Võru

 # cat /etc/bgpd.conf 
 # global configuration
 AS 65106
 router-id 192.168.56.106
 network 10.6.0.0/24
 
 neighbor 192.168.46.104 {
          remote-as       65104
          descr           AS65104
 }
 
 neighbor 192.168.56.105 {
          remote-as       65105
          descr           AS65105
 }
 
 neighbor 192.168.67.107 {
          remote-as       65107
          descr           AS65107
 }
 
 # filter out prefixes longer than 24 or shorter than 8 bits
 deny from any
 allow from any inet prefixlen 8 - 24
 # do not accept a default route
 deny from any prefix 0.0.0.0/0
 
 # filter bogus networks
 deny from any prefix 169.254.0.0/16 prefixlen >= 16
 deny from any prefix 192.0.2.0/24 prefixlen >= 24
 deny from any prefix 224.0.0.0/4 prefixlen >= 4
 deny from any prefix 240.0.0.0/4 prefixlen >= 4

AS 65107 - Pihkva

 # cat /etc/bgpd.conf
 # global configuration
 AS 65107
 router-id 192.168.67.107
   
 neighbor 192.168.67.106 {
          remote-as       65106
          descr           AS65106
          announce all
 }
 
 neighbor 192.168.37.103 {
          remote-as       65103
          descr           AS65103
          announce all
 }
 
 # filter out prefixes longer than 24 or shorter than 8 bits
 deny from any
 allow from any inet prefixlen 8 - 24
 # do not accept a default route
 deny from any prefix 0.0.0.0/0
 
 # filter bogus networks
 deny from any prefix 169.254.0.0/16 prefixlen >= 16
 deny from any prefix 192.0.2.0/24 prefixlen >= 24
 deny from any prefix 224.0.0.0/4 prefixlen >= 4
 deny from any prefix 240.0.0.0/4 prefixlen >= 4

BGP kasutamine

TODO

Skeem 2

                                         arvuti-4
                                    |
                                   _|_  em0 (ei ole kasutusel)
                                  |   |
             192.168.17.253 - em1 |___| em2 - 192.168.18.253
                               /         \
                             /             \
                AS 65123  .....                  AS 65213
                                 internet     ...
 192.168.17.254 - em0    /                     \    em0 - 192.168.18.254
                        |                       |
                       _|_                     _|_
                      |   |                   |   |
             ruuter-2 |___|                   |___| ruuter-3
                        |                       |
 192.168.15.254 - em1   |                       |   em1 - 192.168.16.254
                         \                     /
                            \               /
                               \   ___   /
             192.168.15.253 - em1 |   | em2 - 192.168.16.253
                                  |___|  ruuter-1
                                    |   em0 - 192.168.17.17
                                    |
                      --|-----------|----|---------|-----
                       _|_              _|_       _|_
                      |   |            |   |     |   |
                      |___|            |___|     |___|
    
                    arvuti-1         arvuti-2   arvuti-3

Ruuterite seadistamine

TODO

Kasulikud lisamaterjalid