20180815_jeffrey - silenceuncrio/diary GitHub Wiki

1300

繼續昨天對於 BGP with Loopback interface 的測試

不過兩邊都是 M300

+-----------+                                                                +-----------+
|           |                                                                |           |
|  AS-101   | LAN                                            LAN             |  AS-110   |
|           | 192.168.1.1/24                                 192.168.1.10/24 |           |
|         A +----------------------------------------------------------------+ B         |
|           |                                                                |           |
|           |                                                                |           |
|           |                                                                |           |
|   M300    |                                                                |   M300    |
|           | 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

M300 AS-101

ifconfig lo:as101 4.4.4.1 netmask 255.255.255.255

M300 AS-110

ifconfig lo:as110 3.3.3.1 netmask 255.255.255.255

static route

M300 AS-101

ip route add 3.3.3.1 via 192.168.1.10

M300 AS-110

ip route add 4.4.4.1 via 192.168.1.1

the configuration of bgp

M300 AS-101

root@M300:~# cat /etc/quagga/bgpd.conf
hostname Router
password zebra
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 AS-110

root@M300:~# cat /etc/quagga/bgpd.conf
hostname Router
password zebra
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

M300 AS-110

root@M30:~# cat /tmp/bgpd.log
2018/08/14 05:37:27 BGP: BGPd 0.99.24.1 starting: vty@2605, bgp@<all>:179

M300 AS-101

root@M300:~# cat /tmp/bgpd.log
2018/08/08 07:01:20 BGP: BGPd 0.99.24.1 starting: vty@2605, bgp@<all>:179

雖然沒有看到異常的 log

但也沒學到任何 routes

利用 localhost 2605 port 進去 bgpd 的 vty 看一下

M300 AS-101

Router> show bgp neighbors
BGP neighbor is 3.3.3.1, remote AS 110, local AS 101, external link
  BGP version 4, remote router ID 0.0.0.0
  BGP state = Active
  Last read 00:12:52, hold time is 180, keepalive interval is 60 seconds
  Message statistics:
    Inq depth is 0
    Outq depth is 0
                         Sent       Rcvd
    Opens:                  7          0
    Notifications:          0          0
    Updates:                0          0
    Keepalives:             0          0
    Route Refresh:          0          0
    Capability:             0          0
    Total:                  7          0
  Minimum time between advertisement runs is 30 seconds

 For address family: IPv4 Unicast
  Community attribute sent to this neighbor(both)
  0 accepted prefixes

  Connections established 0; dropped 0
  Last reset never
  External BGP neighbor may be up to 255 hops away.
Local host: 192.168.1.1, Local port: 35742
Foreign host: 3.3.3.1, Foreign port: 179
Nexthop: 192.168.1.1
Nexthop global: fe80::5cfd:6bff:fe53:b766
Nexthop local: ::
BGP connection: non shared network
Next connect timer due in 71 seconds
Read thread: off  Write thread: off

M300 AS-110

Router> show bgp ipv4
  multicast  Address Family modifier
  unicast    Address Family modifier
Router> show bgp neighbors
BGP neighbor is 4.4.4.1, remote AS 101, local AS 110, external link
  BGP version 4, remote router ID 0.0.0.0
  BGP state = Active
  Last read 00:11:15, hold time is 180, keepalive interval is 60 seconds
  Message statistics:
    Inq depth is 0
    Outq depth is 0
                         Sent       Rcvd
    Opens:                  6          0
    Notifications:          0          0
    Updates:                0          0
    Keepalives:             0          0
    Route Refresh:          0          0
    Capability:             0          0
    Total:                  6          0
  Minimum time between advertisement runs is 30 seconds

 For address family: IPv4 Unicast
  Community attribute sent to this neighbor(both)
  0 accepted prefixes

  Connections established 0; dropped 0
  Last reset never
  External BGP neighbor may be up to 255 hops away.
Local host: 192.168.1.10, Local port: 50671
Foreign host: 4.4.4.1, Foreign port: 179
Nexthop: 192.168.1.10
Nexthop global: fe80::b4c1:49ff:fedf:82f9
Nexthop local: ::
BGP connection: non shared network
Next connect timer due in 50 seconds
Read thread: off  Write thread: off

可以發先雖然兩邊都有 send packet 出去

但都沒有收到任何的 packet

1420

commit 8c23fcca986613a5f187f83328faba20d2d9a536
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Aug 15 14:19:16 2018 +0800

    more clearly the fieldset legend than the table at the 'Status' web page for customer xentino

 .../prosrc/www/brand_xentino/app/feature/status.html.src | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

1440

不用 loopback

改去 alials lan 的 interafce

+-----------+                                                                +-----------+
|           |                                                                |           |
|  AS-101   | LAN                                            LAN             |  AS-110   |
|           | 192.168.1.1/24                                 192.168.1.10/24 |           |
|         A +----------------------------------------------------------------+ B         |
|           |                                                                |           |
|           |                                                                |           |
|           |                                                                |           |
|   M300    |                                                                |   M300    |
|           | lan:40                                         lan:30          |           |
|           | 40.40.40.10/24                                 30.30.30.10/24  |           |
|         C +----------------------------------------------------------------+ D         |
|           |                              eBGP                              |           |
|           |                                                                |           |
|           |                                                                |           |
+-----------+                                                                +-----------+

M300 AS-101

root@MR400-G:/www/app/feature# cat /etc/quagga/bgpd.conf
hostname Router
password zebra
router bgp 101
  redistribute kernel
  redistribute connected
  network 4.4.10.0/24
  network 4.4.20.0/24
  neighbor 30.30.30.10 remote-as 110
  neighbor 30.30.30.10 ebgp-multihop
log file /tmp/bgpd.log

M300 AS-110

root@MR400-G:~# cat /etc/quagga/bgpd.conf
hostname Router
password zebra
router bgp 110
  redistribute kernel
  redistribute connected
  redistribute rip
  redistribute ospf
  network 3.3.10.0/24
  network 3.3.11.0/24
  neighbor 40.40.40.10 remote-as 101
  neighbor 40.40.40.10 ebgp-multihop
log file /tmp/bgpd.log

結果還是一樣

兩邊都有送出 bgp packet

但都沒有收到

1455

不管我是用

ifconfig lo:as101 4.4.4.1 netmask 255.255.255.255

還是用

ifconfig lan:40 40.40.40.10

這都是 ip alias

我想我直接來把現有的 loopback interface 改成我需要的 ip 好了

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

kill bgp daemon at both device

killall bgpd

modify original loopback interface

M300 AS-101

ifconfig lo 4.4.4.1 netmask 255.255.255.255

M300 AS-110

ifconfig lo 3.3.3.1 netmask 255.255.255.255

static route

M300 AS-101

ip route add 3.3.3.1 via 192.168.1.10

M300 AS-110

ip route add 4.4.4.1 via 192.168.1.1

the configuration of bgp

M300 AS-101

root@M300:~# cat /etc/quagga/bgpd.conf
hostname Router
password zebra
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 AS-110

root@M300:~# cat /etc/quagga/bgpd.conf
hostname Router
password zebra
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

利用 localhost 2605 port 進去 bgpd 的 vty 看一下

兩邊一樣都沒收到 bgp 相關的 packet

1530

亂槍打鳥竟然中了

關鍵在 configuration

M300 AS-101

neighbor 3.3.3.1 update-source 4.4.4.1

M300 AS-110

neighbor 4.4.4.1 update-source 3.3.3.1

趕緊紀錄一下目前的狀況

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

modify original loopback interface

M300 AS-101

ifconfig lo 4.4.4.1 netmask 255.255.255.255

M300 AS-110

ifconfig lo 3.3.3.1 netmask 255.255.255.255

static route

M300 AS-101

ip route add 3.3.3.1 via 192.168.1.10

M300 AS-110

ip route add 4.4.4.1 via 192.168.1.1

the configuration of bgp

M300 AS-101

root@MR400-G:~# cat /etc/quagga/bgpd.conf
hostname Router
password zebra
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
  neighbor 3.3.3.1 update-source 4.4.4.1
log file /tmp/bgpd.log

M300 AS-110

root@MR400-G:~# cat /etc/quagga/bgpd.conf
hostname Router
password zebra
router bgp 110
  redistribute kernel
  redistribute connected
  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
  neighbor 4.4.4.1 update-source 3.3.3.1
log file /tmp/bgpd.log

M300 AS-101

Router> show bgp neighbors
BGP neighbor is 3.3.3.1, remote AS 110, local AS 101, external link
  BGP version 4, remote router ID 3.3.3.1
  BGP state = Established, up for 00:03:39
  Last read 00:00:39, hold time is 180, keepalive interval is 60 seconds
  Neighbor capabilities:
    4 Byte AS: advertised and received
    Route refresh: advertised and received(old & new)
    Address family IPv4 Unicast: advertised and received
    Graceful Restart Capabilty: advertised and received
      Remote Restart timer is 120 seconds
      Address families by peer:
        none
  Graceful restart informations:
    End-of-RIB send: IPv4 Unicast
    End-of-RIB received: IPv4 Unicast
  Message statistics:
    Inq depth is 0
    Outq depth is 0
                         Sent       Rcvd
    Opens:                  1          0
    Notifications:          0          0
    Updates:                3          3
    Keepalives:             5          4
    Route Refresh:          0          0
    Capability:             0          0
    Total:                  9          7
  Minimum time between advertisement runs is 30 seconds
  Update source is 4.4.4.1

 For address family: IPv4 Unicast
  Community attribute sent to this neighbor(both)
  5 accepted prefixes

  Connections established 1; dropped 0
  Last reset never
  External BGP neighbor may be up to 255 hops away.
Local host: 4.4.4.1, Local port: 179
Foreign host: 3.3.3.1, Foreign port: 34576
Nexthop: 4.4.4.1
Nexthop global: ::1
Nexthop local: ::
BGP connection: non shared network
Read thread: on  Write thread: off

M300 AS-110

Router> show bgp neighbors
BGP neighbor is 4.4.4.1, remote AS 101, local AS 110, external link
  BGP version 4, remote router ID 4.4.4.1
  BGP state = Established, up for 00:04:33
  Last read 00:00:32, hold time is 180, keepalive interval is 60 seconds
  Neighbor capabilities:
    4 Byte AS: advertised and received
    Route refresh: advertised and received(old & new)
    Address family IPv4 Unicast: advertised and received
    Graceful Restart Capabilty: advertised and received
      Remote Restart timer is 120 seconds
      Address families by peer:
        none
  Graceful restart informations:
    End-of-RIB send: IPv4 Unicast
    End-of-RIB received: IPv4 Unicast
  Message statistics:
    Inq depth is 0
    Outq depth is 0
                         Sent       Rcvd
    Opens:                  1          1
    Notifications:          0          0
    Updates:                3          3
    Keepalives:             6          5
    Route Refresh:          0          0
    Capability:             0          0
    Total:                 10          9
  Minimum time between advertisement runs is 30 seconds
  Update source is 3.3.3.1

 For address family: IPv4 Unicast
  Community attribute sent to this neighbor(both)
  5 accepted prefixes

  Connections established 1; dropped 0
  Last reset never
  External BGP neighbor may be up to 255 hops away.
Local host: 3.3.3.1, Local port: 34576
Foreign host: 4.4.4.1, Foreign port: 179
Nexthop: 3.3.3.1
Nexthop global: ::1
Nexthop local: ::
BGP connection: non shared network
Read thread: on  Write thread: off

ip route list

M300 AS-101

root@MR400-G:~# ip route list
3.3.3.1 via 192.168.1.10 dev lan
3.3.10.0/24 via 192.168.1.10 dev lan  proto zebra
3.3.11.0/24 via 192.168.1.10 dev lan  proto zebra
192.168.1.0/24 dev lan  proto kernel  scope link  src 192.168.1.1

M300 AS-110

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

先不張揚

仔細想想後續為了這樣的需求我需要在 web ui 作怎樣的調整

1540

看一下若是使用 ip alias 來新增一個 loopback interface 可不可行

create loopback interface

M300 AS-101

ifconfig lo:as101 4.4.4.1 netmask 255.255.255.255

M300 AS-110

ifconfig lo:as110 3.3.3.1 netmask 255.255.255.255

static route

M300 AS-101

ip route add 3.3.3.1 via 192.168.1.10

M300 AS-110

ip route add 4.4.4.1 via 192.168.1.1

configuration 不動

start bgp daemon at both device

bgpd -d -u root

成功

後續我應該讓 user 可以在 IP Alias 來為了 loopback interface 作 alias

另外 BGP 的 Neighbors 要多一個 update-source 的欄位讓使用者填

當然可以留白不填

具體的說明要參考 quagga 官網的說明

BGP: neighbor peer update-source <ifname|address>
BGP: no neighbor peer update-source

Specify the IPv4 source address to use for the BGP session to this neighbour, may be specified as either an IPv4 address directly or as an interface name (in which case the zebra daemon MUST be running in order for bgpd to be able to retrieve interface state).

router bgp 64555
 neighbor foo update-source 192.168.0.1
 neighbor bar update-source lo0

1555

以下的 configuration 也行

M300 AS-101

hostname Router
password zebra
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
  neighbor 3.3.3.1 update-source lo
log file /tmp/bgpd.log

M300 AS-110

hostname Router
password zebra
router bgp 110
  redistribute kernel
  redistribute connected
  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
  neighbor 4.4.4.1 update-source lo
log file /tmp/bgpd.log

這樣 BGP 的 Neighbors 多的 update-source 就可以作成 checkbox 了

1720

commit 35712f2fa9d981aaff65b975c554313347272310
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Aug 15 17:19:18 2018 +0800

    change 'LAN Ethernet IPv6' to 'IPv6' at 'WAN Connection Time' field at 'Status' web page for customer xentino

 proscend/prosrc/www/app/locale-en.json    | 2 +-
 proscend/prosrc/www/app/locale-fr.json    | 2 +-
 proscend/prosrc/www/app/locale-zh-tw.json | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
⚠️ **GitHub.com Fallback** ⚠️