NW構成
・通信確認はPC 1 ⇔ PC 2 のPingで行います。
・Router#1とRouter#2でHSRPを組みます。
Config
Router#1
hostname R1
!
track 1 interface GigabitEthernet0/0 line-protocol // Gi0/0のup、downを監視
!
track 2 interface GigabitEthernet0/1 line-protocol // Gi0/1 up、downを監視
!
!interface GigabitEthernet0/0
ip address 10.1.1.1 255.255.255.0
ip nat inside // NAT inside
ip virtual-reassembly in
standby 1 ip 10.1.1.254
standby 1 priority 150 // HSRPをActiveにする値に設定
standby 1 preempt
standby 1 track 2 decrement 60 // Gi0/1 up、downを監視
!
interface GigabitEthernet0/1
ip address 20.1.1.1 255.255.255.0
ip nat outside // NAT outside
ip virtual-reassembly in
standby 2 ip 20.1.1.254
standby 2 priority 150 // HSRPをActiveにする値に設定
standby 2 preempt
standby 2 track 1 decrement 60 // Gi0/0 up、downを監視
!
ip nat inside source static 10.1.1.100 10.1.1.254 // Source IP を 10.1.1.100->10.1.1.254へ変更
!
Router#2
!
interface GigabitEthernet0/0
ip address 10.1.1.2 255.255.255.0
ip nat inside // NAT inside
ip virtual-reassembly in
standby 1 ip 10.1.1.254
standby 1 preempt
!
interface GigabitEthernet0/1
ip address 20.1.1.2 255.255.255.0
ip nat outside // NAT outside
ip virtual-reassembly in
standby 2 ip 20.1.1.254
standby 2 preempt
!
ip nat inside source static 10.1.1.100 10.1.1.254 // Source IP を 10.1.1.100->10.1.1.254へ変更
!
show / debugで動作の確認
R1#show ip nat statistics
Total active translations: 2 (1 static, 1 dynamic; 1 extended)
Peak translations: 2, occurred 01:38:27 ago
Outside interfaces:
GigabitEthernet0/1
Inside interfaces:
GigabitEthernet0/0
Hits: 12030 Misses: 0
CEF Translated packets: 12030, CEF Punted packets: 0
Expired translations: 0
Dynamic mappings:
Total doors: 0
Appl doors: 0
Normal doors: 0
Queued Packets: 0
R1#show ip nat translations
Pro Inside global Inside local Outside local Outside global
icmp 10.1.1.254:1 10.1.1.100:1 20.1.1.100:1 20.1.1.100:1
— 10.1.1.254 10.1.1.100 — —
R1#debug ip nat
IP NAT debugging is on
*Jan 17 04:31:46.695: NAT*: s=10.1.1.100->10.1.1.254, d=20.1.1.100 [5260]
*Jan 17 04:31:46.699: NAT*: s=20.1.1.100, d=10.1.1.254->10.1.1.100 [57249]
R1#show standby
R1#show standby
GigabitEthernet0/0 – Group 1
State is Active
1 state change, last state change 01:43:40
Virtual IP address is 10.1.1.254
Active virtual MAC address is 0000.0c07.ac01
Local virtual MAC address is 0000.0c07.ac01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 2.016 secs
Preemption enabled
Active router is local
Standby router is 10.1.1.2, priority 100 (expires in 11.200 sec)
Priority 150 (configured 150)
Track object 2 state Up decrement 60
Group name is “hsrp-Gi0/0-1” (default)
GigabitEthernet0/1 – Group 2
State is Active
1 state change, last state change 01:43:31
Virtual IP address is 20.1.1.254
Active virtual MAC address is 0000.0c07.ac02
Local virtual MAC address is 0000.0c07.ac02 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 2.128 secs
Preemption enabled
Active router is local
Standby router is 20.1.1.2, priority 100 (expires in 10.544 sec)
Priority 150 (configured 150)
Track object 1 state Up decrement 60
Group name is “hsrp-Gi0/1-2” (default)
R1#
R2#show standby
GigabitEthernet0/0 – Group 1
State is Standby
4 state changes, last state change 01:46:14
Virtual IP address is 10.1.1.254
Active virtual MAC address is 0000.0c07.ac01
Local virtual MAC address is 0000.0c07.ac01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 2.320 secs
Preemption enabled
Active router is 10.1.1.1, priority 150 (expires in 10.048 sec)
Standby router is local
Priority 100 (default 100)
Group name is “hsrp-Gi0/0-1” (default)
GigabitEthernet0/1 – Group 2
State is Standby
4 state changes, last state change 01:46:04
Virtual IP address is 20.1.1.254
Active virtual MAC address is 0000.0c07.ac02
Local virtual MAC address is 0000.0c07.ac02 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 2.368 secs
Preemption enabled
Active router is 20.1.1.1, priority 150 (expires in 7.968 sec)
Standby router is local
Priority 100 (default 100)
Group name is “hsrp-Gi0/1-2” (default)
まとめ
1 台のルータに Network Address Translation(NAT; ネットワーク アドレス変換)と HSRP を同時に設定できます。