第十六章 網(wǎng)絡(luò)地址轉(zhuǎn)換NAPT配置

實(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
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容