扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
实验拓扑图如上
用NAT让内外网通讯
一、配置IP地址
inside:lo0=172.16.1.1/24
lo1=172.16.2.1/24
s1/0=12.1.1.1/24
Border:s1/0=12.1.1.2/24
f0/0=23.1.1.1/24
ISP:f0/0=23.1.1.2/24
lo0=100.100.100.100/24
配置inside
inside>en
inside#conf t
Enter configuration commands, one per line. End with CNTL/Z.
inside(config)#no ip domain-lookup
inside(config)#line console 0
inside(config-line)#exec-timeout 0 0
inside(config-line)#logg syn
inside(config-line)#exit
inside(config)#exit
inside#conf t
Enter configuration commands, one per line. End with CNTL/Z.
inside(config)#int l 0
inside(config-if)#ip add
*Mar 1 00:32:49.143: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
inside(config-if)#ip add 172.16.1.1 255.255.255.0
inside(config-if)#int l 1
inside(config-if)#ip add
*Mar 1 00:33:01.391: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
inside(config-if)#ip add 172.16.2.1 255.255.255.0
inside(config-if)#int s1/0
inside(config-if)#no sh
inside(config-if)#ip add 12.1.1.
*Mar 1 00:33:26.919: %LINK-3-UPDOWN: Interface Serial1/0, changed state to up
inside(config-if)#ip add 12.1.1.1 25
*Mar 1 00:33:27.927: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up
inside(config-if)#ip add 12.1.1.1 255.255.255.0
配置border
border>en
border#conf t
Enter configuration commands, one per line. End with CNTL/Z.
border(config)#no ip domain-lookup
border(config)#line console 0
border(config-line)#exec-timeout 0 0
border(config-line)#logg syn
border(config-line)#exit
border(config)#exit
border#conf t
Enter configuration commands, one per line. End with CNTL/Z.
border(config)#int s1/0
border(config-if)#no sh
border(config-if)#ip add
*Mar 1 00:34:53.755: %LINK-3-UPDOWN: Interface Serial1/0, changed state to up
border(config-if)#ip add 12
*Mar 1 00:34:54.763: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up
border(config-if)#ip add 12.1.1.2 255.255.255.0
配置isp
isp>en
isp#conf t
Enter configuration commands, one per line. End with CNTL/Z.
isp(config)#no ip domain-lookup
isp(config)#line console 0
isp(config-line)#exec-timeout 0 0
isp(config-line)#logg syn
isp(config-line)#exit
isp(config)#exit
isp#conf
Configuring from terminal, memory, or network [terminal]? t
Enter configuration commands, one per line. End with CNTL/Z.
isp(config)#int f0/0
isp(config-if)#no sh
isp(config-if)#ip add
*Mar 1 00:36:23.871: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar 1 00:36:24.871: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
isp(config-if)#ip add 23.1.1.2 255.255.255.0
isp(config-if)#int l 0
isp(config-if)#no sh
isp(config-if)#
*Mar 1 00:36:37.931: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
isp(config-if)#ip add 100.100.100.100 255.255.255.0二、配置routing通信
二、配置routing通信
1.Border
1)配置缺省路由指向ISP
测试能否ping通ISP的环回口
2)配置汇总路由指向Inside
border(config)#ip route 172.16.0.0 255.255.0.0 12.1.1.1
border(config)#ip route 0.0.0.0 0.0.0.0 23.1.1.2
border#ping 100.100.100.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 100.100.100.100, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 8/33/56 ms
2.Inside
1)配置缺省路由指向Borde
2)配置汇总路由指向Null0端口(防环路)
测试Borde能否与内网通信
inside(config)#ip route 0.0.0.0 0.0.0.0 12.1.1.2
inside(config)#ip route 172.16.0.0 255.255.0.0 null 0
border#ping 172.16.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/40/72 ms
三、配置动态NAT
Router(config)#access-list 1 per 192.168.21.1
border(config)#access-list 1 per 172.16.1.1 0.0.0.255
border(config)#access-list 1 per 172.16.2.1 0.0.0.255
Router(config)#$ cisco 10.10.10.10 10.10.10.10 netmask 255.255.255.0
border(config)#ip nat inside source list 1 pool cisco overload
border(config)#int s1/0
border(config-if)#ip nat ins
border(config-if)#ip nat inside
border(config-if)#int f0/0
border(config-if)#ip nat out
border(config-if)#ip nat outside
Router#
*Mar 1 00:12:04.707: NAT*: s=192.168.21.1->10.10.10.10, d=100.100.100.100 [10]
Router#
*Mar 1 00:12:06.675: NAT*: s=192.168.21.1->10.10.10.10, d=100.100.100.100 [11]
Router#
*Mar 1 00:12:08.659: NAT*: s=192.168.21.1->10.10.10.10, d=100.100.100.100 [12]
Router#
*Mar 1 00:12:10.643: NAT*: s=192.168.21.1->10.10.10.10, d=100.100.100.100 [13]
Router#
*Mar 1 00:12:12.659: NAT*: s=192.168.21.1->10.10.10.10, d=100.100.100.100 [14]
Router#
*Mar 1 00:13:12.903: NAT: expiring 10.10.10.10 (192.168.21.1) icmp 2 (2)
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者