DynagenでCCIEを目指す
route-mapを使用したNAT, PAT設定
最終更新:
it_certification
-
view
1. 目的
- PAT(IPマスカレード)を設定する方法を確認します。
2. 構成
2.1. 設定概要
- 初期設定はIPアドレスのみです。
2.2. 構成図

2.3. netファイル
model = 3620 [localhost] [[3620]] image = C:\Program Files\Dynamips\images\c3620-j1s3-mz.123-18.bin ram = 128 [[ROUTER R1]] f0/0 = NIO_gen_eth:\Device\NPF_{ Host OS Loopback } f1/0 = NIO_gen_eth:\Device\NPF_{ Guest OS eth 1 }
2.4. 初期設定
- R1
! version 12.4 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R1 ! boot-start-marker boot-end-marker ! ! no aaa new-model ! resource policy ! memory-size iomem 5 ! ! ip cef no ip domain lookup ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! interface FastEthernet0/0 ip address 192.168.200.1 255.255.255.0 duplex auto speed auto ! interface FastEthernet0/1 ip address 200.200.200.1 255.255.255.0 duplex auto speed auto ! ip http server no ip http secure-server ! ! ! no cdp run ! ! ! control-plane ! ! ! ! ! ! ! ! ! line con 0 line aux 0 line vty 0 4 ! ! end
3. [検証] route-mapを使用したPAT
3.1. 設定投入
route-mapを用いたPATの設定を投入します。
R1(config)#interface FastEthernet 0/0 R1(config-if)#ip nat inside R1(config-if)#exit R1(config)# R1(config)# R1(config)#interface FastEthernet 1/0 R1(config-if)#ip nat outside R1(config-if)#exit R1(config)# R1(config)# R1(config)#ip access-list standard NAT_LIST R1(config-std-nacl)#permit 192.168.200.0 0.0.0.255 R1(config-std-nacl)#exit R1(config)# R1(config)# R1(config)#route-map NAT_MAP R1(config-route-map)#match ip address NAT_LIST R1(config-route-map)#exit R1(config)# R1(config)# R1(config)#ip nat inside source route-map NAT_MAP interface FastEthernet 1/0 overload
3.2. 疎通確認
Host OS側でstatic routeを定義した後に、Guest OS宛てにping疎通確認を行います。
(NATで変換された結果、Guest OS側からは同一セグメントからのpingのように見えるので、Guest OS側にstatic routeの設定は不要です。)
(NATで変換された結果、Guest OS側からは同一セグメントからのpingのように見えるので、Guest OS側にstatic routeの設定は不要です。)
C:\>route add 200.200.200.0 mask 255.255.255.0 192.168.200.1 C:\> C:\> C:\>ping 200.200.200.101 Pinging 200.200.200.101 with 32 bytes of data: Request timed out. Reply from 200.200.200.101: bytes=32 time=47ms TTL=63 Reply from 200.200.200.101: bytes=32 time=47ms TTL=63 Reply from 200.200.200.101: bytes=32 time=47ms TTL=63 Ping statistics for 200.200.200.101: Packets: Sent = 4, Received = 3, Lost = 1 (25% loss), Approximate round trip times in milli-seconds: Minimum = 47ms, Maximum = 47ms, Average = 47ms C:\>
3.3. 設定確認
showコマンドにより、どのようにIPアドレスが変換されたのかを確認します。
R1#show ip nat translations Pro Inside global Inside local Outside local Outside global icmp 200.200.200.1:512 192.168.200.100:512 200.200.200.101:512 200.200.200.101:512 R1#
debugを有効にし、上記のpingが変換される様子を観察します。
R1#debug ip nat IP NAT debugging is on R1# *Mar 1 00:05:02.703: NAT: s=192.168.200.100->200.200.200.1, d=200.200.200.101 [50716] *Mar 1 00:05:07.703: NAT*: s=192.168.200.100->200.200.200.1, d=200.200.200.101 [50810] *Mar 1 00:05:07.727: NAT*: s=200.200.200.101, d=200.200.200.1->192.168.200.100 [42182] *Mar 1 00:05:08.703: NAT*: s=192.168.200.100->200.200.200.1, d=200.200.200.101 [50829] *Mar 1 00:05:08.727: NAT*: s=200.200.200.101, d=200.200.200.1->192.168.200.100 [42183] *Mar 1 00:05:09.699: NAT*: s=192.168.200.100->200.200.200.1, d=200.200.200.101 [50850] *Mar 1 00:05:09.727: NAT*: s=200.200.200.101, d=200.200.200.1->192.168.200.100 [42184] R1#
添付ファイル