實(shí)驗(yàn)?zāi)繕?biāo)
- 理解NAT網(wǎng)絡(luò)地址轉(zhuǎn)換的原理及功能
- 掌握NAPT的配置,實(shí)現(xiàn)局域網(wǎng)訪問(wèn)互聯(lián)網(wǎng)
實(shí)驗(yàn)背景
- 公司辦公網(wǎng)需要接入互聯(lián)網(wǎng),公司只向ISP申請(qǐng)了一條專線,該專線分配了一個(gè)公司的IP地址,配置實(shí)現(xiàn)全公司的主機(jī)都可以訪問(wèn)外網(wǎng)
技術(shù)原理
NAT將網(wǎng)絡(luò)劃分為內(nèi)部網(wǎng)絡(luò)和外部網(wǎng)絡(luò)兩部分,局域網(wǎng)主機(jī)利用NAT訪問(wèn)網(wǎng)絡(luò)時(shí),是將局域網(wǎng)內(nèi)部的本地地址轉(zhuǎn)換為互聯(lián)網(wǎng)合法的IP地址后轉(zhuǎn)發(fā)數(shù)據(jù)包
NAPT采用端口多路復(fù)用方式,內(nèi)部網(wǎng)絡(luò)的所有主機(jī)均可以共享一個(gè)外部合法的IP地址實(shí)現(xiàn)對(duì)互聯(lián)網(wǎng)的訪問(wèn),從而最大限度的節(jié)約ip地址資源。
實(shí)驗(yàn)步驟
- r1為公司出口路由器,其與ISP路由器之間通過(guò)v35鏈接
- 配置PC機(jī)、服務(wù)器與路由器的ip地址
- 在路由器上配置靜態(tài)路由協(xié)議,讓pc間可以互通
- 在r1上配置napt
- 在r1上定義外部網(wǎng)絡(luò)接口
- 驗(yàn)證主機(jī)之間的互通性
實(shí)驗(yàn)設(shè)備
-
pc2臺(tái);server pt1臺(tái) switch 2950 24 1臺(tái) router pt2臺(tái)
架構(gòu)圖 pc1
192.168.1.2
255.255.255.0
192.168.1.1
- pc2
192.168.1.3
255.255.255.0
192.168.1.1
- server
200.1.2.2
255.255.255.0
200.1.2.1
- router0
en
conf t
host r0
int fa 0/0
ip address 192.168.1.1 255.255.255.0
no shutdown
int s 2/0
ip address 200.1.1.1 255.255.255.0
no shutdown
clock rate 64000
- router1
en
conf t
host r1
int s 2/0
ip address 200.1.1.2 255.255.255.0
no shutdown
int fa 0/0
ip address 200.1.2.1 255.255.255.0
no shutdown
- router0
exit
ip route 200.1.2.0 255.255.255.0 200.1.1.2
- router1
exit
ip route 192.168.1.0 255.255.255.0 2000.1.1.1
end
show ip route
- pc1
ping 200.1.2.2 success
http://200.1.2.2 success
- router0
int fa 0/0
ip nat indside
int s 2/0
ip nat outside
exit
access-list 1 permit 192.168.1.0 0.0.0.255
ip nat pool cfslbrn 200.1.1.3 netmask 255.255.255.0
ip nat inside source list 1 pool cfslbrn overload
end
show ip nat translations
- pc1
http://200.1.2.2 success
- router0
show ip nat translations
- pc2
http://200.1.2.2
- router0
show ip nat translations
