Infrastructure

Static Routing과 NAT를 이용한 실습

c3epmos 2020. 5. 25. 17:46

Ethernet과 가상 네트워크(VMnet)을 연결하는 실습

cloud1

Ethernet 네트워크 인터페이스 연결

cloud2

VMnet19 네트워크 인터페이스 연결

R1

config t
hostname HQ
# 이더넷 설정
int fa0/0
ip add dhcp
no sh
do show ip int br
exit
# 호스트온리 설정
int fa0/1
ip add 10.10.5.2 255.255.255.0
no sh
exit
# telnet 설정
line vty 0 4
password {password}
login
enable password {password}
# 정적 라우팅
config t
ip route 10.10.X.0 255.255.255.0 192.168.0.Y

telnet 접속

telnet {IP}

본사를 거쳐서 인터넷 사용하도록 설정하는 실습

Cloud 1

Ethernet 네트워크 인터페이스 설정

R1

config t
int fa1/0
ip add 10.10.10.1 255.255.255.0
no sh
exit
int fa0/1
ip add 12.12.12.1 255.255.255.0
no sh
exit
int fa0/0
ip add 192.168.0.205 255.255.255.0
no sh
exit
ip route 20.20.20.0 255.255.255.0 12.12.12.2
ip route 0.0.0.0 0.0.0.0 192.168.0.1

R2

config t
int fa0/0
ip add 12.12.12.2 255.255.255.0
no sh
exit
int fa0/1
ip add 20.20.20.1 255.255.255.0
no sh
exit
ip route 10.10.10.0 255.255.255.0 12.12.12.1
ip route 0.0.0.0 0.0.0.0 12.12.12.1

PC1

ip 10.10.10.100/24 10.10.10.1

PC2

ip 20.20.20.100/24 20.20.20.1

Default route

전송하려는 패킷의 목적지 네트워크가 라우팅 테이블에 존재하지 않을 때, 그 패킷을 전송하는 곳이다. 일반적으로 ISP 업체와 연결되는 라우트를 디폴트로 설정한다. 그러나, 디폴트 루트를 설정하면 상세 네트워크를 검색한 후 없으면 모두 디폴트 루트로 전송한다.

ip route 0.0.0.0 0.0.0.0 1.2.3.4

R2에서 외부 인터넷 접속 못하는 이유

결국 R2의 IP는 사설 IP이다. 그래서 ISP 업체에서 막아버린다. 이를 해결하기 위해, NAT를 이용해서 공인 IP로 변환 해야한다.

R1

config t
access-list 1 per any
ip nat inside so list 1 int fa0/0 overload
int fa0/0
ip nat outside
int range fa0/1 , fa1/0
ip nat inside

정상적으로 통신이 가능하다.