System Compleat.

'Quagga bgp'에 해당되는 글 1건

  1. Quagga test with Arista switches 1

Quagga test with Arista switches

Techs

( younjin.jeong@gmail.com, 정윤진 ) 


클라우드에는 참 많은 종류의 네트워크가 필요한데, 바로 이 부분을 보다 단순화 할 수 없을까 하는 생각에 몇가지 테스트를 진행하던 중 블로그에 Quagga 를 검색어로 유입되는 경우가 꽤 있어 얼마전 진행했던 테스트의 내용을 간추려 올린다. 


오늘도 역시 발로 그림이 먼저 등장한다. 



Quagga with BGP




실제 구성은 각 ToR 이 8회선의 multi-path 를 가지는 것이었지만, 단순화를 위해 살짝 변경 했다. 맨 위의 박스는 우분투 서버이며, 인터넷으로의 업링크 회선은 일반 UTP 로, 172.16.1.250/24 에 게이트웨이는 172.16.1.1, 인터페이스는 eth0 이다. 


다운링크는 Intel 10G Dual port 로, Arista 7124SX 의 24번 포트에 TwinAx 케이블로 연결되어있다. 망은 30 bitmask 를 가지며, 이 구간에는 eBGP 를 사용하였다. 


Aggregation <---> ToR 에는 각 2회선이 사용되었으며, 모두 10G 연결이다. 역시 각 회선마다 30 bitmask 의 네트워크 구성이 되어 있으며, ECMP 가 적용되어 있다. (LACP 가 아님에 주의) AGGR 측에서는 1번 포트부터 순차적으로 2포트씩 다운링크에 사용한다. 


ToR 스위치는 업링크에 23,24번 포트를 사용하며, 1번부터 22번 포트까지는 Vlan 10 으로, 랙에 설치된 서버의 연결에 사용한다. 서버는 ToR 스위치를 게이트웨이 인터페이스로 가지지만, ToR 스위치는 Aggregation 스위치와 iBGP 로 연결 되어 있다. 


이와 같은 구성에서, 서버의 Quagga 설정은 zebra 와 bgpd 만을 사용하도록 하며, 설정은 다음과 같다. 


# /etc/quagga/daemons
# This file tells the quagga package which daemons to start.
#
# Entries are in the format: =(yes|no|priority)
#   0, "no"  = disabled
#   1, "yes" = highest priority
#   2 .. 10  = lower priorities
# Read /usr/share/doc/quagga/README.Debian for details.
#
# Sample configurations for these daemons can be found in
# /usr/share/doc/quagga/examples/.
#
# ATTENTION: 
#
# When activation a daemon at the first time, a config file, even if it is
# empty, has to be present *and* be owned by the user and group "quagga", else
# the daemon will not be started by /etc/init.d/quagga. The permissions should
# be u=rw,g=r,o=.
# When using "vtysh" such a config file is also needed. It should be owned by
# group "quaggavty" and set to ug=rw,o= though. Check /etc/pam.d/quagga, too.
#
zebra=yes
bgpd=yes
ospfd=no
ospf6d=no
ripd=no
ripngd=no
isisd=no

/etc/quagga/daemons 는 어떤 프로토콜을 사용 할 지를 정해주는 설정 파일이다. 

이후 모든 Quagga 설정 파일은 한번에 나오므로, 각 섹션의 주석 처리된 파일 이름으로 구분해서 참고 하도록 하자. 


# /etc/quagga/vtysh.conf
!
!
! service integrated-vtysh-config
!
hostname Ubuntubox
username root nopassword
!
!


# /etc/quagga/zebra.conf
!
hostname quagga
!
interface eth0
ip address 172.16.1.250/24
!
interface lo
!
interface eth2
ip address 10.254.1.254/30
!
ip forwarding
!
ip route 0.0.0.0/0 172.16.1.1
!
line vty
!  


# /etc/quagga/bgpd.conf
!
router bgp 60001
  bgp router-id 172.16.1.250
  network 0.0.0.0/0
  neighbor downstream peer-group
  neighbor downstream remote-as 60000
  neighbor downstream ebgp-multihop 10
  neighbor 10.254.1.253 peer-group downstream
  neighbor 10.254.1.253 update-source eth2
  no auto-summary
!


이제, 이 서버와 연결되는 AGGR 스위치의 config. 


# AGGR config
! device: 10G-AGGR-01 (DCS-7124SX, EOS-4.9.0-590041.EOS490RibPimFix (engineering build))
!
! boot system flash:/EOS-4.9.0-EFT2.swi
!
terminal length 30
!
hostname 10G-AGGR-01
!
spanning-tree mode mstp
!
no aaa root
!
username admin secret 5 heymannodbodygivesashitaboutwhatyouaredoing
!
interface Ethernet1
   no switchport
   ip address 10.1.1.1/30
!
interface Ethernet2
   no switchport
   ip address 10.1.1.5/30
!
interface Ethernet3
   no switchport
   ip address 10.1.2.1/30
!
interface Ethernet4
   no switchport
   ip address 10.1.2.5/30
!
interface Ethernet5
!
interface Ethernet6
!
interface Ethernet7
!
interface Ethernet8
!
interface Ethernet9
!
interface Ethernet10
!
interface Ethernet11
!
interface Ethernet12
!
interface Ethernet13
!
interface Ethernet14
!
interface Ethernet15
!
interface Ethernet16
!
interface Ethernet17
!
interface Ethernet18
!
interface Ethernet19
!
interface Ethernet20
!
interface Ethernet21
!
interface Ethernet22
!
interface Ethernet23
!
interface Ethernet24
   no switchport
   ip address 10.254.1.253/30
!
interface Management1
   ip address 192.168.1.201/24
!
ip routing
!
router bgp 60000
   bgp log-neighbor-changes
   timers bgp 1 3
   maximum-paths 16
   neighbor 10.1.1.2 remote-as 60000
   neighbor 10.1.1.2 update-source Ethernet1
   neighbor 10.1.1.2 next-hop-self
   neighbor 10.1.1.2 maximum-routes 12000 
   neighbor 10.1.1.6 remote-as 60000
   neighbor 10.1.1.6 update-source Ethernet2
   neighbor 10.1.1.6 next-hop-self
   neighbor 10.1.1.6 maximum-routes 12000 
   neighbor 10.1.2.2 remote-as 60000
   neighbor 10.1.2.2 update-source Ethernet3
   neighbor 10.1.2.2 next-hop-self
   neighbor 10.1.2.2 maximum-routes 12000 
   neighbor 10.1.2.6 remote-as 60000
   neighbor 10.1.2.6 update-source Ethernet4
   neighbor 10.1.2.6 next-hop-self
   neighbor 10.1.2.6 maximum-routes 12000 
   neighbor 10.254.1.254 remote-as 60001
   neighbor 10.254.1.254 ebgp-multihop 2
   neighbor 10.254.1.254 maximum-routes 12000 
   redistribute connected
!
!
end


각 ToR 설정. 


### ToR #1 
! device: 10G-TOR-01 (DCS-7124S, EOS-4.9.0-590041.EOS490RibPimFix (engineering build))
!
! boot system flash:/EOS-4.9.0-EFT2.swi
!
terminal length 30
!
logging host 192.168.17.201
logging facility local0
!
hostname 10G-TOR-01
!
spanning-tree mode mstp
!
no aaa root
!
username admin secret 5 whogivesashit
!
vlan 10
!
interface Ethernet1
   switchport access vlan 10
!
interface Ethernet2
   switchport access vlan 10
!
interface Ethernet3
   switchport access vlan 10
!
interface Ethernet4
   switchport access vlan 10
!
interface Ethernet5
   switchport access vlan 10
!
interface Ethernet6
   switchport access vlan 10
!
interface Ethernet7
   switchport access vlan 10
!
interface Ethernet8
   switchport access vlan 10
!
interface Ethernet9
   switchport access vlan 10
!
interface Ethernet10
   switchport access vlan 10
!
interface Ethernet11
   switchport access vlan 10
!
interface Ethernet12
   switchport access vlan 10
!
interface Ethernet13
   switchport access vlan 10
!
interface Ethernet14
   switchport access vlan 10
!
interface Ethernet15
   switchport access vlan 10
!
interface Ethernet16
   switchport access vlan 10
!
interface Ethernet17
   switchport access vlan 10
!
interface Ethernet18
   switchport access vlan 10
!
interface Ethernet19
   switchport access vlan 10
!
interface Ethernet20
   switchport access vlan 10
!
interface Ethernet21
   switchport access vlan 10
!
interface Ethernet22
   switchport access vlan 10
!
interface Ethernet23
   no switchport
   ip address 10.1.1.2/30
!
interface Ethernet24
   no switchport
   ip address 10.1.1.6/30
!
interface Management1
   ip address 192.168.1.203/24
!
interface Management2
!
interface Vlan10
   mtu 9212
   ip address 10.0.1.254/24
!
ip routing
!
router bgp 60000
   bgp log-neighbor-changes
   timers bgp 1 3
   maximum-paths 8 ecmp 8
   neighbor 10.1.1.1 remote-as 60000
   neighbor 10.1.1.1 export-localpref 70
   neighbor 10.1.1.1 maximum-routes 12000 
   neighbor 10.1.1.5 remote-as 60000
   neighbor 10.1.1.5 export-localpref 70
   neighbor 10.1.1.5 maximum-routes 12000 
   network 10.0.1.0/24
!
management telnet
   no shutdown
!
!
end



#### ToR 2 ! device: 10G-TOR-02 (DCS-7124SX, EOS-4.9.0-590041.EOS490RibPimFix (engineering build)) ! ! boot system flash:/EOS-4.9.0-EFT2.swi ! terminal length 30 ! hostname 10G-TOR-02 ! spanning-tree mode mstp ! no aaa root ! username admin secret 5 whogivesashit ! vlan 10 ! interface Ethernet1 switchport access vlan 10 ! interface Ethernet2 switchport access vlan 10 ! interface Ethernet3 switchport access vlan 10 ! interface Ethernet4 switchport access vlan 10 ! interface Ethernet5 switchport access vlan 10 ! interface Ethernet6 switchport access vlan 10 ! interface Ethernet7 switchport access vlan 10 ! interface Ethernet8 switchport access vlan 10 ! interface Ethernet9 switchport access vlan 10 ! interface Ethernet10 switchport access vlan 10 ! interface Ethernet11 switchport access vlan 10 ! interface Ethernet12 switchport access vlan 10 ! interface Ethernet13 switchport access vlan 10 ! interface Ethernet14 switchport access vlan 10 ! interface Ethernet15 switchport access vlan 10 ! interface Ethernet16 switchport access vlan 10 ! interface Ethernet17 switchport access vlan 10 ! interface Ethernet18 switchport access vlan 10 ! interface Ethernet19 switchport access vlan 10 ! interface Ethernet20 switchport access vlan 10 ! interface Ethernet21 switchport access vlan 10 ! interface Ethernet22 switchport access vlan 10 ! interface Ethernet23 no switchport ip address 10.1.2.2/30 ! interface Ethernet24 no switchport ip address 10.1.2.6/30 ! interface Management1 ip address 192.168.1.204/24 ! interface Vlan10 ip address 10.0.2.254/24 ! ip routing ! router bgp 60000 bgp log-neighbor-changes timers bgp 1 3 maximum-paths 8 ecmp 8 neighbor 10.1.2.1 remote-as 60000 neighbor 10.1.2.1 export-localpref 70 neighbor 10.1.2.1 maximum-routes 12000 neighbor 10.1.2.5 remote-as 60000 neighbor 10.1.2.5 export-localpref 70 neighbor 10.1.2.5 maximum-routes 12000 network 10.0.2.0/24 ! management telnet no shutdown ! ! end


아마 스위치 설정에는 더 필요한게 있거나 빼야 할 것이 있을 수 있다. 스스로 네트워크 전문가는 절대 아니라고 생각하고 있으므로, 무언가 더 필요한게 있다고 생각 되시면 조언을 주시면 좋겠다. 


일단 이와 같이 구성된 설정에서, 제대로 통신이 되는지 설정을 확인. 

먼저 서버. Quagga 가 설치된 이후에는 일반 스위치 설정과 같은 CLI 인터페이스를 vtysh 를 통해 진입이 가능하다. 


root@yjjeong:/etc/quagga# vtysh
END # <-- type 'q'
Quagga# sh run
hostname qugga
hostname External01
!
interface eth0
 ip address 172.16.1.250/24
 ipv6 nd suppress-ra
!
interface eth1
 ip address 192.168.1.201/24
 ipv6 nd suppress-ra
!
interface eth2
 ip address 10.254.1.254/30
 ipv6 nd suppress-ra
!
interface eth3
 ip address 10.254.2.254/30
 ipv6 nd suppress-ra
!
interface lo
!
router bgp 60001
 bgp router-id 172.16.1.250
 network 0.0.0.0/0
 neighbor downstream peer-group
 neighbor downstream remote-as 60000
 neighbor downstream ebgp-multihop 10
 neighbor 10.254.1.253 peer-group downstream
 neighbor 10.254.1.253 update-source eth2
 neighbor 10.254.2.254 peer-group downstream
 neighbor 10.254.2.254 update-source eth3
!
ip route 0.0.0.0/0 172.16.1.1
!
ip forwarding
!
line vty
!
end

Quagga# sh ip bgp 
BGP table version is 0, local router ID is 172.16.1.250
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 0.0.0.0          0.0.0.0                  0         32768 i
*> 10.0.1.0/24      10.254.1.253                           0 60000 i
*> 10.1.1.0/30      10.254.1.253                           0 60000 i
*> 10.1.2.0/30      10.254.1.253                           0 60000 i
*> 10.254.1.252/30  10.254.1.253                           0 60000 i

Total number of prefixes 5
Quagga# sh ip route
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
       I - ISIS, B - BGP, > - selected route, * - FIB route

S   0.0.0.0/0 [1/0] via 172.16.1.1, eth0
K>* 0.0.0.0/0 via 172.16.1.1, eth0
B>* 10.0.1.0/24 [20/0] via 10.254.1.253, eth2, 02w0d00h
B>* 10.1.1.0/30 [20/0] via 10.254.1.253, eth2, 02w0d00h
B>* 10.1.2.0/30 [20/0] via 10.254.1.253, eth2, 02w0d00h
B   10.254.1.252/30 [20/0] via 10.254.1.253 inactive, 02w0d00h
C>* 10.254.1.252/30 is directly connected, eth2
C>* 127.0.0.0/8 is directly connected, lo
C>* 172.16.1.0/24 is directly connected, eth0
Quagga# sh ip bgp 
Quagga# ping 10.1.2.1
PING 10.1.2.1 (10.1.2.1) 56(84) bytes of data.
64 bytes from 10.1.2.1: icmp_req=1 ttl=64 time=0.161 ms
64 bytes from 10.1.2.1: icmp_req=2 ttl=64 time=0.115 ms
64 bytes from 10.1.2.1: icmp_req=3 ttl=64 time=0.122 ms
64 bytes from 10.1.2.1: icmp_req=4 ttl=64 time=0.120 ms
64 bytes from 10.1.2.1: icmp_req=5 ttl=64 time=0.114 ms
64 bytes from 10.1.2.1: icmp_req=6 ttl=64 time=0.114 ms
^C
--- 10.1.2.1 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 4998ms
rtt min/avg/max/mdev = 0.114/0.124/0.161/0.019 ms
Quagga# ping 10.1.1.2
PING 10.1.1.2 (10.1.1.2) 56(84) bytes of data.
64 bytes from 10.1.1.2: icmp_req=1 ttl=63 time=0.181 ms
64 bytes from 10.1.1.2: icmp_req=2 ttl=63 time=0.161 ms
^C
--- 10.1.1.2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.161/0.171/0.181/0.010 ms
Quagga# quit


다이어그램 제일 하단의 각 서버들에서도 이상 없이 우분투 서버로의 통신이 가능했다. 만약 여기서 사설네트워크에 대한 인터넷을 제공하고자 한다면, 다음의 iptables 로 SNAT 을 지정해 준다. 


root@yjjeong:/etc/quagga# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE


Quagga 의 BGP 는 아직 ECMP 를 지원하고 있지 않다. 따라서, 만약 서버에서의 ECMP 가 필요하다면 OSPF 를 사용하는 것이 나을 수도 있다. 단순하게 ECMP 의 기능이 필요해서인 것 뿐 아니라, 내부의 네트워크에도 iBGP 대신 OSPF 를 사용하는 것이 보다 효율적일지도 모르겠다. 다만, 랙의 숫자, 즉 ToR 스위치와 이에 따른 하위 네트워크의 숫자가 늘어나는 경우, 라우팅 테이블이 너무 많아지지 않도록 처리하는 방법이 가장 좋지 않겠나 싶다. 


위의 구성은 단순 AGGR - ToR 이지만, Distributed-Core 라 부르는, 다중의 Core - AGGR - Leaf (ToR) 의 구성으로도 쉽게 확장이 가능 할 것임을 알 수 있겠다. 아마도 확장은 아래 비슷한 모델? 



Distributed core architecture



더 좋은 의견이나 테스트 해 볼 사항에 대해 의견이 있다면 얼마든 환영! 

2박 3일 회사에서 신세지고 17시간 잤더니 웬지 개운한 하루. 





( younjin.jeong@gmail.com, 정윤진 )