您好,登錄后才能下訂單哦!
sw#conf t
sw(config)#no ip routing //關(guān)閉路由功能
sw(config)#int f1/0
sw(config-if)#speed 100 //配置速率
sw(config-if)#dup full //配置全雙工模式
1.配置路由器雙臂路由
R1#conf t
R1(config)#int f0/0
R1(config-if)#ip add 192.168.100.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#int f0/1
R1(config-if)#ip add 12.0.0.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#ex
2.設(shè)定NAT地址轉(zhuǎn)換
R1(config)#access-list 1 permit 192.168.100.0 0.0.0.255 //設(shè)定內(nèi)部地址轉(zhuǎn)化范圍
R1(config)#ip nat pool test 12.0.0.10 12.0.0.100 netmask 255.255.255.0 ////設(shè)定外部地址轉(zhuǎn)化范圍
R1(config)#ip nat inside source list 1 pool test //調(diào)用ip地址池
R1(config)#int f0/0
R1(config-if)#ip nat inside //將NAT應(yīng)用于內(nèi)部端口
R1(config-if)#int f0/1
R1(config-if)#ip nat outside //將NAT應(yīng)用于外部端口
R1(config-if)#end
PC1> ip 192.168.100.10 192.168.100.1
Checking for duplicate address...
PC1 : 192.168.100.10 255.255.255.0 gateway 192.168.100.1
PC2> ip 192.168.100.20 192.168.100.1
Checking for duplicate address...
PC1 : 192.168.100.20 255.255.255.0 gateway 192.168.100.1
PC3> ip 12.0.0.12 12.0.0.1
Checking for duplicate address...
PC1 : 12.0.0.12 255.255.255.0 gateway 12.0.0.1
1.測試互通性
PC1> ping 12.0.0.12
84 bytes from 12.0.0.12 icmp_seq=1 ttl=63 time=31.244 ms
84 bytes from 12.0.0.12 icmp_seq=2 ttl=63 time=31.282 ms
84 bytes from 12.0.0.12 icmp_seq=3 ttl=63 time=46.897 ms
84 bytes from 12.0.0.12 icmp_seq=4 ttl=63 time=46.834 ms
84 bytes from 12.0.0.12 icmp_seq=5 ttl=63 time=31.210 ms
PC2> ping 12.0.0.12
84 bytes from 12.0.0.12 icmp_seq=1 ttl=63 time=46.864 ms
84 bytes from 12.0.0.12 icmp_seq=2 ttl=63 time=46.864 ms
84 bytes from 12.0.0.12 icmp_seq=3 ttl=63 time=31.242 ms
84 bytes from 12.0.0.12 icmp_seq=4 ttl=63 time=31.273 ms
84 bytes from 12.0.0.12 icmp_seq=5 ttl=63 time=31.208 ms
2.debug功能查看地址轉(zhuǎn)換過程
R1#debug ip nat
IP NAT debugging is on
R1#
*Mar 1 00:15:21.287: NAT*: s=192.168.100.10->12.0.0.10, d=12.0.0.12 [55463]
*Mar 1 00:15:21.295: NAT*: s=12.0.0.12, d=12.0.0.10->192.168.100.10 [55463]
//PC1 地址轉(zhuǎn)換成功
R1#
*Mar 1 00:19:12.139: NAT*: s=192.168.100.20->12.0.0.11, d=12.0.0.12 [55693]
*Mar 1 00:19:12.159: NAT*: s=12.0.0.12, d=12.0.0.11->192.168.100.20 [55693]
//PC2 地址轉(zhuǎn)換成功
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。