亚欧色一区w666天堂,色情一区二区三区免费看,少妇特黄A片一区二区三区,亚洲人成网站999久久久综合,国产av熟女一区二区三区

  • 發布文章
  • 消息中心
點贊
收藏
評論
分享
原創

CentOS系統使用Quagga實驗BGP

2024-10-10 02:06:32
60
0

測試環境

(ens36)虛擬機A(ens33)<—(對等網絡:10.10.10.0/30)—>(ens33)虛擬機B(ens36)

?          |                                                                                                                                      |  

 內網 192.168.1.0/24                                                                                                   內網 172.17.1.0/24

安裝Quagga

yum install quagga 

在CentOS7,SELinux默認會阻止quagga將配置文件寫到/usr/sbin/zebra,需要禁用此策略。如果使用的是CentOS 6的則跳過此步驟。

setsebool -P zebra_write_config 1 

配置Zebra

首先創建Zebra配置文件,并啟用Zebra守護進程

cp /usr/share/doc/quagga-0.99.22.4/zebra.conf.sample /etc/quagga/zebra.conf
service zebra start
chkconfig zebra on 

進入vtysh命令行,配置日志存儲文件

[root@192 ~]# vtysh 
Hello, this is Quagga (version 0.99.22.4).
Copyright 1996-2005 Kunihiro Ishiguro, et al.
192.168.247.146# configure terminal
192.168.247.146(config)# log file /var/log/quagga/quagga.log
192.168.247.146(config)# exit
192.168.247.146# write  
Building Configuration...
Configuration saved to /etc/quagga/zebra.conf
[OK]

配置虛擬機A接口參數

192.168.247.146# show interface  
Interface ens33 is up, line protocol detection is disabled
  index 2 metric 1 mtu 1500 
  flags: <UP,BROADCAST,RUNNING,MULTICAST>
  HWaddr: 00:0c:29:c8:63:38
  inet 192.168.247.144/24 broadcast 192.168.247.255
  inet6 fe80::5ad4:63d3:3cf5:591a/64
  inet6 fe80::7637:6430:5b9f:18db/64
Interface ens36 is up, line protocol detection is disabled
  index 3 metric 1 mtu 1500 
  flags: <UP,BROADCAST,RUNNING,MULTICAST>
  HWaddr: 00:0c:29:c8:63:42
  inet 192.168.247.146/24 broadcast 192.168.247.255
  inet6 fe80::d3de:98dd:9c37:c144/64
...
192.168.247.146# conf t
192.168.247.146(config)# interface  ens33
192.168.247.146(config-if)# ip address 10.10.10.1/30
192.168.247.146(config-if)# description to-site-B
192.168.247.146(config-if)# no shutdown 
192.168.247.146(config-if)# interface  ens36
192.168.247.146(config-if)# ip address 192.168.1.1/24
192.168.247.146(config-if)# description to-site-A-LAN
192.168.247.146(config-if)# no shutdown 
192.168.247.146(config-if)# do show interface 
Interface ens33 is up, line protocol detection is disabled
  Description: to-site-B
  index 2 metric 1 mtu 1500 
  flags: <UP,BROADCAST,RUNNING,MULTICAST>
  HWaddr: 00:0c:29:c8:63:38
  inet 10.10.10.1/30 broadcast 10.10.10.3
  inet 192.168.247.144/24 broadcast 192.168.247.255
  inet6 fe80::5ad4:63d3:3cf5:591a/64
  inet6 fe80::7637:6430:5b9f:18db/64
Interface ens36 is up, line protocol detection is disabled
  Description: to-site-A-LAN
  index 3 metric 1 mtu 1500 
  flags: <UP,BROADCAST,RUNNING,MULTICAST>
  HWaddr: 00:0c:29:c8:63:42
  inet 192.168.1.1/24 broadcast 192.168.1.255
  inet 192.168.247.146/24 broadcast 192.168.247.255
  inet6 fe80::d3de:98dd:9c37:c144/64
...

同理,虛擬機B的ens33配置ip address 10.10.10.2/30,ens36配置172.17.1.1/24

配置BGP

cp /usr/share/doc/quagga-0.99.22.4/bgpd.conf.sample /etc/quagga/bgpd.conf
service bgpd start
chkconfig bgpd on

配置鄰居

在一些版本,比如當前版本,發現會有一個默認AS號為7675的BGP會話。由于我們不需要這個會話,所以先把它移除,再添加我們的。

虛擬B進入vtysh

192.168.247.147# conf t
192.168.247.147(config)# no router bgp  7675
192.168.247.147(config)# router bgp  200
192.168.247.147(config-router)# no auto-summary  
192.168.247.147(config-router)# no synchronization  
192.168.247.147(config-router)# neighbor 10.10.10.1 remote-as 100
192.168.247.147(config-router)# neighbor 10.10.10.1 description  "provider A"
192.168.247.147(config-router)# exit
192.168.247.147(config)# exit
192.168.247.147# write

查看BGP鄰居是否建立

192.168.247.147# show ip bgp summary  
BGP router identifier 10.10.10.2, local AS number 200
RIB entries 0, using 0 bytes of memory
Peers 1, using 4560 bytes of memory
?
Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.10.10.1      4   100       2       3        0    0    0 00:00:53        0

從輸出中,我們可以看到"State/PfxRcd"部分。如果對等關閉,輸出將會顯示"Idle"或者"Active"。"Active"意味著路由器正在積極地尋找鄰居、前綴或者路由。當對等是up狀態,"State/PfxRcd"下的輸出狀態將會從特殊鄰居接收到前綴號。在這個例子的輸出中,BGP對等只是在AS100和AS200之間呈up狀態。因此沒有前綴被更改,所以最右邊列的數值是0。

配置前綴通告

虛擬機A中執行

192.168.247.146# conf terminal  
192.168.247.146(config)# router bgp 100
192.168.247.146(config-router)# network 192.168.1.0/24
192.168.247.146(config-router)# exit

虛擬機B中執行

192.168.247.147# conf terminal  
192.168.247.147(config)# router bgp 200
192.168.247.147(config-router)# network 172.17.1.0/24
192.168.247.147(config-router)# exit

以虛擬機B為例:

可以看到前綴數量改變

192.168.247.147# show ip bgp summary 
BGP router identifier 10.10.10.2, local AS number 200
RIB entries 3, using 336 bytes of memory
Peers 1, using 4560 bytes of memory
?
Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.10.10.1      4   100      40      41        0    0    0 00:37:55        1

Total number of neighbors 1

回到虛擬機B,可以一下命令查看鄰居收到的前綴總數

192.168.247.147# show ip bgp neighbors 10.10.10.1 advertised-routes 
BGP table version is 0, local router ID is 10.10.10.2
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
*> 172.17.1.0/24    10.10.10.2               0         32768 i
?
Total number of prefixes 1

查看哪些前綴是從鄰居10.10.10.1收到的

192.168.247.147# show ip bgp neighbors 10.10.10.1 routes 
BGP table version is 0, local router ID is 10.10.10.2
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
*> 192.168.1.0      10.10.10.1               0             0 100 i
?
Total number of prefixes 1

查看所有的BGP路由器

192.168.247.147# show ip bgp 
BGP table version is 0, local router ID is 10.10.10.2
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
*> 172.17.1.0/24    0.0.0.0                  0         32768 i
*> 192.168.1.0      10.10.10.1               0             0 100 i
?
Total number of prefixes 2

其他命令如查看所有路由、只看BGP路由等

192.168.247.147# show 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.247.2, ens33
C>* 10.10.10.0/30 is directly connected, ens33
C>* 127.0.0.0/8 is directly connected, lo
C>* 172.17.1.0/24 is directly connected, ens36
B>* 192.168.1.0/24 [20/0] via 10.10.10.1, ens33, 00:05:29
C>* 192.168.122.0/24 is directly connected, virbr0
C * 192.168.247.0/24 is directly connected, ens36
C>* 192.168.247.0/24 is directly connected, ens33
192.168.247.147# show ip route bgp 
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, A - Babel,
       > - selected route, * - FIB route
?
B>* 192.168.1.0/24 [20/0] via 10.10.10.1, ens33, 00:05:33
 
0條評論
作者已關閉評論
c****k
8文章數
0粉絲數
c****k
8 文章 | 0 粉絲
原創

CentOS系統使用Quagga實驗BGP

2024-10-10 02:06:32
60
0

測試環境

(ens36)虛擬機A(ens33)<—(對等網絡:10.10.10.0/30)—>(ens33)虛擬機B(ens36)

?          |                                                                                                                                      |  

 內網 192.168.1.0/24                                                                                                   內網 172.17.1.0/24

安裝Quagga

yum install quagga 

在CentOS7,SELinux默認會阻止quagga將配置文件寫到/usr/sbin/zebra,需要禁用此策略。如果使用的是CentOS 6的則跳過此步驟。

setsebool -P zebra_write_config 1 

配置Zebra

首先創建Zebra配置文件,并啟用Zebra守護進程

cp /usr/share/doc/quagga-0.99.22.4/zebra.conf.sample /etc/quagga/zebra.conf
service zebra start
chkconfig zebra on 

進入vtysh命令行,配置日志存儲文件

[root@192 ~]# vtysh 
Hello, this is Quagga (version 0.99.22.4).
Copyright 1996-2005 Kunihiro Ishiguro, et al.
192.168.247.146# configure terminal
192.168.247.146(config)# log file /var/log/quagga/quagga.log
192.168.247.146(config)# exit
192.168.247.146# write  
Building Configuration...
Configuration saved to /etc/quagga/zebra.conf
[OK]

配置虛擬機A接口參數

192.168.247.146# show interface  
Interface ens33 is up, line protocol detection is disabled
  index 2 metric 1 mtu 1500 
  flags: <UP,BROADCAST,RUNNING,MULTICAST>
  HWaddr: 00:0c:29:c8:63:38
  inet 192.168.247.144/24 broadcast 192.168.247.255
  inet6 fe80::5ad4:63d3:3cf5:591a/64
  inet6 fe80::7637:6430:5b9f:18db/64
Interface ens36 is up, line protocol detection is disabled
  index 3 metric 1 mtu 1500 
  flags: <UP,BROADCAST,RUNNING,MULTICAST>
  HWaddr: 00:0c:29:c8:63:42
  inet 192.168.247.146/24 broadcast 192.168.247.255
  inet6 fe80::d3de:98dd:9c37:c144/64
...
192.168.247.146# conf t
192.168.247.146(config)# interface  ens33
192.168.247.146(config-if)# ip address 10.10.10.1/30
192.168.247.146(config-if)# description to-site-B
192.168.247.146(config-if)# no shutdown 
192.168.247.146(config-if)# interface  ens36
192.168.247.146(config-if)# ip address 192.168.1.1/24
192.168.247.146(config-if)# description to-site-A-LAN
192.168.247.146(config-if)# no shutdown 
192.168.247.146(config-if)# do show interface 
Interface ens33 is up, line protocol detection is disabled
  Description: to-site-B
  index 2 metric 1 mtu 1500 
  flags: <UP,BROADCAST,RUNNING,MULTICAST>
  HWaddr: 00:0c:29:c8:63:38
  inet 10.10.10.1/30 broadcast 10.10.10.3
  inet 192.168.247.144/24 broadcast 192.168.247.255
  inet6 fe80::5ad4:63d3:3cf5:591a/64
  inet6 fe80::7637:6430:5b9f:18db/64
Interface ens36 is up, line protocol detection is disabled
  Description: to-site-A-LAN
  index 3 metric 1 mtu 1500 
  flags: <UP,BROADCAST,RUNNING,MULTICAST>
  HWaddr: 00:0c:29:c8:63:42
  inet 192.168.1.1/24 broadcast 192.168.1.255
  inet 192.168.247.146/24 broadcast 192.168.247.255
  inet6 fe80::d3de:98dd:9c37:c144/64
...

同理,虛擬機B的ens33配置ip address 10.10.10.2/30,ens36配置172.17.1.1/24

配置BGP

cp /usr/share/doc/quagga-0.99.22.4/bgpd.conf.sample /etc/quagga/bgpd.conf
service bgpd start
chkconfig bgpd on

配置鄰居

在一些版本,比如當前版本,發現會有一個默認AS號為7675的BGP會話。由于我們不需要這個會話,所以先把它移除,再添加我們的。

虛擬B進入vtysh

192.168.247.147# conf t
192.168.247.147(config)# no router bgp  7675
192.168.247.147(config)# router bgp  200
192.168.247.147(config-router)# no auto-summary  
192.168.247.147(config-router)# no synchronization  
192.168.247.147(config-router)# neighbor 10.10.10.1 remote-as 100
192.168.247.147(config-router)# neighbor 10.10.10.1 description  "provider A"
192.168.247.147(config-router)# exit
192.168.247.147(config)# exit
192.168.247.147# write

查看BGP鄰居是否建立

192.168.247.147# show ip bgp summary  
BGP router identifier 10.10.10.2, local AS number 200
RIB entries 0, using 0 bytes of memory
Peers 1, using 4560 bytes of memory
?
Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.10.10.1      4   100       2       3        0    0    0 00:00:53        0

從輸出中,我們可以看到"State/PfxRcd"部分。如果對等關閉,輸出將會顯示"Idle"或者"Active"。"Active"意味著路由器正在積極地尋找鄰居、前綴或者路由。當對等是up狀態,"State/PfxRcd"下的輸出狀態將會從特殊鄰居接收到前綴號。在這個例子的輸出中,BGP對等只是在AS100和AS200之間呈up狀態。因此沒有前綴被更改,所以最右邊列的數值是0。

配置前綴通告

虛擬機A中執行

192.168.247.146# conf terminal  
192.168.247.146(config)# router bgp 100
192.168.247.146(config-router)# network 192.168.1.0/24
192.168.247.146(config-router)# exit

虛擬機B中執行

192.168.247.147# conf terminal  
192.168.247.147(config)# router bgp 200
192.168.247.147(config-router)# network 172.17.1.0/24
192.168.247.147(config-router)# exit

以虛擬機B為例:

可以看到前綴數量改變

192.168.247.147# show ip bgp summary 
BGP router identifier 10.10.10.2, local AS number 200
RIB entries 3, using 336 bytes of memory
Peers 1, using 4560 bytes of memory
?
Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.10.10.1      4   100      40      41        0    0    0 00:37:55        1

Total number of neighbors 1

回到虛擬機B,可以一下命令查看鄰居收到的前綴總數

192.168.247.147# show ip bgp neighbors 10.10.10.1 advertised-routes 
BGP table version is 0, local router ID is 10.10.10.2
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
*> 172.17.1.0/24    10.10.10.2               0         32768 i
?
Total number of prefixes 1

查看哪些前綴是從鄰居10.10.10.1收到的

192.168.247.147# show ip bgp neighbors 10.10.10.1 routes 
BGP table version is 0, local router ID is 10.10.10.2
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
*> 192.168.1.0      10.10.10.1               0             0 100 i
?
Total number of prefixes 1

查看所有的BGP路由器

192.168.247.147# show ip bgp 
BGP table version is 0, local router ID is 10.10.10.2
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
*> 172.17.1.0/24    0.0.0.0                  0         32768 i
*> 192.168.1.0      10.10.10.1               0             0 100 i
?
Total number of prefixes 2

其他命令如查看所有路由、只看BGP路由等

192.168.247.147# show 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.247.2, ens33
C>* 10.10.10.0/30 is directly connected, ens33
C>* 127.0.0.0/8 is directly connected, lo
C>* 172.17.1.0/24 is directly connected, ens36
B>* 192.168.1.0/24 [20/0] via 10.10.10.1, ens33, 00:05:29
C>* 192.168.122.0/24 is directly connected, virbr0
C * 192.168.247.0/24 is directly connected, ens36
C>* 192.168.247.0/24 is directly connected, ens33
192.168.247.147# show ip route bgp 
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, A - Babel,
       > - selected route, * - FIB route
?
B>* 192.168.1.0/24 [20/0] via 10.10.10.1, ens33, 00:05:33
 
文章來自個人專欄
文章 | 訂閱
0條評論
作者已關閉評論
作者已關閉評論
0
0