静态 NAT 地址转换 实现静态 NAT 地址转换功能。将路由器 2501 的 E0 作为内...

16

Click here to load reader

Transcript of 静态 NAT 地址转换 实现静态 NAT 地址转换功能。将路由器 2501 的 E0 作为内...

Page 1: 静态 NAT 地址转换 实现静态 NAT 地址转换功能。将路由器 2501 的 E0 作为内 部端口,同步端口 S0 作为外部端口。其中 10.1.1.2 , 10.1.1.3 , 10.1.1.4

静态 NAT地址转换

实现静态 NAT 地址转换功能。将路由器 2501 的 E0 作为内部端口,同步端口 S0 作为外部端口。其中 10.1.1.2 , 10.1.1.3 , 10.1.1.4 的内部本地地址采用静态地址转换。其内部合法地址分别对应为 192.1.1.2 , 192.1.1.3 , 192.1.1.4 。

Page 2: 静态 NAT 地址转换 实现静态 NAT 地址转换功能。将路由器 2501 的 E0 作为内 部端口,同步端口 S0 作为外部端口。其中 10.1.1.2 , 10.1.1.3 , 10.1.1.4
Page 3: 静态 NAT 地址转换 实现静态 NAT 地址转换功能。将路由器 2501 的 E0 作为内 部端口,同步端口 S0 作为外部端口。其中 10.1.1.2 , 10.1.1.3 , 10.1.1.4

Router>enable

Router#config terminal

Router(config)#hostname RouterA

RouterA (config)#interface fastEthernet 0/0

RouterA (config-if)#ip address 10.1.1.253 255.255.255.0

RouterA (config-if)#no shutdown

RouterA (config-if)#exit

RouterA(config)#interface serial 2/0

RouterA(config-if)#ip address 192.1.1.1 255.255.255.0

RouterA(config-if)#exit

Page 4: 静态 NAT 地址转换 实现静态 NAT 地址转换功能。将路由器 2501 的 E0 作为内 部端口,同步端口 S0 作为外部端口。其中 10.1.1.2 , 10.1.1.3 , 10.1.1.4

RouterA(config)#ip nat inside source static 10.1.1.2 192.1.1.2// 配置静态地址映射关系

RouterA(config)#ip nat inside source static 10.1.1.3 192.1.1.3

RouterA(config)#ip nat inside source static 10.1.1.4 192.1.1.4

RouterA(config)#ip nat inside source static 10.1.1.1 192.1.1.1

RouterA(config)#interface fastEthernet 0/0

RouterA(config-if)#ip nat inside // 配置端口 E0 为内部接口

RouterA(config-if)#no shutdown

RouterA(config-if)#exit

RouterA(config)#interface serial 2/0

RouterA(config-if)#ip nat outside // 配置端口 S0 为外部接口

RouterA(config-if)#no shutdown

Page 5: 静态 NAT 地址转换 实现静态 NAT 地址转换功能。将路由器 2501 的 E0 作为内 部端口,同步端口 S0 作为外部端口。其中 10.1.1.2 , 10.1.1.3 , 10.1.1.4

RouterA(config-if)#clock rate 64000

RouterA(config-if)#no shutdown

RouterA(config-if)#end

RouterA#ping 10.1.1.2

RouterA#show ip nat statistics

Total translations: 4 (4 static, 0 dynamic, 0 extended)

Outside Interfaces: Serial2/0

Inside Interfaces: FastEthernet0/0

RouterA#show ip nat translations

Pro Inside global Inside local Outside local Outside global

--- 192.1.1.1 10.1.1.1 --- ---

--- 192.1.1.2 10.1.1.2 --- ---

--- 192.1.1.3 10.1.1.3 --- ---

--- 192.1.1.4 10.1.1.4 --- ---

RouterA#

Page 6: 静态 NAT 地址转换 实现静态 NAT 地址转换功能。将路由器 2501 的 E0 作为内 部端口,同步端口 S0 作为外部端口。其中 10.1.1.2 , 10.1.1.3 , 10.1.1.4

Switch>enable

Switch#config terminal

Switch(config)#interface vlan 1

Switch(config-if)#ip address 10.1.1.254 255.255.255.0

Switch(config-if)#no shutdown

Page 7: 静态 NAT 地址转换 实现静态 NAT 地址转换功能。将路由器 2501 的 E0 作为内 部端口,同步端口 S0 作为外部端口。其中 10.1.1.2 , 10.1.1.3 , 10.1.1.4

配置 PC1-PC3

PC1 IP Address. . . . . . . . . . . . : 10.1.1.4

Subnet Mask . . . . . . . . . . . : 255.255.255.0

Default Gateway . . . . . . . . . : 10.1.1.1

PC2 IP Address. . . . . . . . . . . . : 10.1.1.2

Subnet Mask . . . . . . . . . . . : 255.255.255.0

Default Gateway . . . . . . . . . : 10.1.1.1

PC3 IP Address. . . . . . . . . . . . : 10.1.1.3

Subnet Mask . . . . . . . . . . . : 255.255.255.0

Default Gateway . . . . . . . . . : 10.1.1.1

配置完成后可以用以下语句进行查看:

RouterA#show ip nat translations

RouterA#show ip nat statistics

Page 8: 静态 NAT 地址转换 实现静态 NAT 地址转换功能。将路由器 2501 的 E0 作为内 部端口,同步端口 S0 作为外部端口。其中 10.1.1.2 , 10.1.1.3 , 10.1.1.4

PAT(端口地址转换)配置

本实例实现 PAT 地址转换功能。将路由器 2514 的 E0 作为内部端口,同步端口 E1 作为外部端口。其中 192.168.1.0 为内部本地地址网段。其内部有一个全局地址 202.98.38.1 ,这个地址配置在路由器 E1 口。

交换机 SwitchA1912 一台,接两台 PC ( PC1 : 192.168.1.2/24, Default Gateway 192.168.1.1 ; PC2 : 202.98.38.5/24 Default Gateway 202.98.38.1 ),一台 2514 路由器( RouerA: E0 : 192.168.1.1/24 ; E1 : 202.98.38.1/24 )。

Page 9: 静态 NAT 地址转换 实现静态 NAT 地址转换功能。将路由器 2501 的 E0 作为内 部端口,同步端口 S0 作为外部端口。其中 10.1.1.2 , 10.1.1.3 , 10.1.1.4
Page 10: 静态 NAT 地址转换 实现静态 NAT 地址转换功能。将路由器 2501 的 E0 作为内 部端口,同步端口 S0 作为外部端口。其中 10.1.1.2 , 10.1.1.3 , 10.1.1.4

配置路由器

Router>enable

Router#config terminal

Router(config)#hostname RouterA

RouterA(config)#interface fastEthernet 0/0

RouterA(config-if)#ip address 192.168.1.1 255.255.255.0

RouterA(config-if)#ip nat inside

RouterA(config-if)#no shutdown

RouterA(config-if)#exit

RouterA(config)#interface fastEthernet 1/0

RouterA(config-if)#ip address 202.98.38.5 255.255.255.0

RouterA(config-if)#ip nat outside

RouterA(config-if)#no shutdown

RouterA(config-if)#exit

Page 11: 静态 NAT 地址转换 实现静态 NAT 地址转换功能。将路由器 2501 的 E0 作为内 部端口,同步端口 S0 作为外部端口。其中 10.1.1.2 , 10.1.1.3 , 10.1.1.4

RouterA(config)#ip nat pool aa 202.98.38.2 202.98.38.10 netmask 255.255.255.0

RouterA(config)#access-list 1 permit 192.168.1.0 0.0.0.255

RouterA(config)#ip nat inside source list 1 pool aa

RouterA#show ip access-lists

Page 12: 静态 NAT 地址转换 实现静态 NAT 地址转换功能。将路由器 2501 的 E0 作为内 部端口,同步端口 S0 作为外部端口。其中 10.1.1.2 , 10.1.1.3 , 10.1.1.4

Switch>enable

Switch#config terminal

Switch(config)#interface vlan 1

Switch(config-if)#ip address 192.168.1.1 255.255.255.0

Page 13: 静态 NAT 地址转换 实现静态 NAT 地址转换功能。将路由器 2501 的 E0 作为内 部端口,同步端口 S0 作为外部端口。其中 10.1.1.2 , 10.1.1.3 , 10.1.1.4

配置 PC1 与 PC2

PC1 IP Address. . . . . . . . . . . . : 192.168.1.2

Subnet Mask . . . . . . . . . . . : 255.255.255.0

Default Gateway . . . . . . . . . : 192.168.1.1

C> ipconfig /ip 192.168.1.2 255.255.255.0

C>ipconfig /dg 192.168.1.1

PC2 IP Address. . . . . . . . . . . . : 202.98.38.5

Subnet Mask . . . . . . . . . . . : 255.255.255.0

Default Gateway . . . . . . . . . : 202.98.38.1

C> ipconfig /ip 202.98.8.5 255.255.255.0

C>ipconfig /dg 202.98.38.1

Page 14: 静态 NAT 地址转换 实现静态 NAT 地址转换功能。将路由器 2501 的 E0 作为内 部端口,同步端口 S0 作为外部端口。其中 10.1.1.2 , 10.1.1.3 , 10.1.1.4

PC1 :

C:>ping 202.98.38.1

C:>ping 202.98.38.5

PC2 :

C:>ping 202.98.38.1

配置完成后可以用以下语句进行查看:

RouterA#show ip nat translations

Page 15: 静态 NAT 地址转换 实现静态 NAT 地址转换功能。将路由器 2501 的 E0 作为内 部端口,同步端口 S0 作为外部端口。其中 10.1.1.2 , 10.1.1.3 , 10.1.1.4

PC>ping 202.98.38.1

Pinging 202.98.38.1 with 32 bytes of data:

Reply from 202.98.38.1: bytes=32 time=63ms TTL=255

Reply from 202.98.38.1: bytes=32 time=62ms TTL=255

Reply from 202.98.38.1: bytes=32 time=62ms TTL=255

Reply from 202.98.38.1: bytes=32 time=63ms TTL=255

Ping statistics for 202.98.38.1:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 62ms, Maximum = 63ms, Average = 62ms

PC>ping 202.98.38.5

Pinging 202.98.38.5 with 32 bytes of data:

Reply from 202.98.38.5: bytes=32 time=93ms TTL=127

Reply from 202.98.38.5: bytes=32 time=94ms TTL=127

Reply from 202.98.38.5: bytes=32 time=93ms TTL=127

Reply from 202.98.38.5: bytes=32 time=94ms TTL=127

Ping statistics for 202.98.38.5:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 93ms, Maximum = 94ms, Average = 93ms

C>

Page 16: 静态 NAT 地址转换 实现静态 NAT 地址转换功能。将路由器 2501 的 E0 作为内 部端口,同步端口 S0 作为外部端口。其中 10.1.1.2 , 10.1.1.3 , 10.1.1.4

RouterA#show ip nat translations

Pro Inside global Inside local Outside local Outside global

icmp 202.98.38.2:41 192.168.1.2:41 202.98.38.5:41 202.98.38.5:41

icmp 202.98.38.2:42 192.168.1.2:42 202.98.38.5:42 202.98.38.5:42

icmp 202.98.38.2:43 192.168.1.2:43 202.98.38.5:43 202.98.38.5:43

icmp 202.98.38.2:44 192.168.1.2:44 202.98.38.5:44 202.98.38.5:44