Exempel 1

Den här typen av NAT kräver manuellt konfiguration där samma antal interna lokala IP-adresser binds ihop med samma antal interna globala IP-adresser (publika). I nätverkstopologin nedan har jag färgat de privata LAN som kan betraktas som interna eller som INSIDE och resten som OUTSIDE. De privata IPv4 adresser översätts till publika, en och en till exempel 192.168.10.10 till 21.66.50.3

Observera att nätverksadressen (NA) mellan R1 och molnet är 21.66.50.0 /28 och det ger ett segmenteringssteg lika med 8 därmed följande NA:

  • 21.66.50.0 /28
  • 21.66.50.8 /28 och så vidare,

Nätverksadressen 21.66.50.0 /28 ger följande host-adress intervall från 21.66.50.1 till 21.66.50.7. I länken mellan R1 och molnet används 21.66.50.1 och 21.66.50.2 samt Broadcast-adressen är 21.66.50.7 då finns kvar följande HA: 21.66.50.3, 21.66.50.4, 21.66.50.5, och 21.66.50.6 för adressöversättning.

Först en adressöversättning som tillåter allt nätverkstrafik exempelvis genererat med ping. Därefter specificerar jag att det kommer enbart tillåtas TCP port 80 trafik.

I molnet finns två routrar R2 och R3 som dirigerar nätverkstrafik med det dynamiska routing-protokollet EIGRP. Routrarna R1 och R3 dirigerar allt nätverkstrafik med en rekursiv statisk route.

Observera att PC3 har inte åtkomst till andra nätverk än sitt eget, dvs ingen adressöversättning.

Nätverkstopologi

Konfigurationer

  • Router> enable
  • Router# configure terminal
  • Router(config)# hostname R1
  • R1(config)# no ip domain-lookup
  • R1(config)# interface Gig0/1
  • R1(config-if)# description Connected to inside LAN
  • R1(config-if)# ip address 192.168.10.254 255.255.255.0
  • R1(config-if)# no shutdown
  • R1(config-if)# exit
  • R1(config)# interface Gig0/0
  • R1(config-if)# description Connected to outside R2
  • R1(config-if)# ip address 21.66.50.1 255.255.255.248
  • R1(config-if)# no shutdown
  • R1(config-if)# exit
  • R1(config)# ip route 0.0.0.0 0.0.0.0 21.66.50.2
  • R1(config)#
  • R1(config)# interface Gig0/0
  • R1(config-if)# ip nat outside
  • R1(config-if)# exit
  • R1(config)# interface Gig0/1
  • R1(config-if)# ip nat inside
  • R1(config-if)# exit
  • R1(config)# ip nat inside source static 192.168.10.10 21.66.50.3
  • R1(config)# ip nat inside source static 192.168.10.11 21.66.50.4
  • R1(config)#
  • Router> enable
  • Router# configure terminal
  • Router(config)# hostname R2
  • R2(config)# no ip domain-lookup
  • R2(config)# interface Gig0/0
  • R2(config-if)# description Connected R1
  • R2(config-if)# ip address 21.66.50.2 255.255.255.248
  • R2(config-if)# no shutdown
  • R2(config-if)# exit
  • R2(config)# interface Se0/1/0
  • R2(config-if)# description Connected to R3
  • R2(config-if)# ip address 201.65.10.2 255.255.255.252
  • R2(config-if)# no shutdown
  • R2(config-if)# exit
  • R2(config)# router eigrp 90
  • R2(config-router)# network 21.66.50.0 0.0.0.7
  • R2(config-router)# network 201.65.10.0 0.0.0.3
  • R2(config-router)# end
  • R2#
  • Router> enable
  • Router# configure terminal
  • Router(config)# hostname R3
  • R3(config)# no ip domain-lookup
  • R3(config)# interface Se0/1/0
  • R3(config-if)# description DCE Connected to R2
  • R3(config-if)# clock rate 2000000
  • R3(config-if)# ip address 201.65.10.1 255.255.255.252
  • R3(config-if)# no shutdown
  • R3(config-if)# exit
  • R3(config)# interface Gig0/0
  • R3(config-if)# description Connected to R4
  • R3(config-if)# ip addres 29.16.25.1 255.255.255.248
  • R3(config-if)# no shutdown
  • R3(config-if)# exit
  • R3(config)# router eigrp 90
  • R3(config-router)# network 29.16.25.0 0.0.0.7
  • R3(config-router)# network 201.65.10.0 0.0.0.3
  • R3(config-router)# end
  • R3#
  • Router> enable
  • Router# configure terminal
  • Router(config)# hostname R4
  • R4(config)# no ip domain-lookup
  • R4(config)# interface Gig0/0
  • R4(config-if)# description Connected to R3
  • R4(config-if)# ip address 29.16.25.2 255.255.255.248
  • R4(config-if)# no shutdown
  • R4(config-if)# exit
  • R4(config)# interface Gig0/1
  • R4(config-if)# description Connected to inside LAN
  • R4(config-if)# ip address 172.30.20.254 255.255.255.0
  • R4(config-if)# no shutdown
  • R4(config-if)# exit
  • R4(config)# ip route 0.0.0.0 0.0.0.0 29.16.25.1
  • R4(config)#
  • R4(config)# interface Gig0/0
  • R4(config-if)# ip nat outside
  • R4(config-if)# exit
  • R4(config)# interface Gig0/1
  • R4(config-if)# ip nat inside
  • R4(config-if)# exit
  • R4(config)# ip nat inside source static 172.30.20.100 29.16.25.3
  • R4(config)# ip nat inside source static 172.30.20.101 29.16.25.4
  • R4(config)#
  • R4(config)#no ip nat inside source static 172.30.20.100 29.16.25.3
  • R4(config)#ip nat inside source static tcp 172.30.20.100 80 29.16.25.3 80