20180814_jeffrey - silenceuncrio/diary GitHub Wiki

0845

整理一下昨天透過 teamview 得到的 BGP 相關情報

PI 的工程師目前在 Airtel 作測試

測試環境如下

+-----------+                   +---------+    +---------+                   +-----------+
|           |                   |         |    |         |                   |           |
|  AS-101   | Wan               |         |    |   LTE   |    B              |  AS-9730  |
|           | 10.55.11.66/24    | eNode-B |    | Network |    10.55.11.69/24 |           |
|         A +-------------------+         +----+         +-------------------+ B         |
|           |                   +---------+    +---------+                   |           |
|           |                                                                |           |
|           |                                                                |           |
|  M360-P   |                                                                |  X-device |
|           | Loopback                                           Loopback    |           |
|           | 4.4.4.1/32                                         3.3.3.1/32  |           |
|         C +----------------------------------------------------------------+ D         |
|           |                              eBGP                              |           |
|           |                                                                |           |
|           |                                                                |           |
+-----------+                                                                +-----------+

M360-PX-device 之間的 eBGP 要透過 CD 作溝通

先試著在我們這邊模擬一下

1000

+-----------+                                                                +-----------+
|           |                                                                |           |
|  AS-101   | LAN                                            LAN             |  AS-110   |
|           | 192.168.1.1/24                                 192.168.1.10/24 |           |
|         A +----------------------------------------------------------------+ B         |
|           |                                                                |           |
|           |                                                                |           |
|           |                                                                |           |
|  M360-P   |                                                                |  M300     |
|           | Loopback                                           Loopback    |           |
|           | 4.4.4.1/32                                         3.3.3.1/32  |           |
|         C +----------------------------------------------------------------+ D         |
|           |                              eBGP                              |           |
|           |                                                                |           |
|           |                                                                |           |
+-----------+                                                                +-----------+

checkpoint

A ping B

root@M360-P:~# ping 192.168.1.10 -c 4
PING 192.168.1.10 (192.168.1.10): 56 data bytes
64 bytes from 192.168.1.10: seq=0 ttl=64 time=1.127 ms
64 bytes from 192.168.1.10: seq=1 ttl=64 time=1.029 ms
64 bytes from 192.168.1.10: seq=2 ttl=64 time=0.994 ms
64 bytes from 192.168.1.10: seq=3 ttl=64 time=1.441 ms

--- 192.168.1.10 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.994/1.147/1.441 ms

B ping A

root@M300:~# ping 192.168.1.1 -c 4
PING 192.168.1.1 (192.168.1.1): 56 data bytes
64 bytes from 192.168.1.1: seq=0 ttl=64 time=5.652 ms
64 bytes from 192.168.1.1: seq=1 ttl=64 time=1.099 ms
64 bytes from 192.168.1.1: seq=2 ttl=64 time=1.490 ms
64 bytes from 192.168.1.1: seq=3 ttl=64 time=1.240 ms

--- 192.168.1.1 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 1.099/2.370/5.652 ms

C D 互 ping 之前要先建立該 Loopback interface

建立 C

ifconfig lo:as101 4.4.4.1 netmask 255.255.255.255

檢查 C

root@M360-P:~# ifconfig lo:as101
lo:as101  Link encap:Local Loopback
          inet addr:4.4.4.1  Mask:255.255.255.255
          UP LOOPBACK RUNNING  MTU:65536  Metric:1

建立 D

ifconfig lo:as110 3.3.3.1 netmask 255.255.255.255

檢查 D

root@M300:~# ifconfig lo:as110
lo:as110  Link encap:Local Loopback
          inet addr:3.3.3.1  Mask:255.255.255.255
          UP LOOPBACK RUNNING  MTU:65536  Metric:1

M360-P 建立 static route for D

ip route add 3.3.3.1 via 192.168.1.10

C ping D

root@M360-P:~# ping 3.3.3.1 -c 4
PING 3.3.3.1 (3.3.3.1): 56 data bytes
64 bytes from 3.3.3.1: seq=0 ttl=64 time=1.606 ms
64 bytes from 3.3.3.1: seq=1 ttl=64 time=1.043 ms
64 bytes from 3.3.3.1: seq=2 ttl=64 time=0.996 ms
64 bytes from 3.3.3.1: seq=3 ttl=64 time=1.011 ms

--- 3.3.3.1 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.996/1.164/1.606 ms

M300 建立 static route for C

ip route add 4.4.4.1 via 192.168.1.1

D ping C

root@MR400-G:~# ping 4.4.4.1 -c 4
PING 4.4.4.1 (4.4.4.1): 56 data bytes
64 bytes from 4.4.4.1: seq=0 ttl=64 time=1.375 ms
64 bytes from 4.4.4.1: seq=1 ttl=64 time=1.134 ms
64 bytes from 4.4.4.1: seq=2 ttl=64 time=1.191 ms
64 bytes from 4.4.4.1: seq=3 ttl=64 time=1.523 ms

--- 4.4.4.1 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 1.134/1.305/1.523 ms

基本環境的建置已完成

依據該環境來配置 M360-P 與 M300 的 BGP

M360-P

root@M360-P:~# cat /etc/quagga/bgpd.conf
router bgp 101
  redistribute kernel
  redistribute connected
  network 4.4.10.0/24
  network 4.4.20.0/24
  neighbor 3.3.3.1 remote-as 110
  neighbor 3.3.3.1 ebgp-multihop
log file /tmp/bgpd.log

M300

root@M300:~# cat /etc/quagga/bgpd.conf
router bgp 110
  redistribute kernel
  redistribute connected
  redistribute rip
  redistribute ospf
  network 3.3.10.0/24
  network 3.3.11.0/24
  neighbor 4.4.4.1 remote-as 101
  neighbor 4.4.4.1 ebgp-multihop
log file /tmp/bgpd.log

看一下 M360-P 學到的 route

root@M360-P:~# ip route list
3.3.3.1 via 192.168.1.10 dev lan.1
192.168.1.0/24 dev lan.1  proto kernel  scope link  src 192.168.1.1
192.168.2.0/24 dev lan  proto kernel  scope link  src 192.168.2.1

沒學到任何東西 ???

看一下 log

root@M360-P:~# cat /tmp/bgpd.log
2018/07/24 06:40:56 BGP: BGPd 1.1.0 starting: vty@2605, bgp@<all>:179 pid 15066
2018/07/24 06:40:57 BGP: stream_read_try: read failed on fd 15: Connection reset by peer
2018/07/24 06:40:57 BGP: 3.3.3.1 [Error] bgp_read_packet error: Connection reset by peer
2018/07/24 06:41:07 BGP: stream_read_try: read failed on fd 15: Connection reset by peer
2018/07/24 06:41:07 BGP: 3.3.3.1 [Error] bgp_read_packet error: Connection reset by peer
2018/07/24 06:41:17 BGP: stream_read_try: read failed on fd 15: Connection reset by peer
2018/07/24 06:41:17 BGP: 3.3.3.1 [Error] bgp_read_packet error: Connection reset by peer
2018/07/24 06:41:27 BGP: stream_read_try: read failed on fd 15: Connection reset by peer
2018/07/24 06:41:27 BGP: 3.3.3.1 [Error] bgp_read_packet error: Connection reset by peer
2018/07/24 06:41:37 BGP: stream_read_try: read failed on fd 15: Connection reset by peer
2018/07/24 06:41:37 BGP: 3.3.3.1 [Error] bgp_read_packet error: Connection reset by peer
2018/07/24 06:41:47 BGP: stream_read_try: read failed on fd 15: Connection reset by peer
2018/07/24 06:41:47 BGP: 3.3.3.1 [Error] bgp_read_packet error: Connection reset by peer
2018/07/24 06:41:57 BGP: stream_read_try: read failed on fd 15: Connection reset by peer
2018/07/24 06:41:57 BGP: 3.3.3.1 [Error] bgp_read_packet error: Connection reset by peer
2018/07/24 06:42:07 BGP: stream_read_try: read failed on fd 15: Connection reset by peer
2018/07/24 06:42:07 BGP: 3.3.3.1 [Error] bgp_read_packet error: Connection reset by peer
2018/07/24 06:42:17 BGP: stream_read_try: read failed on fd 15: Connection reset by peer
2018/07/24 06:42:17 BGP: 3.3.3.1 [Error] bgp_read_packet error: Connection reset by peer
2018/07/24 06:42:27 BGP: stream_read_try: read failed on fd 15: Connection reset by peer
2018/07/24 06:42:27 BGP: 3.3.3.1 [Error] bgp_read_packet error: Connection reset by peer
2018/07/24 06:42:37 BGP: stream_read_try: read failed on fd 15: Connection reset by peer
2018/07/24 06:42:37 BGP: 3.3.3.1 [Error] bgp_read_packet error: Connection reset by peer
2018/07/24 06:42:47 BGP: stream_read_try: read failed on fd 15: Connection reset by peer
2018/07/24 06:42:47 BGP: 3.3.3.1 [Error] bgp_read_packet error: Connection reset by peer
2018/07/24 06:42:57 BGP: stream_read_try: read failed on fd 15: Connection reset by peer
2018/07/24 06:42:57 BGP: 3.3.3.1 [Error] bgp_read_packet error: Connection reset by peer
...

看一下 M300

root@M300:~# ip route list
4.4.4.1 via 192.168.1.1 dev lan
192.168.1.0/24 dev lan  proto kernel  scope link  src 192.168.1.10

也是沒學到

看一下 M300 的 log

cat /tmp/bgpd.log
2018/08/14 02:05:53 BGP: BGPd 0.99.24.1 starting: vty@2605, bgp@<all>:179
2018/08/14 02:06:39 BGP: Terminating on signal
2018/08/14 02:06:39 BGP: BGPd 0.99.24.1 starting: vty@2605, bgp@<all>:179

1030

看一下正常版的 BGP

M360-P config

root@M360-P:~# cat /etc/quagga/bgpd.conf
router bgp 101
  redistribute kernel
  redistribute connected
  network 4.4.10.0/24
  network 4.4.20.0/24
  neighbor 192.168.1.10 remote-as 110
  neighbor 192.168.1.10 ebgp-multihop
log file /tmp/bgpd.log

M300 config

root@M300:~# cat /etc/quagga/bgpd.conf
router bgp 110
  redistribute kernel
  redistribute connected
  redistribute rip
  redistribute ospf
  network 3.3.10.0/24
  network 3.3.11.0/24
  neighbor 192.168.1.1 remote-as 101
  neighbor 192.168.1.1 ebgp-multihop
log file /tmp/bgpd.log

刪除兩邊的 log

rm /tmp/bgpd.log

start 兩邊的 bgpd

bgpd -d -u root

check M360-P 行為

route 有學到

root@M360-P:~# ip route list
3.3.3.1 via 192.168.1.10 dev lan.1
3.3.10.0/24 via 192.168.1.10 dev lan.1  proto zebra  metric 20
3.3.11.0/24 via 192.168.1.10 dev lan.1  proto zebra  metric 20
192.168.1.0/24 dev lan.1  proto kernel  scope link  src 192.168.1.1
192.168.2.0/24 dev lan  proto kernel  scope link  src 192.168.2.1
root@M360-P:~#

log 如下

root@M360-P:~# cat /tmp/bgpd.log
2018/07/24 06:57:00 BGP: BGPd 1.1.0 starting: vty@2605, bgp@<all>:179 pid 2061
2018/07/24 06:57:07 BGP: %ADJCHANGE: neighbor 192.168.1.10 Up

check M300 行為

route 有學到

root@MR400-G:~# ip route list
4.4.4.1 via 192.168.1.1 dev lan
4.4.10.0/24 via 192.168.1.1 dev lan  proto zebra
4.4.20.0/24 via 192.168.1.1 dev lan  proto zebra
192.168.1.0/24 dev lan  proto kernel  scope link  src 192.168.1.10
192.168.2.0/24 via 192.168.1.1 dev lan  proto zebra

log 如下

root@MR400-G:~# cat /tmp/bgpd.log
2018/08/14 02:23:40 BGP: BGPd 0.99.24.1 starting: vty@2605, bgp@<all>:179

1055

ariel 請我先 update 目前的情報到 wiki 然後轉一份 pdf 給他好讓他 mail 給 PI

1110

[issue]BGP with Loopback interface 優先處理

因為這幾天 PI 的工程師都會在 airtel 實驗室

1135

commit fc9ef32a9230c62724be4337f2aef0a8589c9207
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Tue Aug 14 11:32:47 2018 +0800

    correct the multi-language value for 'WAN Connection Time' at 'Status' web page for xentino

 proscend/prosrc/www/app/locale-en.json    | 4 ++--
 proscend/prosrc/www/app/locale-fr.json    | 4 ++--
 proscend/prosrc/www/app/locale-zh-tw.json | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

1305

ariel 提供一條線索 https://github.com/FRRouting/frr/issues/1622

雖然看起來沒啥麼相關

不過 static route 是寫在 zebra 的 config 裡面

我也來試試

+-----------+                                                                +-----------+
|           |                                                                |           |
|  AS-101   | LAN                                            LAN             |  AS-110   |
|           | 192.168.1.1/24                                 192.168.1.10/24 |           |
|         A +----------------------------------------------------------------+ B         |
|           |                                                                |           |
|           |                                                                |           |
|           |                                                                |           |
|  M360-P   |                                                                |  M300     |
|           | Loopback                                           Loopback    |           |
|           | 4.4.4.1/32                                         3.3.3.1/32  |           |
|         C +----------------------------------------------------------------+ D         |
|           |                              eBGP                              |           |
|           |                                                                |           |
|           |                                                                |           |
+-----------+                                                                +-----------+

建立 loopback interface

M360

ifconfig lo:as101 4.4.4.1 netmask 255.255.255.255

M300

ifconfig lo:as110 3.3.3.1 netmask 255.255.255.255

kill zebra daemon at both device

killall zebra

prepare zebra configuration contain static route

M360

root@M360-P:~# cat /etc/quagga/zebra.conf
hostname Router
password zebra

ip route 3.3.3.1/32 192.168.1.10

M300

root@M300:~# cat /etc/quagga/zebra.conf
hostname Router
password zebra

ip route 4.4.4.1/32 192.168.1.1

start zebra daemon at both device

M360

/usr/sbin/quagga.init start zebra

M300

zebra -d -u root

prepare the configuration of bgp

M360-P

root@M360-P:~# cat /etc/quagga/bgpd.conf
router bgp 101
  redistribute kernel
  redistribute connected
  network 4.4.10.0/24
  network 4.4.20.0/24
  neighbor 3.3.3.1 remote-as 110
  neighbor 3.3.3.1 ebgp-multihop
log file /tmp/bgpd.log

M300

root@M300:~# cat /etc/quagga/bgpd.conf
router bgp 110
  redistribute kernel
  redistribute connected
  redistribute rip
  redistribute ospf
  network 3.3.10.0/24
  network 3.3.11.0/24
  neighbor 4.4.4.1 remote-as 101
  neighbor 4.4.4.1 ebgp-multihop
log file /tmp/bgpd.log

start bgp daemon at both device

bgpd -d -u root

M360

lan  proto kernel  scope link  src 192.168.2.1
root@M360-P:~# cat /tmp/bgpd.log
2018/07/24 08:37:02 BGP: BGPd 1.1.0 starting: vty@2605, bgp@<all>:179 pid 25739
2018/07/24 08:37:13 BGP: stream_read_try: read failed on fd 12: Connection reset by peer
2018/07/24 08:37:13 BGP: 3.3.3.1 [Error] bgp_read_packet error: Connection reset by peer
2018/07/24 08:37:23 BGP: stream_read_try: read failed on fd 12: Connection reset by peer
2018/07/24 08:37:23 BGP: 3.3.3.1 [Error] bgp_read_packet error: Connection reset by peer
2018/07/24 08:37:33 BGP: stream_read_try: read failed on fd 12: Connection reset by peer
2018/07/24 08:37:33 BGP: 3.3.3.1 [Error] bgp_read_packet error: Connection reset by peer
2018/07/24 08:37:43 BGP: stream_read_try: read failed on fd 12: Connection reset by peer
2018/07/24 08:37:43 BGP: 3.3.3.1 [Error] bgp_read_packet error: Connection reset by peer
2018/07/24 08:37:53 BGP: stream_read_try: read failed on fd 12: Connection reset by peer
2018/07/24 08:37:53 BGP: 3.3.3.1 [Error] bgp_read_packet error: Connection reset by peer
2018/07/24 08:38:03 BGP: stream_read_try: read failed on fd 12: Connection reset by peer
2018/07/24 08:38:03 BGP: 3.3.3.1 [Error] bgp_read_packet error: Connection reset by peer

M300

root@MR400-G:~# cat /tmp/bgpd.log
2018/08/14 05:14:39 BGP: BGPd 0.99.24.1 starting: vty@2605, bgp@<all>:179

結果證明 static route 設定在 zebra 解決不了問題

1335

不過為什麼 M360 的 log 和 M300 會不一樣呢

再在找一台 M360 試試

參考 https://github.com/silenceuncrio/diary/wiki/20180712_jeffrey

1345

先配合 PI 的步調作一下測試也收集一些情報

1355

等待的同時先用兩台 M360 試一下

+-----------+                                                                +-----------+
|           |                                                                |           |
|  AS-101   | LAN                                            LAN             |  AS-110   |
|           | 192.168.1.1/24                                 192.168.1.10/24 |           |
|         A +----------------------------------------------------------------+ B         |
|           |                                                                |           |
|           |                                                                |           |
|           |                                                                |           |
|  M360-P   |                                                                |  M360-P   |
|           | Loopback                                           Loopback    |           |
|           | 4.4.4.1/32                                         3.3.3.1/32  |           |
|         C +----------------------------------------------------------------+ D         |
|           |                              eBGP                              |           |
|           |                                                                |           |
|           |                                                                |           |
+-----------+                                                                +-----------+

kill bgp daemon at both device

killall bgpd

create loopback interface

M360-P AS-101

ifconfig lo:as101 4.4.4.1 netmask 255.255.255.255

M360-P AS-110

ifconfig lo:as110 3.3.3.1 netmask 255.255.255.255

static route

M360-P AS-101

ip route add 3.3.3.1 via 192.168.1.10

M360-P AS-110

ip route add 4.4.4.1 via 192.168.1.1

注意這邊兩台 M360 MAC 會衝到

M360-P AS-101

ifconfig eth0 down
ifconfig eth0 hw ether 00:03:79:30:01:01
ifconfig eth0 up

M360-P AS-110

ifconfig eth0 down
ifconfig eth0 hw ether 00:03:79:30:01:10
ifconfig eth0 up

the configuration of bgp

M360-P AS-101

root@M360-P:~# cat /etc/quagga/bgpd.conf
router bgp 101
  redistribute kernel
  redistribute connected
  network 4.4.10.0/24
  network 4.4.20.0/24
  neighbor 3.3.3.1 remote-as 110
  neighbor 3.3.3.1 ebgp-multihop
log file /tmp/bgpd.log

M360-P AS-110

root@M360-P:~# cat /etc/quagga/bgpd.conf
router bgp 110
  redistribute kernel
  redistribute connected
  redistribute rip
  redistribute ospf
  network 3.3.10.0/24
  network 3.3.11.0/24
  neighbor 4.4.4.1 remote-as 101
  neighbor 4.4.4.1 ebgp-multihop
log file /tmp/bgpd.log

start bgp daemon at both device

bgpd -d -u root

趕緊看一下 log

M360-P AS-101

root@M360-P:~# cat /tmp/bgpd.log
2018/07/24 08:46:51 BGP: BGPd 1.1.0 starting: vty@2605, bgp@<all>:179 pid 26012

M360-P AS-110

root@M360-P:~# cat /tmp/bgpd.log
2018/07/24 06:18:09 BGP: BGPd 1.1.0 starting: vty@2605, bgp@<all>:179 pid 11475

過一下再看 log

M360-P AS-101

root@M360-P:~# cat /tmp/bgpd.log
2018/07/24 08:46:51 BGP: BGPd 1.1.0 starting: vty@2605, bgp@<all>:179 pid 26012
2018/07/24 08:48:02 BGP: stream_read_try: read failed on fd 12: Connection reset by peer
2018/07/24 08:48:02 BGP: 3.3.3.1 [Error] bgp_read_packet error: Connection reset by peer

M360-P AS-110

root@M360-P:~# cat /tmp/bgpd.log
2018/07/24 06:18:09 BGP: BGPd 1.1.0 starting: vty@2605, bgp@<all>:179 pid 11475

殘念...

待會透過 TeamViewer 就用一樣的方式來驗證即可

這樣就可以專心在公司解問題了

1640

今天 PI 進行的測試項目 topology 如下

image

M360 在這個 topology 扮演的腳色是 bridge

目前的情況是

  • ping from 10.55.11.66/24 to 10.55.11.69 - fail
  • ping from 10.55.11.66/24 to 3.3.3.1/32 - fail

M360 從 log 觀察到自己的 ip 為 10.55.11.65

R1 ping M360 的 10.55.11.65 也 ping 不通

  • ping from 10.55.11.66/24 to 10.55.11.65 - fail

1740

目前的情況並不是我能解決的

不過我明天拿兩台 M300 來試一下 BGP with Loopback interface 這個 issue

⚠️ **GitHub.com Fallback** ⚠️