Kapcsolási, forgalomirányítási és vezeték nélküli kommunikációs alapok
Privát címtartományok:
| Címosztály | RFC 1918 által definiált privát címtartományok | CIDR előtag |
|---|---|---|
| A | 10.0.0.0 - 10.255.255.255 | 10.0.0.0/8 |
| B | 172.16.0.0 -172.31.255.255 | 172.16.0.0/12 |
| C | 192.168.0.0 - 192.168.255.255 | 192.168.0.0/16 |
Az ISP router konfigurálása:
ISP(config)# interface s0/0/1 ISP(config-if)# ip address 193.6.138.2 255.255.255.252 ISP(config-if)# no shutdown ISP(config-if)# exit ISP(config)# interface Loopback 0 ISP(config-if)# ip address 172.16.0.1 255.255.255.0
A belső oldalhoz tartozó interfész megjelölése:
R1(config)# interface g0/0 R1(config-if)# ip address 10.0.0.1 255.0.0.0 R1(config-if)# no shutdown R1(config-if)# ip nat inside R1(config-if)# exit
A külső oldalhoz tartozó interfész megjelölése:
R1(config)# interface s0/0/0 R1(config-if)# ip address 193.6.138.1 255.255.255.0 R1(config-if)# no shutdown R1(config-if)# ip nat outside R1(config-if)# exit
Statikus NAT (egy belső címet egy külső címre):
R1(config)# ip nat inside source static 10.0.0.10 193.6.138.1 R1(config)# ip nat inside source static 10.0.0.20 193.6.138.2 R1(config)# ip nat inside source static 10.0.0.30 193.6.138.3
Statikus alapértelmezett útvonal beállítása:
R1(config)# ip route 0.0.0.0 0.0.0.0 s0/0/0
Tesztelés:
C:\> ping 172.16.0.1
Pinging 172.16.0.1 with 32 bytes of data:
Reply from 172.16.0.1: bytes=32 time=1ms TTL=254
Reply from 172.16.0.1: bytes=32 time=1ms TTL=254
Reply from 172.16.0.1: bytes=32 time=1ms TTL=254
Reply from 172.16.0.1: bytes=32 time=1ms TTL=254
Ping statistics for 172.16.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 1ms, Average = 1ms
R1# show ip nat translations Pro Inside global Inside local Outside local Outside global icmp 193.6.138.1:5 10.0.0.10:5 172.16.0.1:5 172.16.0.1:5 icmp 193.6.138.1:6 10.0.0.10:6 172.16.0.1:6 172.16.0.1:6 icmp 193.6.138.1:7 10.0.0.10:7 172.16.0.1:7 172.16.0.1:7 icmp 193.6.138.1:8 10.0.0.10:8 172.16.0.1:8 172.16.0.1:8 icmp 193.6.138.2:1 10.0.0.20:1 172.16.0.1:1 172.16.0.1:1 icmp 193.6.138.2:2 10.0.0.20:2 172.16.0.1:2 172.16.0.1:2 icmp 193.6.138.2:3 10.0.0.20:3 172.16.0.1:3 172.16.0.1:3 icmp 193.6.138.2:4 10.0.0.20:4 172.16.0.1:4 172.16.0.1:4 icmp 193.6.138.3:1 10.0.0.30:1 172.16.0.1:1 172.16.0.1:1 icmp 193.6.138.3:2 10.0.0.30:2 172.16.0.1:2 172.16.0.1:2 icmp 193.6.138.3:3 10.0.0.30:3 172.16.0.1:3 172.16.0.1:3 icmp 193.6.138.3:4 10.0.0.30:4 172.16.0.1:4 172.16.0.1:4 --- 193.6.138.1 10.0.0.10 --- --- --- 193.6.138.2 10.0.0.20 --- --- --- 193.6.138.3 10.0.0.30 --- ---
R1# show ip nat statistics Total translations: 11 (3 static, 8 dynamic, 8 extended) Outside Interfaces: Serial0/0/0 Inside Interfaces: GigabitEthernet0/0 Hits: 16 Misses: 16 Expired translations: 8 Dynamic mappings:
Az ISP router konfigurálása:
ISP(config)# interface s0/0/1 ISP(config-if)# ip address 193.6.138.2 255.255.255.252 ISP(config-if)# no shutdown ISP(config-if)# exit ISP(config)# interface Loopback 0 ISP(config-if)# ip address 172.16.0.1 255.255.255.0
A belső oldalhoz tartozó interfész megjelölése:
R1(config)# interface g0/0 R1(config-if)# ip address 10.0.0.1 255.0.0.0 R1(config-if)# no shutdown R1(config-if)# ip nat inside R1(config-if)# exit
A külső oldalhoz tartozó interfész megjelölése:
R1(config)# interface s0/0/0 R1(config-if)# ip address 193.6.138.1 255.255.255.0 R1(config-if)# no shutdown R1(config-if)# ip nat outside R1(config-if)# exit
Dinamikus NAT:
R1(config)# ip nat pool Publikus-Dinamikus-Cimek 193.6.138.1 193.6.138.3 netmask 255.255.255.0 R1(config)# access-list 100 permit ip 10.0.0.0 0.255.255.255 any R1(config)# ip nat inside source list 100 pool Publikus-Dinamikus-Cimek
Statikus alapértelmezett útvonal beállítása:
R1(config)# ip route 0.0.0.0 0.0.0.0 s0/0/0
Tesztelés
C:\> ping 172.16.0.1
Pinging 172.16.0.1 with 32 bytes of data:
Reply from 172.16.0.1: bytes=32 time=2ms TTL=254
Reply from 172.16.0.1: bytes=32 time=1ms TTL=254
Reply from 172.16.0.1: bytes=32 time=1ms TTL=254
Reply from 172.16.0.1: bytes=32 time=1ms TTL=254
Ping statistics for 172.16.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 2ms, Average = 1ms
R1# show ip nat translations Pro Inside global Inside local Outside local Outside global icmp 193.6.138.1:1 10.0.0.10:1 172.16.0.1:1 172.16.0.1:1 icmp 193.6.138.1:2 10.0.0.10:2 172.16.0.1:2 172.16.0.1:2 icmp 193.6.138.1:3 10.0.0.10:3 172.16.0.1:3 172.16.0.1:3 icmp 193.6.138.1:4 10.0.0.10:4 172.16.0.1:4 172.16.0.1:4 icmp 193.6.138.2:1 10.0.0.20:1 172.16.0.1:1 172.16.0.1:1 icmp 193.6.138.2:2 10.0.0.20:2 172.16.0.1:2 172.16.0.1:2 icmp 193.6.138.2:3 10.0.0.20:3 172.16.0.1:3 172.16.0.1:3 icmp 193.6.138.2:4 10.0.0.20:4 172.16.0.1:4 172.16.0.1:4 icmp 193.6.138.3:1 10.0.0.30:1 172.16.0.1:1 172.16.0.1:1 icmp 193.6.138.3:2 10.0.0.30:2 172.16.0.1:2 172.16.0.1:2 icmp 193.6.138.3:3 10.0.0.30:3 172.16.0.1:3 172.16.0.1:3 icmp 193.6.138.3:4 10.0.0.30:4 172.16.0.1:4 172.16.0.1:4
R1# show ip nat statistics
Total translations: 8 (0 static, 8 dynamic, 8 extended)
Outside Interfaces: Serial0/0/0
Inside Interfaces: GigabitEthernet0/0
Hits: 12 Misses: 12
Expired translations: 4
Dynamic mappings:
-- Inside Source
access-list 100 pool Publikus-Dinamikus-Cimek refCount 8
pool Publikus-Dinamikus-Cimek: netmask 255.255.255.0
start 193.6.138.1 end 193.6.138.3
type generic, total addresses 3 , allocated 2 (66%), misses 0
R1# show ip access-lists
Extended IP access list 100
10 permit ip 10.0.0.0 0.255.255.255 any (24 match(es))
Az ISP router konfigurálása:
ISP(config)# interface s0/0/1 ISP(config-if)# ip address 193.6.138.2 255.255.255.252 ISP(config-if)# no shutdown ISP(config-if)# exit ISP(config)# interface Loopback 0 ISP(config-if)# ip address 172.16.0.1 255.255.255.0
A belső oldalhoz tartozó interfész megjelölése:
R1(config)# interface g0/0 R1(config-if)# ip address 10.0.0.1 255.0.0.0 R1(config-if)# no shutdown R1(config-if)# ip nat inside R1(config-if)# exit
A külső oldalhoz tartozó interfész megjelölése:
R1(config)# interface s0/0/0 R1(config-if)# ip address 193.6.138.1 255.255.255.0 R1(config-if)# no shutdown R1(config-if)# ip nat outside R1(config-if)# exit
PAT:
R1(config)# access-list 10 permit 10.0.0.0 0.255.255.255 R1(config)# ip nat inside source list 10 interface s0/0/0 overload
Statikus alapértelmezett útvonal beállítása:
R1(config)# ip route 0.0.0.0 0.0.0.0 s0/0/0
Tesztelés
C:\> ping 172.16.0.1
Pinging 172.16.0.1 with 32 bytes of data:
Reply from 172.16.0.1: bytes=32 time=1ms TTL=254
Reply from 172.16.0.1: bytes=32 time=1ms TTL=254
Reply from 172.16.0.1: bytes=32 time=1ms TTL=254
Reply from 172.16.0.1: bytes=32 time=1ms TTL=254
Ping statistics for 172.16.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 1ms, Average = 1ms
R1# show ip nat translations Pro Inside global Inside local Outside local Outside global icmp 193.6.138.1:1024 10.0.0.30:1 172.16.0.1:1 172.16.0.1:1024 icmp 193.6.138.1:1025 10.0.0.30:2 172.16.0.1:2 172.16.0.1:1025 icmp 193.6.138.1:1026 10.0.0.30:3 172.16.0.1:3 172.16.0.1:1026 icmp 193.6.138.1:1027 10.0.0.30:4 172.16.0.1:4 172.16.0.1:1027 icmp 193.6.138.1:1 10.0.0.20:1 172.16.0.1:1 172.16.0.1:1 icmp 193.6.138.1:2 10.0.0.20:2 172.16.0.1:2 172.16.0.1:2 icmp 193.6.138.1:3 10.0.0.20:3 172.16.0.1:3 172.16.0.1:3 icmp 193.6.138.1:4 10.0.0.20:4 172.16.0.1:4 172.16.0.1:4 icmp 193.6.138.1:5 10.0.0.10:5 172.16.0.1:5 172.16.0.1:5 icmp 193.6.138.1:6 10.0.0.10:6 172.16.0.1:6 172.16.0.1:6 icmp 193.6.138.1:7 10.0.0.10:7 172.16.0.1:7 172.16.0.1:7 icmp 193.6.138.1:8 10.0.0.10:8 172.16.0.1:8 172.16.0.1:8
R1# show ip nat statistics Total translations: 8 (0 static, 8 dynamic, 8 extended) Outside Interfaces: Serial0/0/0 Inside Interfaces: GigabitEthernet0/0 Hits: 12 Misses: 12 Expired translations: 4 Dynamic mappings:
R1# show ip access-lists
Standard IP access list 10
10 permit 10.0.0.0 0.255.255.255 (24 match(es))