본문 바로가기

Ryu's Tech

LAB 1 - Static Routes

■ Introduce routing
  • 라우팅은 라우터에서 다양한 네트워크를 이어주기 위한 최적의 경로를 찾는 것을 말한다.
  • 주로 라우팅은 Layer3 정보를 이용해서 이루어진다.
  • 어떻게 라우팅 정보를 얻는가?
    • 라우터에 연결된 경로 Directly Connected
    • 정적으로 설정된 경로 Statically Configured
    • 동적으로 설정된 경로 Dynamic Routing Procotols
      • Distance Vector
        • Rip과 같은 라우팅 프로토콜을 말하여
        • 주기적으로 라우팅 테이블을 주변 이웃에게 보낸다.
        • 전체적인 토폴로지는 관계가 없다.
      • Link-State
        • Distance Vector보다 진보된 프로토콜이다.
        • OSPF와 같은 라우팅 프로토콜을 말한다.
        • 라우팅 업데이트를 네트워크 지역의 모든 라우터에게 보낸다.
        • 전체적인 토폴로지와 연관있다.
      • Balanced Hybrid
        • EIGRP와 같은 프로토콜이다.
        • 위의 두 프로토콜의 특징을 합친 개념이다.


■ Administrative Distance

 

  • 라우터는 어떻게 우선순위를 정하는가?
    • Administrative Distance (이하 AD)를 이용하여 우선순위를 결정한다.
Directly Connected 0
Statically Configured 1
EIGRP summary route 5
External BGP 20
Internal EIGRP 90
IGRP 100
IS-IS 115
OSPF 110
RIP(v1 & v2) 120
EGP 140
ODR 160
External EIGRP 170
Internal BGP 200
Unknown or unbelievable 255





■ 앞으로 강좌에서 계속 쓰일 Topology






  • 위의 토폴로지를 이용하여 쭉~~ 써먹을 것이다. pkt를 잘 간직하세요~

  • R1은 R2와 이더넷으로 연결되어있다.
  • R1은 Back-bone과 연결되어있다. (FR)
  • R2는 10.1.2.X의 네트워크와 연결되어 있다.
  • BB1,2 - Backbone routers
  • Stub Network라고 부른다.
    • Stub Network란 외부로 나가는 출구가 하나인 네트워크를 말한다.
    • 여기서는 R2를 통해서만 나가기때문이다.

 

■ Understand when a static route might be used


  • R2->R1
    • 위의 그림을 보면 R2에서 연결되지 않은 네트워크로 나가기 위해서는 결국 Fa0/0 인터페이스를 통해서만 나가기 된다.
    • 즉, 10.1.2.0/24 는 Stub 네트워크 이기 때문에 Default Route가 적합하다.
  • R1->R2
    • 10.1.2.0 / 24 네트워크로 가기 위해서는 192.168.1.2 의 주소로만 연결되어 있다.
    • 이러한 구간이 Static Route 가 적합한 구간이다.


■ static routing의 구문
 

  • Router(config)# ip route network [mask] {address|interface} [distance] [permanent]
    • network : 목적지 네트워크
    • mask : 목적지 네트워크의 서브넷마스크
    • address : 다음 hop의 IP address
    • interface : 연결되는 네트워크로의 로컬 인터페이스
    • distance : AD
    • permanent : Keeps the router in the interface, even the associated local interface is down
                        라우터의 인터페이스가 뻗어도 라우팅 테이블을 그대로 보존한다는 의미인듯?

 


■ Configure static routes

먼저 R1에서 라우팅 테이블을 확인한다.

R1#sh ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     172.16.0.0/30 is subnetted, 2 subnets
C       172.16.1.0 is directly connected, Serial0/0.1
C       172.16.2.0 is directly connected, Serial0/0.2
     192.168.1.0/30 is subnetted, 1 subnets
C       192.168.1.0 is directly connected, FastEthernet0/0
R1#


위와 같이 3개의 네트워크가 R1에 연결된 것을 알 수 있다.
이제 앞에서 배운 대로 Static Route를 구성해 보자

R1(config)#ip route 10.1.2.0 255.255.255.0 192.168.1.2p

해석하면 255.255.255.252 의 서브넷 마스크를 가진 10.1.2.0 이라는 네트워크로 가기 위해서는
192.168.1.2 [ IP address of next-hop ]을 통해서 나가야 한다.


이제 R2의 라우팅 테이블을 확인해 보자

R2#sh ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/24 is subnetted, 1 subnets
C       10.1.2.0 is directly connected, FastEthernet0/1
     192.168.1.0/30 is subnetted, 1 subnets
C       192.168.1.0 is directly connected, FastEthernet0/0
R2#

R2는 10.1.1.0 과

R2는 10.1.2.0 과 192.168.1.0의 두개의 네트워크와 연결되어 있다.
이 말은 즉, Stub 네트워크이다. 10.1.2.0 네트워크에서는 자신의 네트워크에 대한 패킷을 제외하고는 모두 외부로 나가야 한다.

Default route를 설정해 보자

모든 패킷은 외부로 나가야 한다. 그러므로 Default route를 해야한다.

R2(config)#ip route 0.0.0.0 0.0.0.0 fa0/0

0.0.0.0 0.0.0.0 은 모~~~~~~~~~~~~~든 네트워크라는 뜻이다.
즉, 패킷을 싸그리 자신과 연결된 fa0/0 인터페이스로 보낸다.


이제 설정은 끝

■ static routes 확인

자 이제 R1에서 라우팅 테이블을 확인해 보자


R1#sh ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/24 is subnetted, 1 subnets
S       10.1.2.0 [1/0] via 192.168.1.2
     172.16.0.0/30 is subnetted, 2 subnets
C       172.16.1.0 is directly connected, Serial0/0.1
C       172.16.2.0 is directly connected, Serial0/0.2
     192.168.1.0/30 is subnetted, 1 subnets
C       192.168.1.0 is directly connected, FastEthernet0/0
R1#

위에서 보이는대로 10.1.2.0 으로 가기위해 192.168.1.2 로 Routing 되는 것을 확인할 수 있고,
앞의 S를 보고 Static Route 가 이루어진 것을 볼 수 있다.
그럼 확인을 위해서 R2로 핑을 날려보자

R1#ping 10.1.2.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.2.2, timeout is 2 seconds:
.!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 25/30/32 ms

R1#

이상없이 핑이 날아가는 것을 알 수 있다.
최초의 핑이 실패하는 것은 arp 에 대한 요청 때문에 실패하는 것이다.



자 이제 R2로 가보자

R2#sh ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is 0.0.0.0 to network 0.0.0.0

     10.0.0.0/24 is subnetted, 1 subnets
C       10.1.2.0 is directly connected, FastEthernet0/1
     192.168.1.0/30 is subnetted, 1 subnets
C       192.168.1.0 is directly connected, FastEthernet0/0
S*   0.0.0.0/0 is directly connected, FastEthernet0/0
R2#

역시 제대로 성립된 것을 볼 수 있다.
Static Route라는 것을 확인할 수 있고 추가로 * 을 통해 Default Route 라는 것을 확인 할 수 있다.


R2#ping 172.16.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 31/31/32 ms

R2# 

똑같이 최초의 핑은 ARP 때문에 실패하지만 제대로 연결된 것을 확인할수 있다!



■ Save configuration

자 이제 저장하는 방법에 대해서 알아보자

R1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
R1#


구동설정을 시작설정으로 복사한다는 의미이다.
즉, 이 명령어를 쓰지 않으면 라우터가 재부팅 될때 설정한 정보는 지워진다는 뜻이다.
잊지말자.

R2#copy run star
Destination filename [startup-config]?
Building configuration...
[OK]
R2#


이 역시 줄여서 copy run star 명령어로 쓰는 것이 편하다.








끝!@@@!!!!!!!!!!!!!!!!