본문 바로가기
네트워크 수업

[실습] OSPF, EIGRP 23.04.06

by 6^6 2023. 4. 6.
728x90

conf t

int s1/0

no shut

encap fram

no frame inverse

no ip domain lookup
no ip routing
line c 0
 logg sy
 exec-timeout 0
do copy r s

 

 

 

 

 

ip add 넣기

R1]

int loo0

ip add 6.6.1.1 255.255.255.0

int s1/0

ip add 6.6.12.1 255.255.255.0

frame map ip 6.6.12.2 102 br

 

R2]

int  loo0

ip add 6.6.2.2 255.255.255.0

int s1/0.12 m

ip add 6.6.12.2 255.255.255.0

frame map ip 6.6.12.1 201 br

int s1/0.23 m

ip add 6.6.23.2 255.255.255.0

frame map ip 6.6.23.3 203 br

 

R3]

int loo0

ip add 6.6.3.3 255.255.255.0

int s1/0.23 m

ip add 6.6.23.3 255.255.255.0

frame map ip 6.6.23.2 302 br

int s1/0.34 p

ip add 6.6.34.3 255.255.255.0

frame inter 304

 

R4]

int loo0

ip add 6.6.4.4 255.255.255.0

int s1/0.34 p

ip add 6.6.34.4 255.255.255.0

frame inter 403

 

ping 날려보기 

 


OSPF

 

DR을 선출하는 경우는 두가지가 있다.

Broadcast 와 Non Broadcast Multi Access(NBMA)

 

R1]

router ospf 6
 router-id 6.6.1.1
 network 6.6.1.1 0.0.0.0 area 0
 network 6.6.12.1 0.0.0.0 area 0

 

R2]
router ospf 6
 router-id 6.6.2.2
 network 6.6.2.2 0.0.0.0 area 0
 network 6.6.12.2 0.0.0.0 area 0

 

router eigrp 6
net 6.6.23.2 0.0.0.0 
no auto

 

 

R3]

router eigrp 6
eigrp router-id 6.6.3.3
net 6.6.3.3 0.0.0.0  
net 6.6.23.3 0.0.0.0
net 6.6.34.3 0.0.0.0
no auto
passive-interface loo0

R4]

router eigrp 6
eigrp router-id 6.6.4.4
net 6.6.4.4 0.0.0.0
net 6.6.34.4 0.0.0.0
passive-interface loo0
no auto

 

 

R1]

show ip ospf int s1/0
  Process ID 1, Router ID 6.6.1.1, Network Type NON_BROADCAST, Cost: 64

int s1/0
ip ospf network broadcast //DR을 선출하기위해 broadcast로 인위적으로 바꾼다.

 

R2]

int s1/0.12
ip ospf network br
ip ospf network broadcast   //50초 걸린다.

 

 

R1, R2 각각 확인해주기

do show ip ospf nei 

do show ip eigrp nei


R1에게 EIGRP도 보이게 하기

R1에게 show ip route하면 34.0 23.0 3.3 4.4 영역은 안보일것이다. 이 사태을 어떻게 해결할 것인가??

 

R2]  // 이 경계라우터에서 

router ospf 6 //ospf 쪽에서 EIGRP를 자기쪽으로 끌어온다.

redistribute eigrp 6 subnets //이렇게 하면 metric이 자동계산된다.

 

router eigrp 6 //이제 eigrp에서 ospf를 끌어온다.

redistribute ospf 6 metric 1544 2000 255 1 1500 // show ip int s1/0

//1544 belongs to EIGRP BW, delay, reliability, load, MTU

 

 

 

 

===

R1(config-if)#do show ip ospf neig

Neighbor ID     Pri   State           Dead Time   Address         Interface
6.6.2.2           1   FULL/DR         00:00:33    6.6.12.2        Serial1/0


R1(config-if)#do show ip route

     6.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
O       6.6.2.2/32 [110/65] via 6.6.12.2, 01:49:56, Serial1/0
C       6.6.1.0/24 is directly connected, Loopback0
E2    6.6.3.0/24 [110/20] via 6.6.12.2, 00:56:00, Serial1/0
O E2    6.6.4.0/24 [110/20] via 6.6.12.2, 00:49:05, Serial1/0
C       6.6.12.0/24 is directly connected, Serial1/0
O E2    6.6.23.0/24 [110/20] via 6.6.12.2, 00:56:00, Serial1/0
O E2    6.6.34.0/24 [110/20] via 6.6.12.2, 00:53:43, Serial1/0

//E1 : 외부 변동포트

//E2 : 외부 고정포트- 외부 고정포트란? EIGRP가 OSPF로 넘어오면 20으로 고정이라는 뜻.(라우터를 거치면 거칠수록 홉수가 늘어나야 하는데 안늘어나는것임.)

 

 

20으로 계속 고정되는지 한번 확인해보자

R2]

sh run | begin ospf

 

 


 

R2]

router ospf 6

no redi eigrp 6 subnet
redi eigrp 6 subnet metric-type 1  //넘기면넘길수록 늘어난다.(1이 E1 = 외부 변동포트)

R1]

clear ip route *

show ip route

//이렇게 하면 홉 수가 20→84로 늘어난 것을 알 수 있다. 

 

show ip route
     6.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
O       6.6.2.2/32 [110/65] via 6.6.12.2, 00:00:00, Serial1/0
C       6.6.1.0/24 is directly connected, Loopback0
O E1    6.6.3.0/24 [110/84] via 6.6.12.2, 00:00:00, Serial1/0
O E1    6.6.4.0/24 [110/84] via 6.6.12.2, 00:00:00, Serial1/0
C       6.6.12.0/24 is directly connected, Serial1/0
O E1    6.6.23.0/24 [110/84] via 6.6.12.2, 00:00:00, Serial1/0
O E1    6.6.34.0/24 [110/84] via 6.6.12.2, 00:00:00, Serial1/0

 

 

 

R3에선 EX(eigrp externel --> 외부는 170 =>ospf에서 넘어왔으니까!)

R3(config)#do show ip route

     6.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
D EX    6.6.1.1/32 [170/2681856] via 6.6.23.2, 01:02:04, Serial1/0.23
D EX    6.6.2.0/24 [170/2681856] via 6.6.23.2, 01:02:04, Serial1/0.23
C       6.6.3.0/24 is directly connected, Loopback0
D       6.6.4.0/24 [90/2297856] via 6.6.34.4, 00:55:22, Serial1/0.34
D EX    6.6.12.0/24 [170/2681856] via 6.6.23.2, 01:02:04, Serial1/0.23
C       6.6.23.0/24 is directly connected, Serial1/0.23
C       6.6.34.0/24 is directly connected, Serial1/0.34

//EX : eigrp externel = 외부


3. null 0 가 보이게 하시요 = summary 축약하라는 말.

무슨뜻이냐. : OSPF를 넘겨서 EIGRP에서 축약하라는것.

 

R2]

int s1/0.23

ip summary-address eigrp 6 6.6.0.0 255.255.240.0  //이렇게 하면 null 0가 보인다.

//*Mar  1 02:36:23.127: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 6: Neighbor 6.6.23.3 (Serial1/0.23) is resync: summary configured

 

show ip route

     6.0.0.0/8 is variably subnetted, 8 subnets, 3 masks
O       6.6.1.1/32 [110/65] via 6.6.12.1, 01:57:35, Serial1/0.12
D       6.6.0.0/20 is a summary, 00:00:05, Null0
C       6.6.2.0/24 is directly connected, Loopback0
D       6.6.3.0/24 [90/2297856] via 6.6.23.3, 01:56:48, Serial1/0.23
D       6.6.4.0/24 [90/2809856] via 6.6.23.3, 00:56:44, Serial1/0.23
C       6.6.12.0/24 is directly connected, Serial1/0.12
C       6.6.23.0/24 is directly connected, Serial1/0.23
D       6.6.34.0/24 [90/2681856] via 6.6.23.3, 01:01:25, Serial1/0.23

 

//이건 루프 방지용이다. 루프 방지를 하려고 Null0가 자동으로 생김!!

 

R4]

clear ip route *

show ip route
     6.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
D       6.6.0.0/20 [90/3193856] via 6.6.34.3, 00:00:04, Serial1/0.34
D       6.6.3.0/24 [90/2297856] via 6.6.34.3, 00:00:04, Serial1/0.34
C       6.6.4.0/24 is directly connected, Loopback0
D       6.6.23.0/24 [90/2681856] via 6.6.34.3, 00:00:04, Serial1/0.34
C       6.6.34.0/24 is directly connected, Serial1/0.34

//6.6.0.0 이 축약돼서 넘어온거 확인 가능. 

//AD값170으로 이상하게 나타나지 않게 됨.

//이제 깔끔하게 되었지만 문제 하나 더있음.!!!

 

 

 

R1]

show ip route

     6.0.0.0/8 is variably subnetted, 8 subnets, 3 masks
O       6.6.2.2/32 [110/65] via 6.6.12.2, 00:05:01, Serial1/0
O E1    6.6.0.0/20 [110/84] via 6.6.12.2, 00:03:04, Serial1/0 =>오바이트 현상 
C       6.6.1.0/24 is directly connected, Loopback0
O E1    6.6.3.0/24 [110/84] via 6.6.12.2, 00:05:01, Serial1/0
O E1    6.6.4.0/24 [110/84] via 6.6.12.2, 00:05:01, Serial1/0
C       6.6.12.0/24 is directly connected, Serial1/0
O E1    6.6.23.0/24 [110/84] via 6.6.12.2, 00:05:01, Serial1/0
O E1    6.6.34.0/24 [110/84] via 6.6.12.2, 00:05:03, Serial1/0

//상호작용되면 아주 골치아픈 일들이 많이 생긴다.

//OSPF가 Summary(축약)돼서 EIGRP로 갔더니 다시 오바이트 돼서 OSPF쪽으로 간다.

 


오바이트현상 없애기 2가지 방법

 

방법2개

1. route map으로 잡아서 eigrp에 있는 4개(3.3 23.0 34.0 4.4)를 ospf로 넘긴다.

2. 넘길때 ospf 접선(타원)에서 거르는방법(프로세서에서. 인터페이스에서x)

 

 

방법 1>> 우리가 아는 방법 : route map으로 해서 넘긴다.

//route-map

//네트워크 경로 조정 및 차단, metric 값 설정 등의 용도로 사용되는 일종의 루트 조정 도구

R2] 

ip prefix-list EIGRP_NET permit 6.6.23.0/24     
ip prefix-list EIGRP_NET permit 6.6.3.0/24 
ip prefix-list EIGRP_NET permit 6.6.34.0/24
ip prefix-list EIGRP_NET permit 6.6.4.0/24

 

route-map EIGRP_NET 
match ip address prefix-list EIGRP_NET 

 

//그 다음 재분배

router ospf 6

redistribute eigrp 6 subnets route-map EIGRP_NET

//subnets안하면 재분배 안된다.

 

 

R1]

clear ip route *
show ip route

     6.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
O       6.6.2.2/32 [110/65] via 6.6.12.2, 00:00:04, Serial1/0  ==>이제 오바이트 현상이 없다.

//OSPF특징. OSPF에서는 loopback을 32bits(host route)로 광고하는 특성이 있다.

//R2가 2.2를 32bits로 광고한다.

C       6.6.1.0/24 is directly connected, Loopback0
O E2    6.6.3.0/24 [110/20] via 6.6.12.2, 00:00:04, Serial1/0
O E2    6.6.4.0/24 [110/20] via 6.6.12.2, 00:00:04, Serial1/0
C       6.6.12.0/24 is directly connected, Serial1/0
O E2    6.6.23.0/24 [110/20] via 6.6.12.2, 00:00:04, Serial1/0
O E2    6.6.34.0/24 [110/20] via 6.6.12.2, 00:00:04, Serial1/0

 

 

이럴경우 R2에서

 

R2]

int loo0
ip ospf network point-to-p  ==>이 명령어를 주면 정상적으로 24bits로 광고를 한다.

 

R1]

R1#clear ip route *
R1#show ip route
     6.0.0.0/24 is subnetted, 6 subnets
C       6.6.1.0 is directly connected, Loopback0
O       6.6.2.0 [110/65] via 6.6.12.2, 00:00:03, Serial1/0  ==>아까는 32비트였는데 24비트로 바뀜!
O E2    6.6.3.0 [110/20] via 6.6.12.2, 00:00:03, Serial1/0
C       6.6.12.0 is directly connected, Serial1/0
O       6.6.23.0 [110/128] via 6.6.12.2, 00:00:03, Serial1/0
O E2    6.6.34.0 [110/20] via 6.6.12.2, 00:00:03, Serial1/0

 

 R2에서도 마찬가지로 6.6.1.0 이 32비트로 보이기때문에 R1 루프백에서 p-to-p로 줘야함.

 

R1]

int loo0
ip ospf net point-to-p

 

show ip route

     6.0.0.0/24 is subnetted, 7 subnets
C       6.6.1.0 is directly connected, Loopback0
O       6.6.2.0 [110/65] via 6.6.12.2, 00:00:04, Serial1/0
O E2    6.6.3.0 [110/20] via 6.6.12.2, 00:00:04, Serial1/0
O E2    6.6.4.0 [110/20] via 6.6.12.2, 00:00:04, Serial1/0
C       6.6.12.0 is directly connected, Serial1/0
O E2    6.6.23.0 [110/20] via 6.6.12.2, 00:00:04, Serial1/0
O E2    6.6.34.0 [110/20] via 6.6.12.2, 00:00:04, Serial1/0

 

 

그럼 처음부터 32비트로 광고하지말고 24비트로 광고한다면??

R1(config-if)#ip ospf net point-to-p
R1(config-if)#router ospf 6
R1(config-router)#no network 6.6.1.1 0.0.0.0 area 0
R1(config-router)#network 6.6.1.0 0.0.0.255 area 0
R1(config-router)#int loo0
R1(config-if)#no ip ospf net point-to-p

 

R2(config-if)#int loo0
R2(config-if)#no ip ospf network point-to-p
R2(config-if)#router ospf 6
R2(config-router)#no net 6.6.2.2 0.0.0.0 a 0
R2(config-router)#net 6.6.2.0 0.0.0.255 a 0

 

하고 clear ip route * / show ip route해보자

==>그래도....32비트로 넘어온다... 루프백에서 넘어오는건 다 32비트이도록 만들어졌다.....

==>그럼 왜 굳이 32비트를 24비트로 바꿔줘야하나? 내가 루프백에 24비트로 넣어줬기 때문에 6.6.x.0 이 넘어가야한다.

 

 

 

두 번째 방법>> distribute-list 로 거르기

일단 이전에 했던 방법 지우기

R2]

sh run | begin ospf

router ospf 6            
no redistribute eigrp 6 subnets route-map EIGRP_NET

 


redistribute eigrp 6 subnets ==>이러면 오바이트할것임.

distribute-list prefix OVER_WRITE out eigrp 6  ==>왜 out을 했느냐? ospf프로세서 안에서 eigrp를 밀쳐내는거라서.outbound로 나가는것!

 

ip prefix-list OVER_WRITE deny 6.6.0.0/20
ip prefix-list OVER_WRITE permit 0.0.0.0/0 le 32   // le는 [less than+equal to] 0≤x≤32

 

 

R1]

show ip route  ==>20bit짜리 없다. 잘 걸러짐.

     6.0.0.0/24 is subnetted, 7 subnets
C       6.6.1.0 is directly connected, Loopback0
O       6.6.2.0 [110/65] via 6.6.12.2, 00:14:23, Serial1/0
O E2    6.6.3.0 [110/20] via 6.6.12.2, 00:01:44, Serial1/0
O E2    6.6.4.0 [110/20] via 6.6.12.2, 00:01:44, Serial1/0
C       6.6.12.0 is directly connected, Serial1/0
O E2    6.6.23.0 [110/20] via 6.6.12.2, 00:01:44, Serial1/0
O E2    6.6.34.0 [110/20] via 6.6.12.2, 00:01:44, Serial1/0

 

두번째 방법이 더 좋은 방법임. -첫번째방법으로 하면 뭐하나 라우터 생기면 route-map으로 또 걸러야하기 때문.


문제4>>

 

R4]

int loo5
ip add 5.5.8.1 255.255.255.0
ip add 5.5.9.1 255.255.255.0 sec
ip add 5.5.10.1 255.255.255.0 sec
ip add 5.5.11.1 255.255.255.0 sec

 

router eigrp 6 
net 5.5.8.0 0.0.3.255  ==>이렇게 해야 8,9,10,11 이 들어간다.

 

int s1/0.34
ip summary-address eigrp 6 5.5.8.0  255.255.252.0

 

 

R1]

show ip route
     5.0.0.0/22 is subnetted, 1 subnets
O E2    5.5.8.0 [110/20] via 6.6.12.2, 00:03:00, Serial1/0
     6.0.0.0/24 is subnetted, 7 subnets
C       6.6.1.0 is directly connected, Loopback0
O       6.6.2.0 [110/65] via 6.6.12.2, 00:22:21, Serial1/0
O E2    6.6.3.0 [110/20] via 6.6.12.2, 00:09:41, Serial1/0
O E2    6.6.4.0 [110/20] via 6.6.12.2, 00:09:41, Serial1/0
C       6.6.12.0 is directly connected, Serial1/0
O E2    6.6.23.0 [110/20] via 6.6.12.2, 00:09:41, Serial1/0
O E2    6.6.34.0 [110/20] via 6.6.12.2, 00:09:43, Serial1/0

 


R3]
     5.0.0.0/22 is subnetted, 1 subnets  
D       5.5.8.0 [90/2297856] via 6.6.34.4, 00:01:26, Serial1/0.34  ==>R4한테 온거고 R2한테는 온게 없다!!
     6.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
D       6.6.0.0/20 [90/2681856] via 6.6.23.2, 01:51:23, Serial1/0.23
C       6.6.3.0/24 is directly connected, Loopback0
D       6.6.4.0/24 [90/2297856] via 6.6.34.4, 02:48:02, Serial1/0.34
C       6.6.23.0/24 is directly connected, Serial1/0.23
C       6.6.34.0/24 is directly connected, Serial1/0.34

 

 

확인해보니 오바이트 현상은 없다.

 

 

 

 

 

728x90

'네트워크 수업' 카테고리의 다른 글

23.04.13 OSPF  (0) 2023.04.13
[실습] OSPF 23.04.11  (0) 2023.04.11
OSPF 23.04.04  (0) 2023.04.04
EIGRP default-route 23.04.04  (0) 2023.04.04
[리눅스] 23.03.31  (0) 2023.03.31

댓글