라우터: 목적지로 가는 최적의 경로를 설정
-> 라우팅 테이블 등록
-> 라우터는 출발지 주소와는 상관없이 목적지 주소로만 동작합니다.
Static Routing
Static Routing은 관리자가 직접 Routing 정보를 입력해주는 Routing 방식으로
네트워크를 전부 수동으로 입력해 주어야 합니다.
그러므로 소규모 네트워크에 적합하고 관리가 용이하며 보안이 뛰어납니다.
R1)
conf t
int f0/0
ip add 172.16.1.254 255.255.255.0
no sh
int s1/0
ip add 172.16.12.1 255.255.255.0
no sh
int s1/1
ip add 172.16.13.1 255.255.255.0
no sh
int s1/2
ip add 172.16.14.1 255.255.255.0
no sh
exit
# 이 줄을 기준으로 위쪽은 라우터와 직접 연결된 네트워크들의 정보
# 아래쪽은 Static Routing으로 수동으로 연결해준 네트워크들의 정보
# Static Routing을 설정하는 방법:
# ip route 목적지네트워크 목적지서브넷 목적지인터페이스 Next-Hop주소
ip route 172.16.2.0 255.255.255.0 s1/0
ip route 172.16.3.0 255.255.255.0 s1/1
ip route 172.16.4.0 255.255.255.0 s1/2
ip route 172.16.23.0 255.255.255.0 s1/0
# ip route 172.16.23.0 255.255.255.0 s1/1
# 목적지로 가는 경로가 여러개인 경우 하나만 정할 수도 있고
# 둘다 입력해도 됩니다 (이중화)
# Next-Hop주소는 인터페이스가 연결된 반대쪽 주소를 말하며
# 인터페이스와 Next-hop중에 하나만 주어도 되지만 둘다 주는것이 안정성이 좋습니다.
# 목적지인터페이스는 자신의 인터페이스를 쓰는것
# Next-Hop 주소는 목적지의 인터페이스 IP주소를 쓰는것
# 헷갈리므로 주의!
# ip route 172.16.2.0 255.255.255.0 s1/0 172.16.12.2
# ip route 172.16.3.0 255.255.255.0 s1/1 172.16.13.3
# ip route 172.16.4.0 255.255.255.0 s1/2 172.16.14.4
# ip route 172.16.23.0 255.255.255.0 s1/0 172.16.12.2
end
wr
R2)
conf t
int f0/0
ip add 172.16.2.254 255.255.255.0
no sh
int s1/0
ip add 172.16.12.2 255.255.255.0
no sh
int s1/3
ip add 172.16.23.2 255.255.255.0
no sh
exit
ip route 172.16.1.0 255.255.255.0 s1/0
ip route 172.16.3.0 255.255.255.0 s1/3
ip route 172.16.4.0 255.255.255.0 s1/0
ip route 172.16.13.0 255.255.255.0 s1/3
ip route 172.16.14.0 255.255.255.0 s1/0
end
wr
R3)
conf t
int f0/0
ip add 172.16.3.254 255.255.255.0
no sh
int s1/1
ip add 172.16.13.3 255.255.255.0
no sh
int s1/3
ip add 172.16.23.3 255.255.255.0
no sh
exit
ip route 172.16.1.0 255.255.255.0 s1/1
ip route 172.16.2.0 255.255.255.0 s1/3
ip route 172.16.4.0 255.255.255.0 s1/1
ip route 172.16.12.0 255.255.255.0 s1/3
ip route 172.16.14.0 255.255.255.0 s1/1
end
wr
R4)
conf t
int f0/0
ip add 172.16.4.254 255.255.255.0
no sh
int s1/2
ip add 172.16.14.4 255.255.255.0
no sh
exit
ip route 172.16.1.0 255.255.255.0 s1/2
ip route 172.16.2.0 255.255.255.0 s1/2
ip route 172.16.3.0 255.255.255.0 s1/2
ip route 172.16.12.0 255.255.255.0 s1/2
ip route 172.16.13.0 255.255.255.0 s1/2
ip route 172.16.23.0 255.255.255.0 s1/2
# R4는 직접 연결된 172.16.4.0 네트워크를 제외하고
# 전부 s1/2 인터페이스를 타고 가야합니다.
end
wr
Static Routing 수퍼네팅
다음과 같이 네트워크가 많을 경우, 수퍼네팅을 이용하여
라우팅할 주소를 묶어줄 수 있습니다.
R1)
conf t
ip route 172.16.16.0 255.255.240.0 s4/1
# 172.16.16.0 ~ 172.16.31.0 네트워크를 수퍼네팅
ip route 10.1.0.0 255.255.248.0 s4/1
# 10.1.0.0 ~ 10.1.7.0 네트워크를 수퍼네팅
ip route 192.168.23.0 255.255.255.0 s4/1
R2)
conf t
ip route 172.16.0.0 255.255.240.0 s4/1
ip route 10.1.0.0 255.255.248.0 s4/2
R3)
conf t
ip route 172.16.0.0 255.255.224.0 s4/2
# 172.16.0.0 ~ 172.16.31.0 네트워크를 수퍼네팅
ip route 192.168.12.0 255.255.255.0 s4/2