Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| networking:cisco:dynamic-nat [2026/02/04 14:51] – created ilyasa | networking:cisco:dynamic-nat [2026/02/05 00:06] (current) – [Testing] ilyasa | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | {{indexmenu_n> | + | {{indexmenu_n> |
| ====== Cisco : Dynamic NAT ====== | ====== Cisco : Dynamic NAT ====== | ||
| - | Desciption | + | NAT dinamis adalah tipe NAT di mana sekelompok alamat IP privat dalam jaringan internal dipetakan ke sekelompok alamat IP publik secara dinamis. Tidak seperti NAT statis yang memetakan satu alamat IP privat ke satu alamat IP publik secara tetap, NAT dinamis memungkinkan banyak perangkat di jaringan internal berbagi sekelompok alamat IP publik secara bergantian. |
| ===== Syntax ===== | ===== Syntax ===== | ||
| - | ==== Some acction | + | Untuk konfigurasi NAT dynamic pertama anda harus membuat pool untuk ip yang akan terlihat oleh internet (public ip). dan anda harus membuat access list yang sama dengan pool ip private anda. |
| - | ^ Command ^ Description ^ | + | |
| - | | '' | + | ==== Definisikan pool ==== |
| - | | '' | + | <code js> |
| - | Contoh: | + | ip nat pool [pool name] x.x.x.x |
| - | < | + | |
| - | vlan 10 | + | |
| - | name VLAN-10 | + | |
| - | vlan 20 | + | |
| - | name VLAN-20 | + | |
| - | vlan 99 | + | |
| - | name VLAN-Management | + | |
| </ | </ | ||
| + | * x.x.x.x - y.y.y.y : range ip address public | ||
| + | |||
| + | ==== Membuat access list untuk jaringan internal ==== | ||
| + | |||
| + | <code js> | ||
| + | access-list [acl_number] permit X.X.X.X [wildcard mask] | ||
| + | </ | ||
| + | |||
| + | X.X.X.X : Network Ip Prival (LAN) | ||
| + | |||
| + | ==== Konfigurasi NAT Dynamic ==== | ||
| + | |||
| + | <code js> | ||
| + | ip nat inside source list [acl_number] pool [pool_name] | ||
| + | </ | ||
| + | |||
| + | Masih sama dengan NAT static anda harus menentukan interface inside dan outsite terlebih dahulu dengan: | ||
| + | |||
| + | < | ||
| + | interface [interface] | ||
| + | ip nat inside | ||
| + | interface [interface] | ||
| + | ip nat outside | ||
| + | </ | ||
| ===== Topologi ===== | ===== Topologi ===== | ||
| - | Gambar topology | + | {{ : |
| - | Goals Topology | + | Tujuan: Kita mempunyai pool ip public 100.0.0.0/ |
| + | |||
| + | <hidden Preconfig> | ||
| + | * **R1 : Proconfig** | ||
| + | <code js> | ||
| + | hostname R1 | ||
| + | ! | ||
| + | ip dhcp excluded-address 192.168.1.1 | ||
| + | ! | ||
| + | ip dhcp pool LAN | ||
| + | | ||
| + | | ||
| + | | ||
| + | ! | ||
| + | ! | ||
| + | interface FastEthernet0/ | ||
| + | ip address 203.0.113.1 255.255.255.252 | ||
| + | no shutdown | ||
| + | ! | ||
| + | interface FastEthernet0/ | ||
| + | ip address 192.168.1.254 255.255.255.0 | ||
| + | no shutdown | ||
| + | ! | ||
| + | ip route 0.0.0.0 0.0.0.0 203.0.113.2 | ||
| + | </ | ||
| + | * **Intenet: Cisco router to simulate internet** | ||
| + | <code js> | ||
| + | hostname internet | ||
| + | ! | ||
| + | ! | ||
| + | interface Loopback0 | ||
| + | ip address 142.251.175.113 255.255.255.255 | ||
| + | ! | ||
| + | interface FastEthernet0/ | ||
| + | ip address 203.0.113.2 255.255.255.252 | ||
| + | no shutdown | ||
| + | ! | ||
| + | interface FastEthernet0/ | ||
| + | ip address 8.8.8.1 255.255.255.0 | ||
| + | no shutdown | ||
| + | ! | ||
| + | ip route 100.0.0.0 255.255.255.0 203.0.113.1 | ||
| + | </ | ||
| + | |||
| + | * **Linux DNS server with a single records ** | ||
| + | Linux DNS server with a single records | ||
| + | < | ||
| + | DNS A Record google.com –> 142.251.175.113 | ||
| + | </ | ||
| + | </ | ||
| ===== Konfigurasi ===== | ===== Konfigurasi ===== | ||
| - | | + | |
| + | | ||
| + | <code js> | ||
| + | R1(config)# | ||
| + | R1(config-if)# | ||
| + | R1(config)# | ||
| + | R1(config-if)# | ||
| + | </ | ||
| + | |||
| + | * **R1 : Membuat Pool Untuk IP Public** | ||
| + | |||
| + | <code js> | ||
| + | R1(config)# | ||
| + | </ | ||
| + | |||
| + | * **R1 : Membuat ACL untuk range ip internal** | ||
| + | |||
| + | <code js> | ||
| + | R1(config)# | ||
| + | </ | ||
| + | |||
| + | * **R1 : Mempetakan ip pool yang telah dibuat ke ip private dgn dynamic nat** | ||
| + | |||
| + | <code js> | ||
| + | R1(config)# | ||
| + | </ | ||
| + | |||
| + | ===== Testing ===== | ||
| + | * **PC1 : Test ping dan hasil capture** | ||
| < | < | ||
| - | Switch(config)# | + | PC1> ip dhcp |
| - | Switch(config-vlan)# | + | DORA IP 192.168.1.1/ |
| - | Switch(config-vlan)# | + | |
| - | Switch(config)# | + | PC1> ping 8.8.8.8 |
| - | Switch(config-vlan)#name MAGENTA | + | |
| - | Switch(config-vlan)# | + | 84 bytes from 8.8.8.8 icmp_seq=1 ttl=62 time=48.818 ms |
| + | |||
| + | PC1> ping google.com | ||
| + | google.com resolved to 142.251.175.113 | ||
| + | |||
| + | 84 bytes from 142.251.175.113 icmp_seq=1 ttl=254 time=19.530 ms | ||
| + | 84 bytes from 142.251.175.113 icmp_seq=2 ttl=254 time=26.425 ms | ||
| + | 84 bytes from 142.251.175.113 icmp_seq=3 ttl=254 time=14.858 ms | ||
| + | 84 bytes from 142.251.175.113 icmp_seq=4 ttl=254 time=15.780 ms | ||
| + | 84 bytes from 142.251.175.113 icmp_seq=5 ttl=254 time=11.737 ms | ||
| </ | </ | ||
| - | | + | {{ : |
| + | |||
| + | * **PC2 : Test ping dan hasil capture** | ||
| < | < | ||
| - | Switch(config)# | + | PC2> ip dhcp |
| - | Switch(config-if)# | + | DORA IP 192.168.1.2/24 GW 192.168.1.254 |
| - | Switch(config-if)# | + | |
| - | Switch(config-if)# | + | |
| - | Switch(config)# | + | PC2> ping 8.8.8.8 |
| - | Switch(config-if)# | + | |
| - | Switch(config-if)# | + | 84 bytes from 8.8.8.8 icmp_seq=1 ttl=62 time=29.733 ms |
| - | Switch(config-if)#exit | + | |
| + | PC2> ping google.com | ||
| + | google.com resolved to 142.251.175.113 | ||
| + | |||
| + | 84 bytes from 142.251.175.113 icmp_seq=1 ttl=254 time=20.108 ms | ||
| </ | </ | ||
| - | ===== Testing ===== | + | {{ : |
| + | |||
| + | * **PC3 : Test ping dan hasil capture** | ||
| + | |||
| + | < | ||
| + | PC3> ip dhcp | ||
| + | DORA IP 192.168.1.3/ | ||
| + | |||
| + | PC3> ping 8.8.8.8 -c 1 | ||
| + | |||
| + | 84 bytes from 8.8.8.8 icmp_seq=1 ttl=62 time=26.725 ms | ||
| + | |||
| + | PC3> ping google.com -c 1 | ||
| + | google.com resolved to 142.251.175.113 | ||
| + | |||
| + | 84 bytes from 142.251.175.113 icmp_seq=1 ttl=254 time=19.783 ms | ||
| + | </ | ||
| + | {{ : | ||
| + | |||
| + | * **R1 : logs nat translations** | ||
| + | <code js> | ||
| + | R1#show ip nat translations | ||
| + | Pro Inside global | ||
| + | udp 100.0.0.1: | ||
| + | icmp 100.0.0.1: | ||
| + | icmp 100.0.0.1: | ||
| + | icmp 100.0.0.1: | ||
| + | icmp 100.0.0.1: | ||
| + | icmp 100.0.0.1: | ||
| + | --- 100.0.0.1 | ||
| + | --- 100.0.0.3 | ||
| + | udp 100.0.0.2: | ||
| + | icmp 100.0.0.2: | ||
| + | --- 100.0.0.2 | ||
| + | </ | ||