ネットワーク備忘録

アラフォーエンジニアのネットワーク系の備忘録。twitter:@deigo25374582

JUNOSのOSPF_その1

まずは簡単なやつ

構成は↓

f:id:klock_3rd:20180503154933p:plain

 

R1-R8まで、エリア0でやってみる。
CiscoについてはR3のみでJuniperに関してはR5のみ

<R3>

 interface Loopback0
ip address 1.1.1.3 255.255.255.255
ip ospf network point-to-point
ip ospf 1 area 0
!
interface GigabitEthernet2
ip address 172.16.4.1 255.255.255.0
ip ospf 1 area 0
!
interface GigabitEthernet3
ip address 172.16.2.254 255.255.255.0
ip ospf 1 area 0
!
interface GigabitEthernet4
ip address 172.16.5.1 255.255.255.0
ip ospf 1 area 0
!
router ospf 1
router-id 1.1.1.3
!

 そして、R5

<R5>
set interfaces ge-0/0/0 unit 0 family inet address 172.16.7.1/24
set interfaces ge-0/0/1 unit 0 family inet address 172.16.8.1/24
set interfaces ge-0/0/2 unit 0 family inet address 172.16.5.254/24
set interfaces lo0 unit 0 family inet address 2.1.1.5/32
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0
set protocols ospf area 0.0.0.0 interface ge-0/0/2.0
set protocols ospf area 0.0.0.0 interface lo0.0
set routing-options graceful-restart
router-id 2.1.1.5;

 

そして、Cisco&Juniperは物理IFはpoint-to-pointを入れてないので、DR/BDRの選出あり

R3の状態確認

R3#show ip ospf neighbor

Neighbor ID  Pri State    Dead Time Address   Interface
2.1.1.5   128 FULL/DR   00:00:37  172.16.5.254  GigabitEthernet4
1.1.1.1    1 FULL/BDR   00:00:38  172.16.2.1  GigabitEthernet3
1.1.1.4    1 FULL/DR   00:00:36  172.16.4.254  GigabitEthernet2
R3#

 JuniperのデフォルトPriorityは128なので、何もしないとJuniper側がDR

 

 

では、R6を以下に設定

set interfaces ge-0/0/0 unit 0 family inet address 172.16.7.254/24
set interfaces ge-0/0/1 unit 0 family inet address 172.16.9.254/24
set interfaces ge-0/0/2 unit 0 family inet address 172.16.6.1/24
set interfaces lo0 unit 0 disable
set interfaces lo0 unit 0 family inet address 2.1.1.6/32
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0
set protocols ospf area 0.0.0.0 interface ge-0/0/2.0
set protocols ospf area 0.0.0.0 interface lo0.0
set routing-options graceful-restart

 R6はRouter-id未設定&lo0はdisable
この状態でR5で見ると・・・

 admin@R5> show ospf neighbor
Address    Interface     State  ID     Pri Dead
172.16.7.254  ge-0/0/0.0     Full  172.16.6.1   128  36
172.16.8.254  ge-0/0/1.0     Full  2.1.1.7    128  39
172.16.5.1   ge-0/0/2.0     Full  1.1.1.3    1  33

 

admin@R5> show ospf interface
Interface    State Area    DR ID    BDR ID    Nbrs
ge-0/0/0.0    BDR  0.0.0.0   172.16.6.1  2.1.1.5    1
ge-0/0/1.0    BDR  0.0.0.0   2.1.1.7   2.1.1.5    1
ge-0/0/2.0    DR  0.0.0.0   2.1.1.5   1.1.1.3    1
lo0.0     DR  0.0.0.0   2.1.1.5   0.0.0.0    0

Router-IDが想定と違う

念のため、R4のCiscoでも確認

R4#show ip ospf neighbor

Neighbor ID  Pri State    Dead Time Address   Interface
172.16.6.1  128 FULL/DR   00:00:35  172.16.6.1  GigabitEthernet4
1.1.1.2    1 FULL/BDR   00:00:38  172.16.3.254  GigabitEthernet3
1.1.1.3    1 FULL/DR   00:00:34  172.16.4.1  GigabitEthernet2

 

CiscoではOSPFのルータID選出時は

 「手動のrouter-id」→「UPのloopBackの最大アドレス」→「UPの物理アドレスが大きいもの」という順番だったはず。

勘違いかも?ってことで、R2に以下を入れて確認

interface Loopback0
ip address 1.1.1.2 255.255.255.255
ip ospf network point-to-point
ip ospf 1 area 0
shutdown
!
interface GigabitEthernet1
ip address 192.168.2.202 255.255.255.0
!
interface GigabitEthernet2
ip address 172.16.1.254 255.255.255.0
ip ospf 1 area 0
!
interface GigabitEthernet3
ip address 172.16.3.254 255.255.255.0
ip ospf 1 area 0
!
router ospf 1
!

loopbackをshutし、OSPFが有効ではないGi2を作って、Roter-IDを削除

この状態でR4で確認

R4#show ip ospf neighbor

Neighbor ID  Pri State    Dead Time Address   Interface
172.16.6.1  128 FULL/DR   00:00:36  172.16.6.1  GigabitEthernet4
192.168.2.202  1 FULL/BDR   00:00:36  172.16.3.254  GigabitEthernet3
1.1.1.3    1 FULL/BDR   00:00:37  172.16.4.1  GigabitEthernet2

やはり、認識はあっていた
けれどもJuniperはそうではない模様なので、調べてみた

 

www.juniper.net

The router identifier is used by OSPF to identify the routing device from which a packet originated. Junos OS selects a router identifier according to the following set of rules

1.By default, Junos OS selects the lowest configured physical IP address of an interface as the router identifier.

2.If a loopback interface is configured, the IP address of the loopback interface becomes the router identifier.

3.If multiple loopback interfaces are configured, the lowest loopback address becomes the router identifier.

4.If a router identifier is explicitly configured using the router-id address statement under the [edit routing-options] hierarchy level, the above three rules are ignored.

 router-idがなければ、Loopbackの最小アドレス、それがなければ物理IFの最小アドレスとなる模様。
 ここは想定していなかったので一旦終わり

 

やはり実機で確認してよかった。。