위의 토폴로지를 DHCP와 ip route를 이용하여 대구-부산-울산 통신이 가능하게 할 계획이다.
- Daegu_RO 설정
Router>ena
Router#
Router#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host Daegu_RO
>> 호스트명 변경
Daegu_RO(config)#int fa0/1
Daegu_RO(config-if)#ip add 192.168.1.1 255.255.255.0
Daegu_RO(config-if)#no sh
>> fa0/1 경로에 ip를 넣고 no shutdown
Daegu_RO(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Daegu_RO(config-if)#int fa0/0
Daegu_RO(config-if)#ip add 192.168.3.1 255.255.255.0
Daegu_RO(config-if)#
Daegu_RO(config-if)#no sh
Daegu_RO(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
Daegu_RO(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Daegu_RO(config-if)#ex
Daegu_RO(config)#ip dhcp pool Daegu
Daegu_RO(dhcp-config)#network 192.168.1.0 255.255.255.0
Daegu_RO(dhcp-config)#default-router 192.168.1.1
Daegu_RO(dhcp-config)#dns-server 192.168.1.1
>> Daegu 의 이름으로 dhcp를 설정 해주었다.
네트워크 IP는 192.168.1.0/24
게이트웨이 주소는 192.168.1.1
DNS 서버 주소는 192.168.1.1 (이번에 사용하지는 않았지만 설정은 해주었다.)
Daegu_RO(dhcp-config)#%DHCPD-4-PING_CONFLICT: DHCP address conflict: server pinged 192.168.1.1.
>> 대구의 두개의 피시중 하나는 IP를 Static으로 설정해주었고,
하나는 DHCP로 설정을 하자 위와 같은 메시지가 출력되며 IP주소를 받았다.
- Busan_RO 설정
Router(config)#host Busan_RO
Busan_RO(config)#
Busan_RO(config)#INT FA0/0
Busan_RO(config-if)#ip add 192.168.3.2 255.255.255.0
Busan_RO(config-if)#no sh
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Busan_RO(config-if)#int fa0/1
Busan_RO(config-if)#ip add 192.168.2.1 255.255.255.0
Busan_RO(config-if)#no sh
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Busan_RO(config-if)#int se0/3
Busan_RO(config)#int se0/3/0
Busan_RO(config-if)#ip add 192.168.4.1 255.255.255.0
Busan_RO(config-if)#no sh
%LINK-5-CHANGED: Interface Serial0/3/0, changed state to down
%LINK-5-CHANGED: Interface Serial0/3/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/3/0, changed state to up
Busan_RO(config)#ip dhcp pool Busan
Busan_RO(dhcp-config)#network 192.168.2.0 255.255.255.0
Busan_RO(dhcp-config)#default-router 192.168.2.1
Busan_RO(dhcp-config)#dns-server 192.168.2.1
Busan_RO(dhcp-config)#%DHCPD-4-PING_CONFLICT: DHCP address conflict: server pinged 192.168.2.1.
- Ulsan_RO 설정
Router(config)#host Ulsan_RO
Ulsan_RO(config)#int se0/3/0
Ulsan_RO(config-if)#ip add 192.168.4.2 255.255.255.0
Ulsan_RO(config-if)#no sh
%LINK-5-CHANGED: Interface Serial0/3/0, changed state to up
Ulsan_RO(config-if)#int fa0/0
Ulsan_RO(config-if)#ip add 192.168.5.1 255.255.255.0
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/3/0, changed state to up
Ulsan_RO(config-if)#no sh
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
설정을 마치고 핑 테스트를 해보았다.
대구 내부 / 부산 내부 / 울산 내부
각 지역의 내부 끼리는 이상 없이 통신이 가능했으나,
대구 <-> 부산
부산 <-> 울산
대구 <-> 울산
지역간의 통신은 되지 않았다.
위 처럼 다른 네트워크로의 패킷 전달이 어려운 경우, 우리는 '라우팅'을 이용하여 경로를 설정해 줄 수 있다.
라우팅이란 네트워크에서 패킷이 올바른, 혹은 최적의 경로로 찾아가기 위해서
다양한 방법을 통해 길을 찾아주는 것이다.
라우팅은 정적(Static) 라우팅과 동적(Dynamic) 라우팅으로 구분되며,
이번 실습에서는 정적 라우팅을 활용하여 지역간의 통신이 가능하도록 해볼 것이다.
정적 라우팅을 위한 명령어는 다음과 같다.
Router(config)#ip route 대상네트워크주소 서브넷주소 대상을향한인접한IP
이를 활용하여 대구->부산, 대구->울산의 경로를 알려주었다.
대구->부산
Daegu_RO(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.2
대구->울산
Daegu_RO(config)#ip route 192.168.5.0 255.255.255.0 192.168.3.2
설정을 마쳤지만 통신은 되지 않는다.
대구에서는 울산까지의 경로를 알고 패킷을 전송할 수 있지만,
울산에서는 대구의 경로를 알지 못해 패킷을 다시 받을 수 없기 때문이다.
부산의 경우도 마찬가지이다.
그러므로 다음과 같은 설정을 통해 부산->대구, 울산->대구 의 경로를 알려주었다.
울산->대구
Ulsan_RO(config)#ip route 192.168.1.0 255.255.255.0 192.168.4.1
부산->대구
Busan_RO(config)#ip route 192.168.1.0 255.255.255.0 192.168.3.1
설정을 마치고 대구<->부산, 대구<->울산 간의 통신이 원활하게 이루어 지는 것을 확인할 수 있다.
나머지 부산<->울산의 경로도 알려주었다.
울산->부산
Ulsan_RO(config)#ip route 192.168.2.0 255.255.255.0 192.168.4.1
부산->울산
Busan_RO(config)#ip route 192.168.5.0 255.255.255.0 192.168.4.2
Router# show ip route 명령어를 이용해 라우팅 테이블을 확인할 수 있다.
- 대구 라우팅 테이블
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.0/24 is directly connected, FastEthernet0/1
L 192.168.1.1/32 is directly connected, FastEthernet0/1
S 192.168.2.0/24 [1/0] via 192.168.3.2
192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.3.0/24 is directly connected, FastEthernet0/0
L 192.168.3.1/32 is directly connected, FastEthernet0/0
S 192.168.5.0/24 [1/0] via 192.168.3.2
- 부산 라우팅 테이블
S 192.168.1.0/24 [1/0] via 192.168.3.1
192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.2.0/24 is directly connected, FastEthernet0/1
L 192.168.2.1/32 is directly connected, FastEthernet0/1
192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.3.0/24 is directly connected, FastEthernet0/0
L 192.168.3.2/32 is directly connected, FastEthernet0/0
192.168.4.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.4.0/24 is directly connected, Serial0/3/0
L 192.168.4.1/32 is directly connected, Serial0/3/0
S 192.168.5.0/24 [1/0] via 192.168.4.2
- 울산 라우팅 테이블
S 192.168.1.0/24 [1/0] via 192.168.4.1
S 192.168.2.0/24 [1/0] via 192.168.4.1
192.168.4.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.4.0/24 is directly connected, Serial0/3/0
L 192.168.4.2/32 is directly connected, Serial0/3/0
192.168.5.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.5.0/24 is directly connected, FastEthernet0/0
L 192.168.5.1/32 is directly connected, FastEthernet0/0
세 지역의 라우팅 테이블을 확인하면, Static으로 경로가 설정되어 있다는 것을 알 수 있다.
ip route를 이용한 정적 라우팅에 대해 알아보았다.
정적 라우팅의 경우에는 최적의 경로는 아니지만, 내가 원하는 경로를 만들어 줄 수 있다는 장점이 있다.
단점으로는 설정 할 때마다 관리자의 개입이 필요하며 네트워크의 규모가 커질수록 관리 및 유지보수가 어렵다.