EdgeRouter - CLI로 단일 영역 OSPF 설정하기

download at 2017-07-24T14:45:34Z origin

Example


단일 영역 OSPF 설정 예제는 3개의 ERLite-3를 사용하였습니다.

network.png

R1 환경설정

  • IP 주소를 설정합니다.
ubnt@R1#set interfaces ethernet eth1 address 10.0.50.1/24
  • OSPF 를 설정합니다.
ubnt@R1#set protocols ospf parameters router-id 10.0.50.1
ubnt@R1#set protocols ospf area 0.0.0.0 network 10.0.50.0/24

R2 Configuration

  • IP 주소를 설정합니다.
ubnt@R2#set interfaces ethernet eth1 address 10.0.50.2/24
ubnt@R2#set interfaces ethernet eth2 address 10.0.60.2/24
  • OSPF를 설정합니다.
ubnt@R2#set protocols ospf parameters router-id 10.0.50.2
ubnt@R2#set protocols ospf area 0.0.0.0 network 10.0.50.0/24
ubnt@R2#set protocols ospf area 0.0.0.0 network 10.0.60.0/24

R3 Configuration

  • IP 주소를 설정합니다.
ubnt@R3#set interfaces ethernet eth0 address 10.0.60.3/24
  • OSPF를 설정합니다.
ubnt@R3#set protocols ospf parameters router-id 10.0.60.3
ubnt@R3#set protocols ospf area 0.0.0.0 network 10.0.60.0/24

설정이 완료된 후에는 R1은 10.0.60.0/24가 10.0.50.2에서 접근이 가능하다고 알게 됩니다:

ubnt@R1:~$ show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
   I - ISIS, B - BGP, > - selected route, * - FIB route
S>* 0.0.0.0/0 [210/0] via 192.168.0.1, eth5
O   10.0.50.0/24 [110/10] is directly connected, eth1, 00:00:27
C>* 10.0.50.0/24 is directly connected, eth1
O>* 10.0.60.0/24 [110/20] via 10.0.50.2, eth1, 00:00:11
C>* 127.0.0.0/8 is directly connected, lo
C>* 172.16.3.0/24 is directly connected, eth2
ubnt@R1:~$ ping 10.0.60.3
PING 10.0.60.3 (10.0.60.3) 56(84) bytes of data.
64 bytes from 10.0.60.3: icmp_req=1 ttl=63 time=18.1 ms
^C
--- 10.0.60.3 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 18.175/18.175/18.175/0.000 ms
ubnt@R1:~$ traceroute 10.0.60.3
traceroute to 10.0.60.3 (10.0.60.3), 30 hops max, 60 byte packets
1  10.0.50.2 (10.0.50.2)  0.251 ms  0.219 ms  0.175 ms
2  10.0.60.3 (10.0.60.3)  0.287 ms  0.248 ms  0.266 ms

Notes

다른 유용한 OSPF 명령어들:

OSPF의 IP 정보

ubnt@R1:~$ show ip ospf
OSPF Routing Process, Router ID: 10.0.50.1
Supports only single TOS (TOS0) routes
This implementation conforms to RFC2328
RFC1583Compatibility flag is disabled
OpaqueCapability flag is disabled
Initial SPF scheduling delay 200 millisec(s)
Minimum hold time between consecutive SPFs 1000 millisec(s)
Maximum hold time between consecutive SPFs 10000 millisec(s)
Hold time multiplier is currently 1
SPF algorithm last executed 3m57s ago
SPF timer is inactive
Refresh timer 10 secs
Number of external LSA 0. Checksum Sum 0x00000000
Number of opaque AS LSA 0. Checksum Sum 0x00000000
Number of areas attached to this router: 1
Area ID: 0.0.0.0 (Backbone)
Number of interfaces in this area: Total: 1, Active: 1
Number of fully adjacent neighbors in this area: 1
Area has no authentication
SPF algorithm executed 3 times
Number of LSA 5
Number of router LSA 3. Checksum Sum 0x0000d444
Number of network LSA 2. Checksum Sum 0x00007d31
Number of summary LSA 0. Checksum Sum 0x00000000
Number of ASBR summary LSA 0. Checksum Sum 0x00000000
Number of NSSA LSA 0. Checksum Sum 0x00000000
Number of opaque link LSA 0. Checksum Sum 0x00000000
Number of opaque area LSA 0. Checksum Sum 0x00000000

OSPF 네트워크의 IP 주소 데이터베이스

ubnt@R1:~$ show ip ospf database
   OSPF Router with ID (10.0.50.1)
            Router Link States (Area 0.0.0.0)
Link ID         ADV Router       Age Seq#       CkSum  Link count
10.0.50.1       10.0.50.1        259 0x80000003 0x1f33  1
10.0.50.2       10.0.50.2        259 0x80000006 0x7131  2
10.0.60.3       10.0.60.3        279 0x80000003 0x43e0  1
            Net Link States (Area 0.0.0.0)
Link ID         ADV Router       Age Seq#       CkSum
10.0.50.2       10.0.50.2        260 0x80000001 0x283a
10.0.60.2       10.0.50.2        279 0x80000001 0x54f7

ubnt@R2:~$ show ip ospf neighbor
Neighbor ID     Pri State           Dead Time  Address        Interface            RXmtL RqstL DBsmL
10.0.50.1         1 Full/Backup     31.462s    10.0.50.1      eth1:10.0.50.2          0     0     0
10.0.60.3         1 Full/Backup     31.633s    10.0.60.3      eth2:10.0.60.2          0     0     0

OSPF 인터페이스 확인하기

ubnt@R1:~$ show ip ospf interface eth1
   eth1 is up
      ifindex 3, MTU 1500 bytes, BW 0 Kbit
      Internet Address 10.0.50.1/24, Broadcast 10.0.50.255, Area 0.0.0.0
      MTU mismatch detection:enabled
      Router ID 10.0.50.1, Network Type BROADCAST, Cost: 10
      Transmit Delay is 1 sec, State Backup, Priority 1
      Designated Router (ID) 10.0.50.2, Interface Address 10.0.50.2
      Backup Designated Router (ID) 10.0.50.1, Interface Address 10.0.50.1
      Multicast group memberships: OSPFAllRouters OSPFDesignatedRouters
      Timer intervals configured, Hello 10s, Dead 40s, Wait 40s, Retransmit 5
         Hello due in 8.940s
      Neighbor Count is 1, Adjacent neighbor count is 1