CCstudyのラボ・シナリオを利用して勉強させて頂いていたんですが、NATラボのスタティックNATとダイナミックNATのトポロジで行おうとすると、もう一度インタフェースにアドレスを設定しなければならず、出来れば一括で設定したいということで、自分のラボ仕様に合わせてトポロジを書いてみました。
実際のネットワーク環境でスタティックNATとダイナミックNATを混在させることが、あるのかないのかはよく分かりませんが、とりあえずコマンド練習の時間短縮のためにこのような方法にしています。


■R3
R3(config)#int fa0/0
R3(config-if)#ip address 10.1.1.200 255.255.255.0
R3(config-if)#ip address 10.1.1.1 255.255.255.0 secondary
R3(config-if)#ip address 10.1.1.2 255.255.255.0 secondary
R3(config-if)#ip address 10.1.1.3 255.255.255.0 secondary
R3(config-if)#no shut
R3(config-if)#ip nat inside
R3(config-if)#ex

R3(config)#int s2/0
R3(config-if)#ip address 192.168.1.100 255.255.255.0
R3(config-if)#ip nat outside
R3(config-if)#no shut
R3(config-if)#ex

R3(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.200
R3(config)#ip classless

R3(config)#ip nat inside source static 10.1.1.100 192.168.1.254

R3(config)#ip nat pool globalpool 192.168.1.1 192.168.1.3 netmask 255.255.255.0
R3(config)#ip nat inside source list 1 pool globalpool

R3(config)#access-list 1 permit 10.1.1.1
R3(config)#access-list 1 permit 10.1.1.2
R3(config)#access-list 1 permit 10.1.1.3
R3(config)#end

■R4
R4(config)#int fa0/0
R4(config-if)#ip address 192.168.2.100 255.255.255.0
R4(config-if)#no shut
R4(config-if)#ex

R4(config)#int s2/0
R4(config-if)#ip address 192.168.1.200 255.255.255.0
R4(config-if)#no shut
R4(config-if)#clock rate 64000
R4(config-if)#bandwidth 64
R4(config-if)#ex

R4(config)#ip route 10.0.0.0 255.255.255.0 192.168.1.100
R3(config)#end

コマンドプロンプトからping(HOST A)
C:\Documents and Settings\HOST A>ping 192.168.2.200

Pinging 192.168.2.200 with 32 bytes of data:

Reply from 192.168.2.200: bytes=32 time=20ms TTL=126
Reply from 192.168.2.200: bytes=32 time=20ms TTL=126
Reply from 192.168.2.200: bytes=32 time=20ms TTL=126
Reply from 192.168.2.200: bytes=32 time=20ms TTL=126

Ping statistics for 192.168.2.200:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 20ms, Maximum = 20ms, Average = 20ms

デバッグ(スタティックNAT)
R3#debug ip nat
IP NAT debugging is on
00:21:22: NAT: s=10.1.1.100->192.168.1.254, d=192.168.2.200 [35193]
00:21:28: NAT*: s=10.1.1.100->192.168.1.254, d=192.168.2.200 [35194]
00:21:28: NAT*: s=192.168.2.200, d=192.168.1.254->10.1.1.100 [16454]
00:21:29: NAT*: s=10.1.1.100->192.168.1.254, d=192.168.2.200 [35195]
00:21:29: NAT*: s=192.168.2.200, d=192.168.1.254->10.1.1.100 [16455]
00:21:30: NAT*: s=10.1.1.100->192.168.1.254, d=192.168.2.200 [35196]
00:21:30: NAT*: s=192.168.2.200, d=192.168.1.254->10.1.1.100 [16456]

■拡張ping(送信元セカンダリアドレス)
R3#ping
Protocol [ip]:
Target IP address: 192.168.2.200
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 10.1.1.1
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.200, timeout is 2 seconds:
Packet sent with a source address of 10.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/32/36 ms

デバッグ(ダイナミックNAT)
R3#
00:26:12: NAT: s=10.1.1.1->192.168.1.1, d=192.168.2.200 [5]
00:26:12: NAT*: s=192.168.2.200, d=192.168.1.1->10.1.1.1 [16470]
00:26:12: NAT: s=10.1.1.1->192.168.1.1, d=192.168.2.200 [6]
00:26:12: NAT*: s=192.168.2.200, d=192.168.1.1->10.1.1.1 [16471]
00:26:12: NAT: s=10.1.1.1->192.168.1.1, d=192.168.2.200 [7]
00:26:12: NAT*: s=192.168.2.200, d=192.168.1.1->10.1.1.1 [16472]
00:26:12: NAT: s=10.1.1.1->192.168.1.1, d=192.168.2.200 [8]
00:26:12: NAT*: s=192.168.2.200, d=192.168.1.1->10.1.1.1 [16473]
00:26:12: NAT: s=10.1.1.1->192.168.1.1, d=192.168.2.200 [9]
00:26:12: NAT*: s=192.168.2.200, d=192.168.1.1->10.1.1.1 [16474]

■NATテーブル
R3#sh ip nat translations
Pro Inside global Inside local Outside local Outside global

      • 192.168.1.1 10.1.1.1 --- ---
      • 192.168.1.2 10.1.1.2 --- ---
      • 192.168.1.3 10.1.1.3 --- ---
      • 192.168.1.254 10.1.1.100 --- ---