一個實際的網絡配置

     在論壇上看到一個實際網絡配置的例子,包含了IP的規劃、VLAN、NAT,看着不錯,配置完了貼出來一起學習下,哪兒有需要改進的地多多指教。

 

一個實際配置的實例

一個比較實際的網絡配置

     圖爲某園區辦公網絡拓撲,在接入層採用S2126交換機,在接入層交換機上劃分了業務部VLAN10和財務部VLAN20,匯聚層採用了S3550交換機,接入層和匯聚層之間通過一條鏈路連接,匯聚層交換機通過F0/20端口和R2700的F1/0相連,路由器R2700的F1/1連接一臺Internet上的FTP服務器。假定VLAN10和VLAN20的網絡地址分別是192.168.100.0和192.168.200.0,ISP已經給該園區分配了一個外網地址61.164.87.158。請規劃網絡上設備的IP地址,配置交換機和路由器,以便通過NAPT地址轉換技術,實現園區辦公網絡訪問Internet上的FTP。
【步驟1】規劃網絡上設備的IP地址
【步驟2】配置接入層交換機S2126設備的基本信息
【步驟3】配置三層交換機S3550設備,實現VLAN間的互聯
【步驟4】配置路由器R2700設備,實現全網之間的互聯互通
【步驟5】配置全網三層設備的靜態路由信息,實現內網設備訪問外網
【步驟6】配置路由器R2700設備NAPT,實現園區辦公網絡訪問Internet

 

【步驟1】規劃網絡上設備的IP地址

接入層上:

VLAN10 網關192.168.100.254/24

VLAN20 網關192.168.200.254/24

VLAN999 IP 10.16.0.1/24

F0/24 設置成TRUNK

匯聚層上:

F0/24 設置成TRUNK

F0/20 IP 192.168.1.1/30

VLAN999 IP 10.16.0.254/24

路由器上:

F1/0 IP 192.168.1.2/30

F1/1 IP 61.164.87.158

【步驟2】配置接入層交換機S2126設備的基本信息

S2126#

S2126#vlan data

S2126(vlan)#vlan 100 //這是業務部

VLAN 100 added:

Name: VLAN0100

S2126(vlan)#vlan 200 //這是財務部

VLAN 200 added:

Name: VLAN0200

S2126(vlan)#vlan 999 //這是管理VLAN,在此不使用VLAN1做管理VLAN

VLAN 999 added:

Name: VLAN0999

S2126(vlan)#exit

APPLY completed.

Exiting....

S2126#conf t

Enter configuration commands, one per line. End with CNTL/Z.

S2126(config)#int vlan 999

S2126(config-if)#ip add 10.16.0.1 255.255.255.0

S2126(config-if)# no shut

S2126(config-if)#exit

S2126(config)# ip default-gateway 10.16.0.254

S2126(config)#int f0/24

S2126(config-if)#swi mod trunk

S2126(config-if)#swi trunk native vlan 999

S2126(config)#int ran f0/1 - 10

S2126(config-if-range)#no shut

S2126(config-if-range)#swi mod acc

S2126(config-if-range)#swi acc vlan 100

S2126(config-if-range)#int ran f0/11 - 20

S2126(config-if-range)#no shut

S2126(config-if-range)#swi mod acc

S2126(config-if-range)#swi acc vlan 200

S2126(config-if-range)#end

S2126#wri

Building configuration...

[OK]

【步驟3】配置三層交換機S3550設備,實現VLAN間的互聯

S3550(vlan)#vlan 100

VLAN 100 added:

Name: VLAN0100

S3550(vlan)#vlan 200

VLAN 200 added:

Name: VLAN0200

S3550(vlan)#vlan 999

VLAN 999 added:

Name: VLAN0999

S3550(vlan)#exit

APPLY completed.

Exiting....

S3550#conf t

Enter configuration commands, one per line. End with CNTL/Z.

S3550(config)#int vlan 100

S3550(config-if)#ip add 192.168.100.254 255.255.255.0

S3550(config-if)#int vlan 200

S3550(config-if)#ip add 192.168.200.254 255.255.255.0

S3550(config-if)#int vlan 999

S3550(config-if)#ip add 10.16.0.254 255.255.255.0

S3550(config)#int f0/20

S3550(config-if)#no switchport

S3550(config-if)#no shu

S3550(config-if)#ip add 192.168.1.1 255.255.255.252

S3550(config)#int f0/24

S3550(config-if)#swi mod trunk

S3550(config-if)#swi trunk native vlan 999

S3550(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.2

S3550#wri

Building configuration...

[OK]

S3550#

測試:

在192.168.100.1的機器上進行測試

PC>ping 192.168.100.254

Pinging 192.168.100.254 with 32 bytes of data:

Reply from 192.168.100.254: bytes=32 time=53ms TTL=255

Reply from 192.168.100.254: bytes=32 time=20ms TTL=255

Reply from 192.168.100.254: bytes=32 time=30ms TTL=255

Reply from 192.168.100.254: bytes=32 time=16ms TTL=255

Ping statistics for 192.168.100.254:

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

Approximate round trip times in milli-seconds:

Minimum = 16ms, Maximum = 53ms, Average = 29ms

PC>ping 192.168.200.1

Pinging 192.168.200.1 with 32 bytes of data:

Request timed out.

Reply from 192.168.200.1: bytes=32 time=36ms TTL=127

Reply from 192.168.200.1: bytes=32 time=9ms TTL=127

Reply from 192.168.200.1: bytes=32 time=45ms TTL=127

【步驟4】配置路由器R2700設備,實現全網之間的互聯互通

R2700(config)#int f1/0

R2700(config-if)#no shut

R2700(config-if)# ip add 192.168.1.2 255.255.255.252

R2700(config)#ip nat inside

R2700(config-if)#int f1/1

R2700(config-if)#no shut

R2700(config-if)# ip ad 61.164.87.158 255.255.255.252

R2700(config)#ip nat outside

//靜態路由

R2700(config)#ip route 192.168.0.0 255.255.0.0 192.168.1.1

R2700(config)#ip route 10.16.0.254 255.255.255.0 192.168.1.1

R2700(config)#ip route 0.0.0.0 0.0.0.0 fastEthernet 0/1

//定義地址池

R2700(config)#ip nat pool snc 61.164.87.158 61.164.87.158 netmask 255.255.255.0

//定義允許向外NAT轉換的內部地址

R2700(config)#access-list 10 permit 192.168.100.0 0.0.0.255

R2700(config)#access-list 20 permit 192.168.200.0 0.0.0.255

R2700(config)#access-list 30 permit 192.168.1.0 0.0.0.255

R2(config)#ip nat inside source list 10 pool snc overload

R2(config)#ip nat inside source list 20 pool snc overloa

R2(config)#ip nat inside source list 30 pool snc overload

//overload必須有,否則相當於一一映射了,不能完成多個主機共同上網

[OK]

R2700#

測試:

Ping statistics for 192.168.1.2:

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

PC>ping 192.168.1.2

Pinging 192.168.1.2 with 32 bytes of data:

Reply from 192.168.1.2: bytes=32 time=35ms TTL=254

Reply from 192.168.1.2: bytes=32 time=35ms TTL=254

Reply from 192.168.1.2: bytes=32 time=30ms TTL=254

Reply from 192.168.1.2: bytes=32 time=25ms TTL=254

Ping statistics for 192.168.1.2:

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

Approximate round trip times in milli-seconds:

Minimum = 25ms, Maximum = 35ms, Average = 31ms

PC>ping 61.164.87.158

Pinging 61.164.87.158 with 32 bytes of data:

Reply from 61.164.87.158: bytes=32 time=32ms TTL=254

Reply from 61.164.87.158: bytes=32 time=45ms TTL=254

Ping statistics for 61.164.87.158:

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

Approximate round trip times in milli-seconds:

Minimum = 32ms, Maximum = 45ms, Average = 38ms

 

【小結】

NAT

包括有靜態NAT、動態地址NAT和端口多路複用地址轉換三種技術類型。

 

(1)靜態 NAT是把內部網絡中的某個主機地址永久映射成外部網絡中的某個合法地址,內網地址與外網地址的對應關係是一對一。這種應用一般是在內網的WEB等服務器對外服務時,雖然該WEB服務器使用的是內網的IP地址,但是經過靜態轉換後 ,外網的機器通過映射到的外網IP可以直接訪問到該WEB服務器。

(2)動態地址NAT是採用把外部網絡中的一系列合法地址使用動態分配的方法映射到內部網絡,內網地址與外網地址對應關係也是一對一。這種情況下一個內網的IP地址必須要有一個外網的IP對應,個人認爲可以看作是多個靜態NAT吧,在不過在每次連接時使用的是動態的外網地址。

(3)端口多路複用地址轉換,平時最常見的,內網地址與外網地址是多對一。它是把內部地址映射到外部網絡的一個IP地址的不同端口上。比如一個學校或者一個單位,通過少數的幾個IP可以完成到內網的所有IP到外網的映射。與動態IP在配置上很相似,但是最後必須加上一個OVERLOAD,否則就是動態NAT轉換了。

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章