SDN, Czyli jak Automatyzować Konfigurację Sieci Poprzez Netconf/Yang

baza wiedzy Network Expert

SDN (Software Defined Networking) to metody „programowania” sieci poprzez zewnętrzne systemy. Pokażemy jak można łatwo konfigurować BGP na routerze NCS-5501-SE poprzez Netconf/Yang. W materiale omówimy również:

  • Co to są modele – openconfig vs modele IOS-XR czy inne vendorskie
  • Jak możemy konfigurować sieć
  • Jak tworzyć konfigi sieci, aby realizować zaawansowane konfiguracje

Zapraszamy do obejrzenia:

Konfiguracje użyte w przykładach – zarówno wersja IOS-XR i odpowiednik Netconf/yang. Uwaga! Konfigi były tworzone i testowane na IOS-XR 6.3.1 na NCS-5501-SE, na wcześniejszych wersjach raczej na pewno będą błędy.

Konfig IOS-XR

extcommunity-set rt TESTNET_0-out
203364:65000
end-set
!
extcommunity-set rt TESTNET_1-out
203364:65001
end-set
!
extcommunity-set rt TESTNET_2-out
203364:65002
end-set
!
extcommunity-set rt TESTNET_3-out
203364:65003
end-set
!
extcommunity-set rt TESTNET_0-out
203364:65000
end-set
!
extcommunity-set rt TESTNET_1-out
203364:65001
end-set
!
extcommunity-set rt TESTNET_2-out
203364:65002
end-set
!
extcommunity-set rt TESTNET_3-out
203364:65003
end-set
!
prefix-set TESTNET
133.133.65.0/24
end-set
!
prefix-set TESTNET
133.133.65.0/24
end-set
!
prefix-set TESTNETv6
2a06:1eee:10::/48
end-set
!
prefix-set TESTNETv6
2a06:1e00:10::/48
end-set
!
community-set 10
2:2
end-set
!
community-set 11
1:1
end-set
!
community-set 12
2:2
end-set
!
community-set 13
3:3
end-set
!
community-set GLOBAL-COMM-out
1111:11
end-set
!
route-policy TESTNET-int
if destination in TESTNET then
apply TESTNET-nested-in
endif
end-policy
!
route-policy TESTNET-out
if extcommunity rt matches-any TESTNET_1-out then
prepend as-path 62047 1
endif
if extcommunity rt matches-any TESTNET_2-out then
prepend as-path 62047 2
endif
if extcommunity rt matches-any TESTNET_3-out then
prepend as-path 62047 3
endif
if extcommunity rt matches-any TESTNET_0-out then
set community (no-advertise)
endif
if community matches-any GLOBAL-COMM-out then
done
endif
end-policy
!
route-policy TESTNET-int
if destination in TESTNET then
apply TESTNET-nested-in
endif
end-policy
!
route-policy TESTNET-out
if extcommunity rt matches-any TESTNET_1-out then
prepend as-path 62047 1
endif
if extcommunity rt matches-any TESTNET_2-out then
prepend as-path 62047 2
endif
if extcommunity rt matches-any TESTNET_3-out then
prepend as-path 62047 3
endif
if extcommunity rt matches-any TESTNET_0-out then
set community (no-advertise)
endif
if community matches-any GLOBAL-COMM-out then
done
endif
end-policy
!
route-policy TESTNET-int-v6
if destination in TESTNETv6 then
apply TESTNET-nested-in
endif
end-policy
!
route-policy TESTNET-int-v6
if destination in TESTNETv6 then
apply TESTNET-nested-in
endif
end-policy
!
route-policy TESTNET-nested-in
if community matches-any 10 then
set community (no-advertise)
elseif community matches-any 11 then
prepend as-path 62047
elseif community matches-any 12 then
prepend as-path 62047 2
elseif community matches-any 13 then
prepend as-path 62047 3
else
set local-preference 400
set community (62047:2, 62047:20, 62047:1000, 62047:1346) additive
endif
end-policy
!
route-policy TESTNET-nested-in
if community matches-any 10 then
set community (no-advertise)
elseif community matches-any 11 then
prepend as-path 62047
elseif community matches-any 12 then
prepend as-path 62047 2
elseif community matches-any 13 then
prepend as-path 62047 3
else
set local-preference 400
set community (62047:2, 62047:20, 62047:1000, 62047:1346) additive
endif
end-policy
!
!
!
router bgp 62047
address-family ipv4 unicast
!
address-family ipv6 unicast
!
neighbor 178.216.41.90
remote-as 213364
description TESTNET
address-family ipv4 unicast
weight 5
route-policy TESTNET-int in
maximum-prefix 250 75 restart 60
route-policy TESTNET-out out
next-hop-unchanged
!
!
neighbor 2001:7f8:5b::346
remote-as 203364
description TESTNET
address-family ipv6 unicast
route-policy TESTNET-int-v6 in
route-policy TESTNET-out out
next-hop-unchanged
!
!

Odpowiednik Netconf/YANG

 <ipv4-acl-and-prefix-list xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ipv4-acl-cfg">
<prefixes>
<prefix>
<prefix-list-name>TESTNET</prefix-list-name>
<prefix-list-entries>
<prefix-list-entry>
<sequence-number>10</sequence-number>
<grant>permit</grant>
<prefix>133.133.65.0</prefix>
<netmask>255.255.255.0</netmask>
</prefix-list-entry>
</prefix-list-entries>
</prefix>
</prefixes>
</ipv4-acl-and-prefix-list>
<routing-policy xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-policy-repository-cfg">
<sets>
<extended-community-rt-sets>
<extended-community-rt-set>
<set-name>TESTNET_0-out</set-name>
<rpl-extended-community-rt-set>extcommunity-set rt TESTNET_0-out
203364:65000
end-set
</rpl-extended-community-rt-set>
</extended-community-rt-set>
<extended-community-rt-set>
<set-name>TESTNET_1-out</set-name>
<rpl-extended-community-rt-set>extcommunity-set rt TESTNET_1-out
203364:65001
end-set
</rpl-extended-community-rt-set>
</extended-community-rt-set>
<extended-community-rt-set>
<set-name>TESTNET_2-out</set-name>
<rpl-extended-community-rt-set>extcommunity-set rt TESTNET_2-out
203364:65002
end-set
</rpl-extended-community-rt-set>
</extended-community-rt-set>
<extended-community-rt-set>
<set-name>TESTNET_3-out</set-name>
<rpl-extended-community-rt-set>extcommunity-set rt TESTNET_3-out
203364:65003
end-set
</rpl-extended-community-rt-set>
</extended-community-rt-set>
</extended-community-rt-sets>
<prefix-sets>
<prefix-set>
<set-name>TESTNET</set-name>
<rpl-prefix-set>prefix-set TESTNET
133.133.65.0/24
end-set
</rpl-prefix-set>
</prefix-set>
<prefix-set>
<set-name>TESTNETv6</set-name>
<rpl-prefix-set>prefix-set TESTNETv6
2a06:1eee:10::/48
end-set
</rpl-prefix-set>
</prefix-set>
</prefix-sets>
<community-sets>
<community-set>
<set-name>10</set-name>
<rpl-community-set>community-set 10
2:2
end-set
</rpl-community-set>
</community-set>
<community-set>
<set-name>11</set-name>
<rpl-community-set>community-set 11
1:1
end-set
</rpl-community-set>
</community-set>
<community-set>
<set-name>12</set-name>
<rpl-community-set>community-set 12
2:2
end-set
</rpl-community-set>
</community-set>
<community-set>
<set-name>13</set-name>
<rpl-community-set>community-set 13
3:3
end-set
</rpl-community-set>
</community-set>
<community-set>
<set-name>GLOBAL-COMM-out</set-name>
<rpl-community-set>community-set GLOBAL-COMM-out
1111:11
end-set
</rpl-community-set>
</community-set>
</community-sets>
</sets>
<route-policies>
<route-policy>
<route-policy-name>TESTNET-int</route-policy-name>
<rpl-route-policy>route-policy TESTNET-int
if destination in TESTNET then
apply TESTNET-nested-in
endif
end-policy
</rpl-route-policy>
</route-policy>
<route-policy>
<route-policy-name>TESTNET-out</route-policy-name>
<rpl-route-policy>route-policy TESTNET-out
if extcommunity rt matches-any TESTNET_1-out then
prepend as-path 62047 1
endif
if extcommunity rt matches-any TESTNET_2-out then
prepend as-path 62047 2
endif
if extcommunity rt matches-any TESTNET_3-out then
prepend as-path 62047 3
endif
if extcommunity rt matches-any TESTNET_0-out then
set community (no-advertise)
endif
if community matches-any GLOBAL-COMM-out then
done
endif
end-policy
</rpl-route-policy>
</route-policy>
<route-policy>
<route-policy-name>TESTNET-int-v6</route-policy-name>
<rpl-route-policy>route-policy TESTNET-int-v6
if destination in TESTNETv6 then
apply TESTNET-nested-in
endif
end-policy
</rpl-route-policy>
</route-policy>
<route-policy>
<route-policy-name>TESTNET-nested-in</route-policy-name>
<rpl-route-policy>route-policy TESTNET-nested-in
if community matches-any 10 then
set community (no-advertise)
elseif community matches-any 11 then
prepend as-path 62047
elseif community matches-any 12 then
prepend as-path 62047 2
elseif community matches-any 13 then
prepend as-path 62047 3
else
set local-preference 400
set community (62047:2, 62047:20, 62047:1000, 62047:1346) additive
endif
end-policy
</rpl-route-policy>
</route-policy>
</route-policies>
</routing-policy>
<bgp xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ipv4-bgp-cfg">
<instance>
<instance-name>default</instance-name>
<instance-as>
<as>0</as>
<four-byte-as>
<as>62047</as>
<bgp-running/>
<default-vrf>
<bgp-entity>
<neighbors>
<neighbor>
<neighbor-address>178.216.41.90</neighbor-address>
<remote-as>
<as-xx>0</as-xx>
<as-yy>213364</as-yy>
</remote-as>
<description>TESTNET</description>
<neighbor-afs>
<neighbor-af>
<af-name>ipv4-unicast</af-name>
<activate/>
<default-weight>5</default-weight>
<route-policy-in>TESTNET-int</route-policy-in>
<maximum-prefixes>
<prefix-limit>250</prefix-limit>
<warning-percentage>75</warning-percentage>
<warning-only>false</warning-only>
<restart-time>60</restart-time>
<discard-extra-paths>false</discard-extra-paths>
</maximum-prefixes>
<route-policy-out>TESTNET-out</route-policy-out>
<next-hop-unchanged>true</next-hop-unchanged>
</neighbor-af>
</neighbor-afs>
</neighbor>
<neighbor>
<neighbor-address>2001:7f8:5b::346</neighbor-address>
<remote-as>
<as-xx>0</as-xx>
<as-yy>213364</as-yy>
</remote-as>
<description>TESTNET</description>
<neighbor-afs>
<neighbor-af>
<af-name>ipv6-unicast</af-name>
<activate/>
<route-policy-in>TESTNET-int-v6</route-policy-in>
<route-policy-out>TESTNET-out</route-policy-out>
<next-hop-unchanged>true</next-hop-unchanged>
</neighbor-af>
</neighbor-afs>
</neighbor>
</neighbors>
</bgp-entity>
</default-vrf>
</four-byte-as>
</instance-as>
</instance>
</bgp>

Od samego początku naszej działalności stawialiśmy na profesjonalne podejście do naszych Klientów

Network w liczbach

0
lat na rynku
0
realizacji
0
Klientów

Od samego początku naszej działalności stawialiśmy na profesjonalne podejście do naszych Klientów

Network w liczbach

0
lat na rynku
0
realizacji
0
Klientów
2019-01-07T22:56:18+00:00