1
0

More than 1 year has passed since last update.

【vyos on VMware Playerでネットワークのお勉強】(002) OSPF通信の疎通

Last updated at Posted at 2021-11-03

はじめに

みなさま。こんにちは。
気がつけば2021年も終わりに近づき、新年号に変わってから早2年以上が経過しようとし、会社では平成生まれどころか2000年代生まれの世代が入るこのご時世に、地味なL3レイヤを中心に記事の投稿をしている、おーちゃんです。
python大好きっ子ですが、ネットワークやセキュリティ、AWSも大好きっ子なのでそういった記事を多数投稿していきたいと思っておりますので、よろしくおねがいします。

前回の記事から1週間近く間が空いてしまいました。
当初の予定では、毎日、遅くとも3日に1本投稿することを目標にしていたのですが、思いの外vyattaとvyOSのコマンドの違いがあったことと、検証環境で動作確認に時間がかかってしまいました。
vyOSの操作にも慣れてきたので、今後は少しペースアップして行きたいと思います。

本記事(002)から(004)にかけて、まずは、以下のような環境を作っていきます。
Quiita002_001.png

使用する環境

# 使用環境 備考
1 vyos-1.4 192.168.151.0/24(VMnet2), 192.168.161.0/24(VMnet3)
2 vyos-1.4 192.168.151.0/24(VMnet2), 192.168.171.0/24(VMnet4)
3 vyos-1.4 192.168.171.0/24(VMnet4), 192.168.181.0/24(VMnet5)
4 CentOS 8 Stream HTTPサーバ(192.168.151.100) 本稿では対象外
5 CentOS 8 Stream HTTPクライアント(192.168.181.100) 本稿では対象外

本稿で構築する環境

OSPF / IPSec / BGPを試してみようと思うのですが、本稿ではOSPFに絞って下記のような構成を作ります。
Quiita002_002.png

((003)はBGP、(004)はIPSec、(005)以降からElastic Searchに入る予定ですが、(005)以降はまだ未定ですm(_ _)m)

vyOS01に投入するvyattaコマンド

vyatta01.sh
set interfaces ethernet eth1 address '192.168.151.11/24'
set interfaces ethernet eth2 address '192.168.161.11/24'
set interfaces loopback lo address '10.1.1.1/32'

set protocols ospf area 0 network '192.168.151.0/24'
set protocols ospf area 0 network '10.1.1.1/32'
set protocols ospfv3 area 0 interface 'eth1'
set protocols ospfv3 area 0 interface 'lo'

set system host-name o-chan-001.example.com

set system ntp server time1.vyos.net
set system ntp server time2.vyos.net
set system ntp server time3.vyos.net

vyOS02に投入するvyattaコマンド

vyatta02.sh
set interfaces ethernet eth0 address '192.168.151.12/24'
set interfaces ethernet eth1 address '192.168.171.11/24'
set interfaces loopback lo address '10.1.1.2/32'

set protocols ospf area 0 network '192.168.151.0/24'
set protocols ospf area 0 network '192.168.171.0/24'
set protocols ospf area 0 network '10.1.1.2/32'
set protocols ospfv3 area 0 interface 'eth0'
set protocols ospfv3 area 0 interface 'eth1'
set protocols ospfv3 area 0 interface 'lo'

set system host-name o-chan-002.example.com

set system ntp server time1.vyos.net
set system ntp server time2.vyos.net
set system ntp server time3.vyos.net

vyOS03に投入するvyattaコマンド

vyatta03.sh
set interfaces ethernet eth0 address '192.168.171.12/24'
set interfaces ethernet eth1 address '192.168.181.11/24'
set interfaces loopback lo address '10.1.1.3/32'

set protocols ospf area 0 network '192.168.171.0/24'
set protocols ospf area 0 network '10.1.1.3/32'
set protocols ospfv3 area 0 interface 'eth0'
set protocols ospfv3 area 0 interface 'lo'

set system host-name o-chan-003.example.com
set system ntp server time1.vyos.net
set system ntp server time2.vyos.net
set system ntp server time3.vyos.net

vyOS01のルーティングテーブルとvyOS03への疎通確認

vyatta01.sh
vyos@vyos:~$ show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup

O   10.1.1.1/32 [110/0] is directly connected, lo, weight 1, 00:01:20
C>* 10.1.1.1/32 is directly connected, lo, 00:01:24
O>* 10.1.1.2/32 [110/10] via 192.168.151.12, eth1, weight 1, 00:00:25
O>* 10.1.1.3/32 [110/20] via 192.168.151.12, eth1, weight 1, 00:00:15
C>* 192.168.134.0/24 is directly connected, eth3, 00:07:48
O   192.168.151.0/24 [110/10] is directly connected, eth1, weight 1, 00:01:20
C>* 192.168.151.0/24 is directly connected, eth1, 00:01:23
C>* 192.168.161.0/24 is directly connected, eth2, 00:01:24
O>* 192.168.171.0/24 [110/20] via 192.168.151.12, eth1, weight 1, 00:00:25
vyatta01.sh
vyos@vyos:~$ ping 192.168.171.12
PING 192.168.171.12 (192.168.171.12) 56(84) bytes of data.
64 bytes from 192.168.171.12: icmp_seq=1 ttl=63 time=1.16 ms
64 bytes from 192.168.171.12: icmp_seq=2 ttl=63 time=3.09 ms

vyOS02のルーティングテーブル

vyatta02.sh
vyos@vyos:~$ show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup

O>* 10.1.1.1/32 [110/10] via 192.168.151.11, eth0, weight 1, 00:33:49
O   10.1.1.2/32 [110/0] is directly connected, lo, weight 1, 00:34:39
C>* 10.1.1.2/32 is directly connected, lo, 00:34:43
O>* 10.1.1.3/32 [110/10] via 192.168.171.12, eth1, weight 1, 00:33:46
C>* 192.168.134.0/24 is directly connected, eth2, 00:40:15
O   192.168.151.0/24 [110/10] is directly connected, eth0, weight 1, 00:34:39
C>* 192.168.151.0/24 is directly connected, eth0, 00:34:42
O   192.168.171.0/24 [110/10] is directly connected, eth1, weight 1, 00:34:39
C>* 192.168.171.0/24 is directly connected, eth1, 00:34:43

vyOS03のルーティングテーブル

vyatta03.sh
vyos@vyos:~$ show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup

O>* 10.1.1.1/32 [110/11] via 192.168.171.11, eth0, weight 1, 00:33:54
O>* 10.1.1.2/32 [110/1] via 192.168.171.11, eth0, weight 1, 00:33:54
O   10.1.1.3/32 [110/0] is directly connected, lo, weight 1, 00:34:44
C>* 10.1.1.3/32 is directly connected, lo, 00:34:47
C>* 192.168.134.0/24 is directly connected, eth2, 00:39:32
O>* 192.168.151.0/24 [110/11] via 192.168.171.11, eth0, weight 1, 00:33:54
O   192.168.171.0/24 [110/1] is directly connected, eth0, weight 1, 00:34:44
C>* 192.168.171.0/24 is directly connected, eth0, 00:34:46
C>* 192.168.181.0/24 is directly connected, eth1, 00:34:47

Wiresharkパケット

OSPFでHelloパケットを定期的に飛ばし、定義ファイルの作成要求更新を行っている様がバッチリ取れました。
Quiita002_002.JPG

今回の環境構築で取得したWiresharkのパケットを下記gitにアップロードしたので、興味のある方はご参照ください。
Qiita_002_Packet on Git

参考リンク

【vyos on VMware Playerでネットワークのお勉強】(001)ご挨拶

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0