网络无处不在(自配小型网络)

通过vlan划分,vtp,单臂路由,ospf相关配置完成。


                                  相关信息表

一.相关知识点

1.vlan划分

     是一种通过将局域网内的设备逻辑地而不是物理地划分成一个个网段从而实现虚拟工作组的新兴技术。VLAN是为解决以太网的广播问题和安全性而提出的,它在以太网帧的基础上增加了VLAN头,用VLAN ID把用户划分为更小的工作组,限制不同工作组间的用户二层互访,每个工作组就是一个虚拟局域网。虚拟局域网的好处是可以限制广播范围,并能够形成虚拟工作组,动态管理网络。


2.vtp

    是VLAN中继协议,也被称为虚拟局域网干道协议,有三种模式(server,client,transportation)。


3.ospf

    是一种典型的链路状态(Link-state)的路由协议,一般用于同一个路由域内。在这里,路由域是指一个自治系统(Autonomous System),即AS,它是指一组通过统一的路由政策或路由协议互相交换路由信息的网络。在这个AS中,所有的OSPF路由器都维护一个相同的描述这个AS结构的数据库,该数据库中存放的是路由域中相应链路的状态信息,OSPF路由器正是通过这个数据库计算出其OSPF路由表的。


二.相关配置

A.router1内部区域配置

1.在switch7,switch6,switch9,三台交换机上划分vlan,各自划分vlan2,vlan3.然后同时设置vtp,三台设为客户模式(client).

switch7#configure terminal

switch7(config)#vlan 2

switch7(config-vlan)#vlan 3

switch7(config-vlan)#exit

switch7(config)#interface f0/2

switch7(config-if)#switchport mode access

switch7(config-if)#switchport access vlan 2

switch7(config)#interface f0/3

switch7(config-if)#switchport mode access

switch7(config-if)#switchport access vlan 3

switch7(config)#interface f0/1

switch7(config-if)#switchport mode trunk

switch7(config-if)#exit

switch7(config)#vtp mode client


注:switch6,switch9同switch7操作.


2.switch0设为服务器模式,端口模式设为trunk。

switch0(config)#interface f0/2

switch0(config-if)#switchport mode trunk

switch0(config)#interface f0/3

switch0(config-if)#switchport mode trunk

switch0(config)#interface f0/4

switch0(config-if)#switchport mode trunk

switch0(config)#interface f0/1

switch0(config-if)#switchport mode trunk

switch0(config)#vtp mode server


注:这时三台交换机区域的相同vlan之间可相互通信。即vlan1分布的计算机可通信,vlan2分布的计算机可通信.


3.配置单臂路由


 目的:实现不同vlan之间的通信.

router1(config)#interface f0/1.2

router1(config-subif)#encapsulation dot1Q 2

router1(config-subif)#ip address 192.168.1.1 255.255.255.0

router1(config-subif)#interface f0/1.3

router1(config-subif)#encapsulation dot1Q 3

router1(config-subif)#ip address 192.168.2.1 255.255.255.0


注:router1内部区域计算机即可相互通信.


B.router2内部区域配置


1.划分vlan

switch4#configure terminal

switch4(config)#vlan 2

switch4(config-vlan)#vlan 3

switch4(config-vlan)#exit

switch4(config)#interface f0/2

switch4(config-if)#switchport mode access

switch4(config-if)#switchport access vlan 2

switch4(config)#interface f0/3

switch4(config-if)#switchport mode access

switch4(config-if)#switchport access vlan 3

switch4(config)#interface f0/1

switch4(config-if)#switchport mode trunk

switch4(config-if)#exit


2.实现单臂路由

router2(config)#interface f0/1.2

router2(config-subif)#encapsulation dot1Q 2

router2(config-subif)#ip address 192.168.5.1 255.255.255.0

router2(config-subif)#interface f0/1.3

router2(config-subif)#encapsulation dot1Q 3

router2(config-subif)#ip address 192.168.6.1 255.255.255.0


C.ospf的配置

目的:实现不同网络的通信.


1.router0的相关配置

router0(config)interface f0/0

router0(config-if)#ip address 192.168.8.1 255.255.255.0

router0(config-if)#exit

router0(config)interface s2/0

router0(config-if)#ip address 192.168.3.2 255.255.255.0

router0(config-if)#clock rate 64000

router0(config-if)#no shutdown

router0(config)interface s3/0

router0(config-if)#ip address 192.168.4.2 255.255.255.0

router0(config-if)#clock rate 64000

router0(config-if)#no shutdown

router0(config-if)#exit

router0(config)#router ospf 1

router0(config-router)#network 192.168.8.0 0.0.0.255 area 0

router0(config-router)#network 192.168.3.0 0.0.0.255 area 0

router0(config-router)#network 192.168.4.0 0.0.0.255 area 0


2.router1的相关配置


router1(config)interface s2/0

router1(config-if)#ip address 192.168.3.1 255.255.255.0

router1(config-if)#clock rate 64000

router1(config-if)#no shutdown

router1(config)interface s3/0

router1(config-if)#ip address 192.168.7.1 255.255.255.0

router1(config-if)#clock rate 64000

router1(config-if)#no shutdown

router1(config-if)#exit

router1(config)#router ospf 1

router1(config-router)#network 192.168.3.0 0.0.0.255 area 0

router1(config-router)#network 192.168.7.0 0.0.0.255 area 0

router1(config-router)#network 192.168.1.0 0.0.0.255 area 0

router1(config-router)#network 192.168.2.0 0.0.0.255 area 0


3.router2的相关配置


router2(config)interface s2/0

router2(config-if)#ip address 192.168.4.1 255.255.255.0

router2(config-if)#clock rate 64000

router2(config-if)#no shutdown

router2(config)interface s3/0

router2(config-if)#ip address 192.168.7.2 255.255.255.0

router2(config-if)#clock rate 64000

router2(config-if)#no shutdown

router2(config-if)#exit

router2(config)#router ospf 1

router2(config-router)#network 192.168.4.0 0.0.0.255 area 0

router2(config-router)#network 192.168.7.0 0.0.0.255 area 0

router2(config-router)#network 192.168.5.0 0.0.0.255 area 0

router2(config-router)#network 192.168.6.0 0.0.0.255 area 0

注:所有网络即可通信.


备注:相关查看信息

 

1.router0的相关查看信息

Router0#show run

Building configuration...


Current configuration : 820 bytes

!

version 12.2

no service timestamps log datetime msec

no service timestamps debug datetime msec

no service password-encryption

!

hostname Router0

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

interface FastEthernet0/0

ip address 192.168.8.1 255.255.255.0

duplex auto

speed auto

!

interface FastEthernet1/0

no ip address

duplex auto

speed auto

!

interface Serial2/0

ip address 192.168.3.2 255.255.255.0

!

interface Serial3/0

ip address 192.168.4.2 255.255.255.0

clock rate 64000

!

interface FastEthernet4/0

no ip address

shutdown

!

interface FastEthernet5/0

no ip address

shutdown

!

router ospf 1

log-adjacency-changes

network 192.168.8.0 0.0.0.255 area 0

network 192.168.3.0 0.0.0.255 area 0

network 192.168.4.0 0.0.0.255 area 0

!

router rip

!

ip classless

!

!

!

!

!

!

!

line con 0

line vty 0 4

login

!

!

!

end


2.router1的相关查看信息


Router1#show run

Building configuration...


Current configuration : 1039 bytes

!

version 12.2

no service timestamps log datetime msec

no service timestamps debug datetime msec

no service password-encryption

!

hostname Router1

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

interface FastEthernet0/0

no ip address

duplex auto

speed auto

!

interface FastEthernet0/0.10

encapsulation dot1Q 10

ip address 192.168.1.1 255.255.255.0

!

interface FastEthernet0/0.20

encapsulation dot1Q 20

ip address 192.168.2.1 255.255.255.0

!

interface FastEthernet1/0

no ip address

duplex auto

speed auto

!

interface Serial2/0

ip address 192.168.3.1 255.255.255.0

clock rate 64000

!

interface Serial3/0

ip address 192.168.7.1 255.255.255.0

clock rate 64000

!

interface FastEthernet4/0

no ip address

shutdown

!

interface FastEthernet5/0

no ip address

shutdown

!

router ospf 1

log-adjacency-changes

network 192.168.3.0 0.0.0.255 area 0

network 192.168.7.0 0.0.0.255 area 0

network 192.168.1.0 0.0.0.255 area 0

network 192.168.2.0 0.0.0.255 area 0

!

router rip

!

ip classless

!

!

!

!

!

!

!

line con 0

line vty 0 4

login

!

!

!

end


3.router2的相关查看信息


Router2#show run

Building configuration...


Current configuration : 990 bytes

!

version 12.2

no service timestamps log datetime msec

no service timestamps debug datetime msec

no service password-encryption

!

hostname Router2

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

interface FastEthernet0/0

no ip address

duplex auto

speed auto

!

interface FastEthernet0/0.10

encapsulation dot1Q 10

ip address 192.168.5.1 255.255.255.0

!

interface FastEthernet0/0.20

encapsulation dot1Q 20

ip address 192.168.6.1 255.255.255.0

!

interface FastEthernet1/0

no ip address

duplex auto

speed auto

!

interface Serial2/0

ip address 192.168.4.1 255.255.255.0

!

interface Serial3/0

ip address 192.168.7.2 255.255.255.0

!

interface FastEthernet4/0

no ip address

shutdown

!

interface FastEthernet5/0

no ip address

shutdown

!

router ospf 1

log-adjacency-changes

network 192.168.4.0 0.0.0.255 area 0

network 192.168.7.0 0.0.0.255 area 0

network 192.168.5.0 0.0.0.255 area 0

network 192.168.6.0 0.0.0.255 area 0

!

ip classless

!

!

!

!

!

!

!

line con 0

line vty 0 4

login

!

!

!

end


注:以上配置在思考模拟器下完成.

你可能感兴趣的:(局域网)