12.13 實例!組建一個小型局域網

1、局域網技術

局域網(LAN )是指在某一區域內由多臺計算機互聯成的計算機組。

一般是方圓幾千米以內。局域網可以實現文件管理、軟件共享、打印機共享、工作組內的日程安排、電子郵件和傳真通信服務等功能。局域網是封閉型的,可以由辦公室觀眾的兩臺計算機組成,也可以由一個公司的上千臺計算組成。

2、所用到的硬件及知識點:該實驗用到4臺路由器、3臺交換機、 5 臺PC 機。 VLAN 劃分 ,TRUNK,RIPV2。

3、拓撲圖:

實例!組建一個小型局域網


(1) PC 地址表:

實例!組建一個小型局域網


(2)端口分配-交換機

實例!組建一個小型局域網


(3)接口分配表-路由器

實例!組建一個小型局域網


4、局域網具體配置

(1)PC 機的配置

實例!組建一個小型局域網


注: PC2、PC3、PC4、PC5、PC6、PC7 配置相同

(2)設交換機主機名

例:

Switch1 :

Switch>enable

Switch#configure terminal

Switch(config)#hostname s1 //s1 為所設置的交換機名稱

S1(config)#exit

Router 1:

Router>enable

Router#configure terminal

Router (config)#hostname R1 //s1 為所設置的交換機名稱

R1(config)#exit

注:路由器 R2,R3,R4 與R1設置相同。交換機S2,S3,S4, S5與S1的設置相同

(3)VLAN 設置

例: S2

S2(config)# interface FastEthernet0/2

S2(config-if)#switchport mode trunk // 將 f0/2 轉換成 trunk

s2(config-if)#no shutdown

s2(config-if)#exit

s2(config)# interface FastEthernet0/1

s2(config-if)#no shutdown s2(config-if)#exit

s2(config)#vlan 60 // 創建 VLAN 60

S2(config-vlan)#inter vlan 60

s2(config-if)# interface FastEthernet0/1

s2(config-if)#switchport access vlan 60 // 加入 VLAN 60

s2(config-if)#no shutdown

注:如果交換機與交換機,交換機與路由器相連要強制轉換為 trunk。

若交換機與 PC 則不需要。 S1,S3,S4 如 s2 配置。

(4)路由器設置

R1:

R1(config)# interface FastEthernet0/0

R1(config-if)#no shutdown

R1(config-if)#exit

R1(config)# interface serial0/3/0

R1(config)#ip address 200.0.0.2 255.255.255.0 // 寫入 IP

R1(config-if)#no shutdown

R1(config-if)#exit

R1(config)#interface FastEthernet0/0.40

R1(config-subif)#encapsulation dot1q 40 // 封裝子接口到 VLAN 40

R1(config-subif)#ip address 200.30.40.1 255.255.255.0

R1(config-subif)#exit

R1(config)#interface FastEthernet0/0.50

R1(config-subif)#encapsulation dot1q 50

R1(config-subif)#ip address 200.30.50.1 255.255.255.0

R1(config-subif)#exit

R2(config)#interface FastEthernet0/0.60

R2(config-subif)#encapsulation dot1q 60

R2(config-subif)#ip address 201.30.60.1 255.255.255.0

R2(config-subif)#exit R3(config)#interface FastEthernet0/0.60

R3(config-subif)#encapsulation dot1q 61

R3(config-subif)#ip address 202.30.61.1 255.255.255.0

R3(config-subif)#exit

R3(config)#interface FastEthernet0/0.70

R3(config-subif)#encapsulation dot1q 70

R3(config-subif)#ip address 202.30.70.1 255.255.255.0

R3(config-subif)#exit

R3(config)#interface FastEthernet0/0.71

R3(config-subif)#encapsulation dot1q 71

R3(config-subif)#ip address 202.30.71.1 255.255.255.0

R3(config-subif)#exit

R1(config)#router rip

R1(config-router)#version 2 // 版本

R1(config-router)#network 200.0.0.0 // 轉發的網絡

R1(config-router)#network 200.30.40.0

R1(config-router)#network 200.30.50.0

R1(config-router)#exit

注:

R2 轉發的網絡

R2(config-router)#network 200.0.0.0

R2(config-router)#network 210.0.0.0

R2(config-router)#network 201.30.60.0

R3 轉發的網絡

R3(config-router)#network 210.0.0.0

R3(config-router)#network 220.0.0.0

R3(config-router)#network 202.30.61.0

R3(config-router)#network 202.30.70.0

R3(config-router)#network 202.30.71.0

R4 轉發的網絡

R4(config-router)#network 220. 0. 0.0

(5) 時鐘設置

比如 R2 中的 s0/3/0

R2(config)# interface serial0/3/0

R2(config-if)#ip address 200.0.0.3 255.255.255.0

R2(config-if)#clock rate 64000

R2(config-if)#no shutdown

5、測試

PC1 為 VLAN 40 , PC2 為 VLAN 50 , PC3 為 VLAN 60 , PC4 為 VLAN 61 , PC5 和 PC6 同屬於 VLAN 70 , PC7 為 VLAN 71

(1 )同一 VLAN 之間的測試

PC5 ( 200.30.70.2 )和 PC6 ( 200.30.70.3 )之間的測試

實例!組建一個小型局域網


(2) 不同網段之間的測試

1、PC1(200.30.40.2) 和 PC2(200.30.50.2)

先到相應的網段 200.30.50.0 ,再根據路由表進行轉發。

實例!組建一個小型局域網


2、PC1(200.30.40.2) 和 PC3(201.30.60.2)

先到相應的網段 201.30.60.0 ,再根據路由表進行轉發。

實例!組建一個小型局域網


3、PC6(202.30.70.3) 和 PC7(202.30.71.3)

先到相應的網段 202.30.71.0,再根據路由表進行轉發。

實例!組建一個小型局域網


注:其它的測試如上圖所示,均可 Ping 通。

5、舉例 R3 中的配置

R3>enable

R3#show run

Building configuration...

Current configuration : 1081 bytes

!

version 12.4

no service timestamps log datetime msec

no service timestamps debug datetime msec

no service password-encryption

!

hostname R3

!

ip name-server 0.0.0.0

!

interface FastEthernet0/0

no ip address

duplex auto

speed auto

!

interface FastEthernet0/0.61

encapsulation dot1Q 61

ip address 202.30.61.1 255.255.255.0

!

interface FastEthernet0/0.70

encapsulation dot1Q 70

ip address 202.30.70.1 255.255.255.0

!

interface FastEthernet0/0.71

encapsulation dot1Q 71

ip address 202.30.71.1 255.255.255.0

!

interface FastEthernet0/1

no ip address

duplex auto

speed auto

shutdown

!

interface Serial0/2/0

no ip address

shutdown

!

interface Serial0/2/1

no ip address

shutdown

!

interface Serial0/3/0

ip address 210.0.0.3 255.255.255.0

!

interface Serial0/3/1

ip address 220.0.0.3 255.255.255.0

!

interface Vlan1

no ip address

shutdown

!

router rip

version 2

network 202.30.61.0

network 202.30.70.0

network 202.30.71.0

network 210.0.0.0

network 220.0.0.0

!

ip classless

!

line con 0

line vty 0 4

login

!

end

S1#show running-config

Building configuration...

Current configuration : 1088 bytes

!

version 12.1

no service timestamps log datetime msec

no service timestamps debug datetime msec

no service password-encryption

!

hostname S1

!

interface FastEthernet0/1

switchport access vlan 40

!

interface FastEthernet0/2

switchport access vlan 50

!

interface FastEthernet0/3

switchport mode trunk

!

interface Vlan1

no ip address

shutdown

!

interface Vlan40

no ip address

!

interface Vlan50

no ip address

line con 0

!

line vty 0 4

login

line vty 5 15

login

!

end

6、總結與心得

本次所做的實驗, 所運用到的知識均為我們上幾個星期所配置過的實驗。如 RIP 、VLAN 、子網的劃分等等。通過各種路由和交換技術,我們可以組建更為複雜的局域網,本次的實驗只是一個簡化局域網,但從這次的實驗中,我們可以充分的瞭解到, VLAN 技術可以使網段的分配和管理變得更加方便,靈活。


分享到:


相關文章: