top of page

JANOG 57NETCON 問題解説 Level3-12

  • 41 分前
  • 読了時間: 7分

JANOG 57 にスタッフ(NETCON委員)として参加させていただきました。

作成した問題について、回答と解説を記載します。






Level3-12


SV-01から SV-02 のIPアドレス 192.168.20.200 に対してPingが通りません。

RT-01 でBGP neighbor を形成して、ping が通るようにしてください。


達成条件

SV-01:192.168.10.100 から SV-02:192.168.20.200 に対してping が通ること。

パケットは RT-01/RT-02/RT-03/RT-04 によって転送されること。

SV-01:~# ping -c 5 192.168.20.200
PING 192.168.20.200 (192.168.20.200) 56(84) bytes of data.
64 bytes from 192.168.20.200: icmp_seq=1 ttl=60 time=2.77 ms
64 bytes from 192.168.20.200: icmp_seq=2 ttl=60 time=2.80 ms
64 bytes from 192.168.20.200: icmp_seq=3 ttl=60 time=3.00 ms
64 bytes from 192.168.20.200: icmp_seq=4 ttl=60 time=2.87 ms
64 bytes from 192.168.20.200: icmp_seq=5 ttl=60 time=3.07 ms

--- 192.168.20.200 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4006ms
rtt min/avg/max/mdev = 2.770/2.904/3.073/0.116 ms


制約

SV-01、RT-01 のみログイン可能です

既存のインターフェースのIPアドレスを変更してはいけません

機器のmgmポートをパケット転送に使用して通信OKとすることは禁止



解説


SV-01:~# ping -c 5 192.168.20.200
PING 192.168.20.200 (192.168.20.200) 56(84) bytes of data.
From 192.168.10.1 icmp_seq=1 Destination Host Unreachable
From 192.168.10.1 icmp_seq=2 Destination Host Unreachable
From 192.168.10.1 icmp_seq=3 Destination Host Unreachable
From 192.168.10.1 icmp_seq=4 Destination Host Unreachable
From 192.168.10.1 icmp_seq=5 Destination Host Unreachable
 
--- 192.168.20.200 ping statistics ---
5 packets transmitted, 0 received, +5 errors, 100% packet loss, time 4136ms
 

SV-01:~# traceroute -n 192.168.20.200
traceroute to 192.168.20.200 (192.168.20.200), 30 hops max, 46 byte packets
 1  192.168.10.1  0.244 ms  0.104 ms  0.235 ms
 2  192.168.10.1  0.153 ms !H  *  0.336 ms !H

  

RT-01#sh ip route | be Gate
Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
C        1.1.1.1 is directly connected, Loopback0
      2.0.0.0/32 is subnetted, 1 subnets
S        2.2.2.2 [1/0] via 10.0.12.2
      10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        10.0.12.0/24 is directly connected, GigabitEthernet3
L        10.0.12.1/32 is directly connected, GigabitEthernet3
      192.168.10.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.10.0/24 is directly connected, GigabitEthernet2
L        192.168.10.1/32 is directly connected, GigabitEthernet2

 

RT-01#sh ip bgp su | be Nei

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd

10.0.12.2       4        65001       0       0        1    0    0 never    Idle


 

RT-01#sh ip bgp | be Net

     Network          Next Hop            Metric LocPrf Weight Path
 *>   192.168.10.0     0.0.0.0                  0         32768 i

RT-02 とBGPが確立できていない。

トポロジ図では RT-02 のAS番号は 65002 なので、修正する。

RT-01
router bgp 65001
 neighbor 10.0.12.2 remote-as 65002
RT-01#sh ip bgp su | be Nei

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.0.12.2       4        65002       9       9        2    0    0 00:00:03        0

 

RT-01#sh ip bgp su | be Nei

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.0.12.2       4        65002       0       0        1    0    0 00:00:00 Idle

neighbor の remote-as を 65002 にすると、BGPがフラップする。

RT-01#sh ip bgp su | be Nei

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd

10.0.12.2       4        65002       7       8        2    0    0 00:00:02        0

 
RT-01#sh ip bgp su | be Nei

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd

10.0.12.2       4        65002       0       0        1    0    0 00:00:09 Idle

 

RT-01#term mon

*Jan 31 10:27:03.112: %BGP-5-ADJCHANGE: neighbor 10.0.12.2 Up
 *Jan 31 10:27:10.274: %BGP-3-NOTIFICATION: received from neighbor 10.0.12.2 6/2 (Administrative Shutdown) 0 bytes
*Jan 31 10:27:10.275: %BGP-5-NBR_RESET: Neighbor 10.0.12.2 reset (BGP Notification received)
*Jan 31 10:27:10.276: %BGP-5-ADJCHANGE: neighbor 10.0.12.2 Down BGP Notification received
*Jan 31 10:27:10.276: %BGP_SESSION-5-ADJCHANGE: neighbor 10.0.12.2 IPv4 Unicast topology base removed from session  BGP Notification received
*Jan 31 10:27:10.280: %HA_EM-4-LOG: BGP_DOWN_AS65002: Remote-AS is not 65002, Please Seek NTCN by EPC and Wait patiently.


BGP DOWN 時に表示される「Remote-AS is not 65002, Please Seek NTCN by EPC and Wait patiently.」が

ヒントになっています。



正解例

RT-01
int tun0
 ip add 10.10.10.10 255.255.255.255
 tunnel source 10.0.12.1
 tunnel destination 3.3.3.3

router bgp 65001
 neighbor 78.84.67.78 remote-as 65004
 neighbor 78.84.67.78 update-source lo0
 neighbor 78.84.67.78 ebgp-multihop 255

ip route 78.84.67.78 255.255.255.255 tunnel 0
ip route 3.3.3.3 255.255.255.255 10.0.12.2


AS 65002 とのBGPフラップを、RT-01 側の修正で解消することはできません。

(今回の環境では、RT-02 にBGPがUPしたら neighbor shutdown するようにEEMを書いているため)



EPCでパケットキャプチャします。

この時、「BGPだからTCPのみを対象にしよう」とフィルタを掛けると、この問題は詰むように出来ています。



IPパケット全部を対象にします。

RT-01
ip access-list extended RT01_ACL
 permit ip any any

RT-01#monitor capture RT01_CAP access-list RT01_ACL buffer size 1 interface g3 in

RT-01#monitor capture start
Started capture point : RT01_CAP

*Nov 16 05:17:01.962: %BUFCAP-6-ENABLE: Capture Point RT01_CAP enabled.

RT-01#monitor capture stop
Stopped capture point : RT01_CAP

*Nov 16 05:17:13.070: %BUFCAP-6-DISABLE: Capture Point RT01_CAP disabled.

RT-01#show monitor capture RT01_CAP buffer dump

1
  0000:  AAC1AB4A AE82AAC1 AB2C17F5 080045C0   ...J.....,....E.
  0010:  0034FD4A 40000106 4FB70A00 0C020A00   .4.J@...O.......
  0020:  0C016A66 00B36188 EA010000 00008002   ..jf..a.........
  0030:  40004D72 00000204 05B40402 01010303   @.Mr............
  0040:  0000                                  ..

2
  0000:  AAC1AB4A AE82AAC1 AB2C17F5 080045C0   ...J.....,....E.
  0010:  0034309B 4000FF06 44630202 02020101   .40.@...Dc......
  0020:  0101394A 00B33D5D E3610000 00008002   ..9J..=].a......
  0030:  4000CF56 00000204 05B40402 01010303   @..V............
  0040:  0000                                  ..

dump で表示されるパケットには、


・RT-02 からの TCP SYN (10.0.12.1 宛と 1.1.1.1 宛の2種類)

・RT-03 からの TCP SYN


があります。



それぞれを元にBGPを張ると、以下の事象が起きます。


①RT-02 と neighbor 10.0.12.2 remote-as 65002 でneighborを張る

 →BGPがフラップ(RT-02からの admin shutdown)


②RT-02 と neighbor 2.2.2.2 remote-as 65002 でneighborを張る

 →BGPがフラップ(timeout)


③RT-03:neighbor 10.0.23.3 remote-as 65003 でneighborを張る

 →BGPはUPしますが、Prefixは何も学習せず、そのまま




dump で表示されるパケットのなかからヒントである「NTCN」を探します。

RT-01#show monitor capture RT01_CAP buffer dump

25
  0000:  AAC1AB39 B582AAC1 AB8B7F24 080045C0   ...9.......$..E.
  0010:  00480018 0000FE2F 9FA80303 03030A00   .H...../........
  0020:  0C010000 080045C0 0030607C 0000FE06   ......E..0`|....
  0030:  C7E74E54 434E0101 0101C364 00B30936   ..NTCN.....d...6
  0040:  02D50000 00007002 8000A234 00000204   ......p....4....
  0050:  04D80303 0000                         ......

16進部分を選択し(Altキーを押しながら部分選択が便利です)、input.txt 等の名前で保存します。

このままではWiresharkにインポートできないので、成形します。


※成形前

AAC1AB39 B582AAC1 AB8B7F24 080045C0
00480018 0000FE2F 9FA80303 03030A00
0C010000 080045C0 0030607C 0000FE06
C7E74E54 434E0101 0101C364 00B30936
02D50000 00007002 8000A234 00000204
04D80303 0000

Windows Powershell の例

 > (Get-Content input.txt) -replace '\s','' -replace '..','$& ' | Set-Content output.txt

Linuxの例

 $ cat input.txt | tr -d '\t ' | sed 's/../& /g' > output.tx

※成形後

AA C1 AB 39 B5 82 AA C1 AB 8B 7F 24 08 00 45 C0
00 48 00 18 00 00 FE 2F 9F A8 03 03 03 03 0A 00
0C 01 00 00 08 00 45 C0 00 30 60 7C 00 00 FE 06
C7 E7 4E 54 43 4E 01 01 01 01 C3 64 00 B3 09 36
02 D5 00 00 00 00 70 02 80 00 A2 34 00 00 02 04
04 D8 03 03 00 00


Wiresharkにimportすると、このパケットは GRE であることがわかります。


GREのSorce/Destination IPアドレス情報をもとに、Tunnel IF を作成します。(IFに設定するIPは何でもよい)

また、BGPの TCP SYN パケットの情報をもとに、BGP neighbor を設定します。


Tunnel の Destination を RT-02:10.0.12.2 に向ける static route と、

BGP neighbor に指定する 78.84.67.78 を tunnel IF に向ける static route を設定します。

(この 78.84.67.78 が dump 時にASCI文字で NTCN になっています)



この時点では対向のAS番号がわかりませんので、適当に設定します。


RT-01
int tun0
 ip add 10.10.10.10 255.255.255.255
 tunnel source g3
 tunnel destination 3.3.3.3

router bgp 65001
 neighbor 78.84.67.78 remote-as 65001
 neighbor 78.84.67.78 update-source lo0
 neighbor 78.84.67.78 ebgp-multihop 255

ip route 78.84.67.78 255.255.255.255 tunnel 0
ip route 3.3.3.3 255.255.255.255 10.0.12.2


debug により remote-as は 65004 であることがわかりますので、修正します。

RT-01#debug ip bgp all
*Jan  6 10:24:04.575: BGP: ses global 78.84.67.78 (0x78AFAD46BB30:0) act ENHE CAP for 1/128 received.
*Jan  6 10:24:04.575: BGP: 78.84.67.78 active bad OPEN, remote AS is 65004, expected 65001
*Jan  6 10:24:04.575: BGP: 78.84.67.78 active went from OpenSent to Closing
*Jan  6 10:24:04.575: %BGP-3-NOTIFICATION: sent to neighbor 78.84.67.78 active 2/2 (peer in wrong AS) 2 bytes FDEC
*Jan  6 10:24:04.575: BGP: ses global 78.84.67.78 (0x78AFAD46BB30:0) act Send NOTIFICATION 2/2 (peer in wrong AS) 2 bytes FDEC

RT-01
router bgp 65001
 neighbor 78.84.67.78 remote-as 65004

*Jan  6 10:26:28.989: %BGP-5-ADJCHANGE: neighbor 78.84.67.78 Up

BGPがUPして RT-01 は 192.168.20.0/24 を学習します。

(ログインできないので見えませんが、対向側の RT-04 でも 192.168.10.0/24 を学習します)

RT-01#sh ip bgp su | be Nei


Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd

78.84.67.78     4        65004       4       2        1    0    0 00:00:20        1


RT-01#sh ip bgp | be Net

     Network          Next Hop            Metric LocPrf Weight Path
 *    192.168.10.0     0.0.0.0                  0         32768 i
 *    192.168.20.0     78.84.67.78              0             0 65004 i

SV-01 から SV-2:192.168.20.200 にpingが飛ぶようになります。

SV-01:~# ping -c 5 192.168.20.200
PING 192.168.20.200 (192.168.20.200) 56(84) bytes of data.
64 bytes from 192.168.20.200: icmp_seq=2 ttl=61 time=2.18 ms
64 bytes from 192.168.20.200: icmp_seq=3 ttl=61 time=2.17 ms
64 bytes from 192.168.20.200: icmp_seq=4 ttl=61 time=2.22 ms
64 bytes from 192.168.20.200: icmp_seq=5 ttl=61 time=2.48 ms
--- 192.168.20.200 ping statistics ---
5 packets transmitted, 4 received, 20% packet loss, time 4015ms
rtt min/avg/max/mdev = 2.168/2.259/2.476/0.126 ms

 
SV-01:~# traceroute -n 192.168.20.200
traceroute to 192.168.20.200 (192.168.20.200), 30 hops max, 46 byte packets
 1  192.168.10.1  0.346 ms  0.153 ms  0.116 ms
 2  30.30.30.30  1.021 ms  0.772 ms  0.886 ms
 3  10.0.34.4  2.635 ms  1.671 ms  1.505 ms
 4  192.168.20.200  1.209 ms  1.362 ms  1.393 ms




正答例

RT-01

int tun0
 ip add 10.10.10.10 255.255.255.255
 tunnel source 10.0.12.1
 tunnel destination 3.3.3.3

router bgp 65001
 neighbor 78.84.67.78 remote-as 65004
 neighbor 78.84.67.78 update-source lo0
 neighbor 78.84.67.78 ebgp-multihop 255

ip route 78.84.67.78 255.255.255.255 tunnel 0
ip route 3.3.3.3 255.255.255.255 10.0.12.2

 
 
 

コメント


最新記事
アーカイブ
タグから検索
ソーシャルメディア
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square

© 2023 by Name of Site. Proudly created with Wix.com

  • Facebook Social Icon
  • Twitter Social Icon
  • Google+ Social Icon
bottom of page