ospf는 Process ID를 지정해 주어야 하며
다른 라우터와 같을 필요는 없습니다.
그리고 네트워크를 지정할 때 area번호를 지정해 주어야 합니다.
area가 하나일땐 상관없으나 여러개 있을때는 반드시 area 0이 있어야 하며
area 0 은 하나만 존재할 수 있습니다.
R1)
conf t
int f0/0
ip add 172.16.123.1 255.255.255.0
no sh
int f0/1
ip add 172.16.1.254 255.255.255.0
no sh
router ospf 1
network 172.16.1.0 0.0.0.255 area 0
network 172.16.123.0 0.0.0.255 area 0
end
wr
R2)
conf t
int f0/0
ip add 172.16.123.2 255.255.255.0
no sh
int f0/1
ip add 172.16.2.254 255.255.255.0
no sh
router ospf 2
network 172.16.2.0 0.0.0.255 area 0
network 172.16.123.0 0.0.0.255 area 0
end
wr
R3)
conf t
int f0/0
ip add 172.16.123.3 255.255.255.0
no sh
int f0/1
ip add 172.16.3.254 255.255.255.0
no sh
router ospf 3
network 172.16.3.0 0.0.0.255 area 0
network 172.16.123.0 0.0.0.255 area 0
end
wr
R4)
conf t
int f0/0
ip add 172.16.123.4 255.255.255.0
no sh
int f0/1
ip add 172.16.4.254 255.255.255.0
no sh
router ospf 4
network 172.16.4.0 0.0.0.255 area 0
network 172.16.123.0 0.0.0.255 area 0
end
wr
ospf는 잘 연결되었으면 Loading Done이라는 메시지가 출력됩니다.
show ip ospf neighbor
DR = Designated Router
BDR = Backup Desiganted Router
DROUTHER = 기타
현재 네트워크에서는 1번이 DR이고 4번이 BDR입니다.
OSPF의 DR을 설정하는 규칙 :
기본적으로 OSPF는 Loopback 주소가 가장 높은 IP주소로 설정.
Loopback가 없을 경우 물리적 인터페이스중 가장 높은 IP주소로 설정.
DR를 임의로 바꾸고 싶으면 DR과 BDR을 둘다 네트워크에서 제외한 후
ospf를 재설정 해주면 됩니다.
clear ip ospf process
라우터는 숫자가 높은게 우선순위가 높습니다.
스위치는 숫자가 낮은게 우선순위가 높습니다.