20181129_jeffrey - silenceuncrio/diary GitHub Wiki

0900

今天專心地來做 GRE NHRP

昨天有 build 一版 M300 develop branch 的 image

也用 mfgtool 燒錄好了一片 CPU board

參考 20181120_jeffrey

先將 Cisco 2951 開機

0920

john 有急件

M360 的 IP Filter 有一些字眼要修改

commit 6dbfdb0b7e636e9ac0e72c09089dd18de9792fb2
Author: jeffrey <[email protected]>
Date:   Thu Nov 29 09:48:46 2018 +0800

    modify the hint at the 'IP Filter' web page

 proscend/prosrc/www/app/feature/ipfilter_summary.html | 13 +++++--------
 proscend/prosrc/www/app/locale-en.json                | 18 +++++++-----------
 proscend/prosrc/www/app/locale-fr.json                | 18 +++++++-----------
 proscend/prosrc/www/app/locale-zh-tw.json             | 18 +++++++-----------
 4 files changed, 26 insertions(+), 41 deletions(-)

build 個 image double check... PASS

1010

樓上臥室的衣櫥是開放式的

目前想加裝門片

稍微 survey 了一下

曉偉師傅木工室內裝修工作室(大新竹地區)

1020

繼續 NHRP

先設定 Cisco 2951 的 IP 讓 M300 與 Cisco 2951 能互通

Router>enable
Router#configure
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface GigabitEthernet 0/0
Router(config-if)#ip address 192.168.1.200 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#exit
Router#show interfaces GigabitEthernet 0/0
GigabitEthernet0/0 is up, line protocol is up
  Hardware is PQ3_TSEC, address is d0d0.fd3f.42e0 (bia d0d0.fd3f.42e0)
  Internet address is 192.168.1.200/24
  MTU 1500 bytes, BW 100000 Kbit/sec, DLY 100 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA, loopback not set
  Keepalive set (10 sec)
  Full Duplex, 100Mbps, media type is RJ45
  output flow-control is XON, input flow-control is XON
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 00:00:41, output 00:00:01, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue: 0/40 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     59 packets input, 5538 bytes, 0 no buffer
     Received 32 broadcasts (0 IP multicasts)
     0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
     0 watchdog, 5 multicast, 0 pause input
     616 packets output, 72407 bytes, 0 underruns
     0 output errors, 0 collisions, 3 interface resets
     5 unknown protocol drops
     0 babbles, 0 late collision, 0 deferred
     1 lost carrier, 0 no carrier, 0 pause output
     0 output buffer failures, 0 output buffers swapped out

從 M300 來 ping

root@Cellular Router:~# ping 192.168.1.200
PING 192.168.1.200 (192.168.1.200): 56 data bytes
64 bytes from 192.168.1.200: seq=0 ttl=255 time=16.511 ms
64 bytes from 192.168.1.200: seq=1 ttl=255 time=1.001 ms
64 bytes from 192.168.1.200: seq=2 ttl=255 time=0.856 ms
64 bytes from 192.168.1.200: seq=3 ttl=255 time=1.086 ms
^C
--- 192.168.1.200 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.856/4.863/16.511 ms

1045

可以把 是方科技 GRE 的相關設定套到 Cisco 2951 上了

是方科技 GRE 的相關設定

interface Tunnel87654321
 bandwidth 2000
 ip address 172.30.96.5 255.255.255.248
 no ip redirects
 no ip unreachables
 no ip proxy-arp
 ip mtu 1500
 ip nhrp authentication LTEGRE
 ip nhrp network-id 87654321
 load-interval 30
 tunnel source FastEthernet4
 tunnel mode gre multipoint
 tunnel key 87654321

Cisco 2951

Router>enable
Router#configure
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface Tunnel 87654321
Router(config-if)#bandwidth 2000
Router(config-if)#ip address 172.30.96.5 255.255.255.248
Router(config-if)#no ip redirects
Router(config-if)#no ip unreachables
Router(config-if)#no ip proxy-arp
Router(config-if)#ip mtu 1500
Router(config-if)#ip nhrp authentication LTEGRE
Router(config-if)#ip nhrp network-id 87654321
Router(config-if)#tunnel source GigabitEthernet 0/0
Router(config-if)#tunnel mode gre multipoint
Router(config-if)#exit
Router(config)#exit
Router#show interfaces tunnel 87654321
Tunnel87654321 is up, line protocol is up
  Hardware is Tunnel
  Internet address is 172.30.96.5/29
  MTU 17912 bytes, BW 2000 Kbit/sec, DLY 50000 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation TUNNEL, loopback not set
  Keepalive not set
  Tunnel linestate evaluation up
  Tunnel source 192.168.1.200 (GigabitEthernet0/0)
   Tunnel Subblocks:
      src-track:
         Tunnel87654321 source tracking subblock associated with GigabitEthernet0/0
          Set of tunnels with source GigabitEthernet0/0, 1 member (includes iterators), on interface <OK>
  Tunnel protocol/transport multi-GRE/IP
    Key 0x5397FB1, sequencing disabled
    Checksumming of packets disabled
  Tunnel TTL 255, Fast tunneling enabled
  Tunnel transport MTU 1472 bytes
  Tunnel transmit bandwidth 8000 (kbps)
  Tunnel receive bandwidth 8000 (kbps)
  Last input never, output never, output hang never
  Last clearing of "show interface" counters 00:02:01
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue: 0/0 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     0 packets input, 0 bytes, 0 no buffer
     Received 0 broadcasts (0 IP multicasts)
     0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     0 packets output, 0 bytes, 0 underruns
     0 output errors, 0 collisions, 0 interface resets
     0 unknown protocol drops
     0 output buffer failures, 0 output buffers swapped out

可以開始研究 M300 要怎麼來設定了

1100

參考 Introduction to Multipoint GRE and NHRP

其中的 Dynamic (Hub Side) mGRE using dynamic NHRP 那張圖

image

左側 Fa0/0 就是我目前的 Cisco 2951

右側就把最上方那當作是 M300 好了

目前我們 Cisco 2951 當成這張圖左側的腳色的話

config 就可以整理成下面的樣子

interface Tunnel87654321
 ip address 172.30.96.5 255.255.255.248
 no ip redirects
 ip nhrp authentication LTEGRE
 ip nhrp network-id 87654321
 tunnel source tunnel source GigabitEthernet 0/0
 tunnel mode gre multipoint
 tunnel key 87654321

理論上 M300 如果是一台 Cisco 的 device 的話

config 應該會是像

interface Tunnel0
 ip address 172.30.96.6 255.255.255.248
 no ip redirects
 ip nhrp authentication LTEGRE
 ip nhrp network-id 87654321
 tunnel source tunnel source 192.168.1.1
 tunnel destination 192.168.1.200
 tunnel key 87654321

目前的重點就在於我們要怎麼利用目前 M300 上的 Linux 來做出等效的設定

1130

monkeyjj time

要做出 calendar 雖然我可以土法煉鋼

不過畢竟我的時間有限

挑個現成的研究一下有許也不錯

挑個星星最多的 react-big-calendar 來玩玩

1300

回到 NHRP

參考以下

不過先搞定原本 GRE 的部分

左側 Cisco 2951 config 如下

interface Tunnel87654321
 ip address 172.30.96.5 255.255.255.248
 no ip redirects
 ip nhrp authentication LTEGRE
 ip nhrp network-id 87654321
 tunnel source tunnel source GigabitEthernet 0/0
 tunnel mode gre multipoint
 tunnel key 87654321

跟 GRE 有關的是

 tunnel source tunnel source GigabitEthernet 0/0
 tunnel mode gre multipoint
 tunnel key 87654321

參考原本 M300 GRE 的 wiki

image

右側 R5 所需的設定如下

ip tunnel add gre1 mode gre remote 192.168.1.4 local 192.168.1.5 ttl 255
ip link set gre1 up
ip addr add 10.1.1.5/24 dev gre1

如果要模仿右側的 config 的話

interface Tunnel0
 ip address 172.30.96.6 255.255.255.248
 no ip redirects
 ip nhrp authentication LTEGRE
 ip nhrp network-id 87654321
 tunnel source tunnel source 192.168.1.1
 tunnel destination 192.168.1.200
 tunnel key 87654321

linux 應該是可以這麼下

ip tunnel add gre1 mode gre key 87654321 remote 192.168.1.200 local 192.168.1.1 ttl 255
ip link set gre1 up
ip addr add 172.30.96.6/29 dev gre1

試試吧

root@Cellular Router:~# ip tunnel add gre1 mode gre key 87654321 remote 192.168.1.200 local 192.168.1.1 ttl 255
root@Cellular Router:~# ip link set gre1 up
root@Cellular Router:~# ip addr add 172.30.96.6/29 dev gre1
root@Cellular Router:~# ifconfig
...
gre1      Link encap:UNSPEC  HWaddr C0-A8-01-01-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:172.30.96.6  P-t-P:172.30.96.6  Mask:255.255.255.248
          inet6 addr: fe80::5efe:c0a8:101/64 Scope:Link
          UP POINTOPOINT RUNNING NOARP  MTU:1472  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lan       Link encap:Ethernet  HWaddr 0A:00:FD:E3:2E:92
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::800:fdff:fee3:2e92/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4584 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6169 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:445023 (434.5 KiB)  TX bytes:2968855 (2.8 MiB)
...

再來是 NHRP 的部分

利用 vtysh 來試試

root@Cellular Router:~# vtysh

Hello, this is Quagga (version 1.2.4).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

Cellular Router# configure terminal
Cellular Router(config)#
Cellular Router(config)# interface gre1
Cellular Router(config-if)#
Cellular Router(config-if)# ip nhrp network-id 87654321
Cellular Router(config-if)# exit
Cellular Router(config)# exit
Cellular Router# write file
Building Configuration...
Configuration saved to /etc/quagga/zebra.conf
[OK]
Cellular Router#

唯一找到匹配的只有 ip nhrp network-id 87654321

不過這樣子做員並沒有看到甚麼 nhrp 相關的 config

目前試著啟動 nhrpd 會得到以下的錯誤訊息

root@Cellular Router:~# nhrpd -d
vty_read_config: failed to open configuration file /etc/quagga/nhrpd.conf: No such file or directory
can't open configuration file [/etc/quagga/nhrpd.conf]

我想我可以先朝這個方向努力一下

先把 Cisco 2951 關機

1515

monkeyjj time

follow 星星最多的 react-big-calendar 的過程很不順利

換一個

1620

參考 Create a custom calendar in React

1730

monkeyjj react-calendar-02

commit 54cc1ca527be83110cd813bf98365c290027961f
Author: jeffrey <[email protected]>
Date:   Thu Nov 29 17:28:58 2018 +0800

    first commit:
    - create-react-app
    - npm install date-fns

 .gitignore           |    23 +
 package-lock.json    | 14849 +++++++++++++++++++++++++++++++++++++++++++++++++
 package.json         |    26 +
 public/favicon.ico   |   Bin 0 -> 3870 bytes
 public/index.html    |    40 +
 public/manifest.json |    15 +
 src/App.css          |    32 +
 src/App.js           |    28 +
 src/App.test.js      |     9 +
 src/index.css        |    14 +
 src/index.js         |    12 +
 src/logo.svg         |     7 +
 src/serviceWorker.js |   135 +
 13 files changed, 15190 insertions(+)

1745

monkeyjj react-calendar-02

commit 21e2502414f30ed75573e823223838c1849458a2
Refs: [master], {origin/master}, {origin/HEAD}
Author: jeffrey <[email protected]>
Date:   Thu Nov 29 17:44:55 2018 +0800

    finish
    - refer to https://blog.flowandform.agency/create-a-custom-calendar-in-react-3df1bfd0b728

 src/App.css                 | 238 ++++++++++++++++++++++++++++++++++++++++----
 src/App.js                  |  35 ++++---
 src/components/Calendar.jsx | 120 ++++++++++++++++++++++
 3 files changed, 356 insertions(+), 37 deletions(-)

兩步就完成

不過該 blog - Create a custom calendar in React 還沒來得及欣賞