315安全网论坛社区's Archiver

duanzibin 发表于 2006-12-5 10:55

以太网络建立多个VLAN典型案例

[font=Courier New]所谓典型局域网就是指由一台具备三层交换功能的核心交换机接几台分支交换机(不一定具备三层交换能力)。我们假设核心交换机名称为:com;分支交换机分别为:par1、par2、par3,分别通过port1的光线模块与核心交换机相连;并且假设vlan名称分别为counter、market、managing……   [/font]
[font=Courier New]                            需要做的工作:
                            A、设置vtp domain(核心、分支交换机上都设置)
                            B、配置中继(核心、分支交换机上都设置)
                            C、创建vlan(在server上设置)
                            D、将交换机端口划入vlan
                            E、配置三层交换 [/font]
[font=Courier New]                            A、设置vtp domain。 vtp domain 称为管理域。[/font]
[font=Courier New]                           
                        交换vtp更新信息的所有交换机必须配置为相同的管理域。如果所有的交换机都以中继线相连,那么只要在核心交换机上设置一个管理域,网络上所有的交换机都加入该域,这样管理域里所有的交换机就能够了解彼此的vlan列表。 [/font]

[font=Courier New]                        com#vlan database 进入vlan配置模式
                        com(vlan)#vtp domain com 设置vtp管理域名称 com
                        com(vlan)#vtp server 设置交换机为服务器模式 [/font]
[font=Courier New]                        par1#vlan database 进入vlan配置模式
                        par1(vlan)#vtp domain com 设置vtp管理域名称com
                        par1(vlan)#vtp client 设置交换机为客户端模式 [/font]
[font=Courier New]                        par2#vlan database 进入vlan配置模式
                        par2(vlan)#vtp domain com 设置vtp管理域名称com
                        par2(vlan)#vtp client 设置交换机为客户端模式 [/font]
[font=Courier New]                        par3#vlan database 进入vlan配置模式
                        par3(vlan)#vtp domain com 设置vtp管理域名称com
                        par3(vlan)#vtp client 设置交换机为客户端模式 [/font]
[font=Courier New]                           
                        注意:这里设置核心交换机为server模式是指允许在该交换机上创建、修改、删除vlan及其他一些对整个vtp域的配置参数,同步本vtp域中其他交换机传递来的最新的vlan信息;client模式是指本交换机不能创建、删除、修改vlan配置,也不能在nvram中存储vlan配置,但可同步由本vtp域中其他交换机传递来的vlan信息。 [/font]

[font=Courier New]                            B、配置中继为了保证管理域能够覆盖所有的分支交换机,必须配置中继。 [/font]
[font=Courier New]                           
                        Cisco交换机能够支持任何介质作为中继线,为了实现中继可使用其特有的isl标签。isl(inter-switch
                        link)是一个在交换机之间、交换机与路由器之间及交换机与服务器之间传递多个vlan信息及vlan数据流的协议,通过在交换机直接相连的端口配置isl封装,即可跨越交换机进行整个网络的vlan分配和进行配置。 [/font]

[font=Courier New]                            在核心交换机端配置如下: [/font]
[font=Courier New]                        com(config)#interface gigabitethernet 2/1
                        com(config-if)#switchport
                        com(config-if)#switchport trunk encapsulation isl 配置中继协议 [/font]
[font=Courier New]                        com(config-if)#switchport mode trunk [/font]
[font=Courier New]                        com(config)#interface gigabitethernet 2/2
                        com(config-if)#switchport
                        com(config-if)#switchport trunk encapsulation isl 配置中继协议 [/font]
[font=Courier New]                        com(config-if)#switchport mode trunk [/font]
[font=Courier New]                        com(config)#interface gigabitethernet 2/3
                        com(config-if)#switchport
                        com(config-if)#switchport trunk encapsulation isl 配置中继协议 [/font]
[font=Courier New]                        com(config-if)#switchport mode trunk [/font]
[font=Courier New]                            在分支交换机端配置如下: [/font]
[font=Courier New]                        par1(config)#interface gigabitethernet 0/1
                        par1(config-if)#switchport mode trunk [/font]
[font=Courier New]                        par2(config)#interface gigabitethernet 0/1
                        par2(config-if)#switchport mode trunk [/font]
[font=Courier New]                        par3(config)#interface gigabitethernet 0/1
                        par3(config-if)#switchport mode trunk [/font]
[font=Courier New]                        …… [/font]
[font=Courier New]                            此时,管理域算是设置完毕了。 [/font]
[font=Courier New]                            C、创建vlan一旦建立了管理域,就可以创建vlan了。 [/font]
[font=Courier New]                        com(vlan)#vlan 10 name counter 创建了一个编号为10 名字为counter的
                        vlan
                        com(vlan)#vlan 11 name market 创建了一个编号为11 名字为market的 vlan [/font]
[font=Courier New]                        com(vlan)#vlan 12 nam
                        e managing 创建了一个编号为12 名字为managing的 vlan [/font]
[font=Courier New]                        …… [/font]
[font=Courier New]                            注意,这里的vlan是在核心交换机上建立的,其实,只要是在管理域中的任何一台vtp
                        属性为server的交换机上建立vlan,它就会通过vtp通告整个管理域中的所有的交换机。但如果要将具体的交换机端口划入某个vlan,就必须在该端口所属的交换机上进行设置。 [/font]

[font=Courier New]                            D、将交换机端口划入vlan [/font]
[font=Courier New]                            例如,要将par1、par2、par3……分支交换机的端口1划入counter
                        vlan,端口2划入market vlan,端口3划入managing vlan…… [/font]
[font=Courier New]                        par1(config)#interface fastethernet 0/1 配置端口1
                        par1(config-if)#switchport access vlan 10 归属counter vlan [/font]

[font=Courier New]                        par1(config)#interface fastethernet 0/2 配置端口2
                        par1(config-if)#switchport access vlan 11 归属market vlan [/font]
[font=Courier New]                        par1(config)#interface fastethernet 0/3 配置端口3
                        par1(config-if)#switchport access vlan 12 归属managing
                        vlan [/font]
[font=Courier New]                        par2(config)#interface fastethernet 0/1 配置端口1
                        par2(config-if)#switchport access vlan 10 归属counter vlan [/font]

[font=Courier New]                        par2(config)#interface fastethernet 0/2 配置端口2
                        par2(config-if)#switchport access vlan 11 归属market vlan [/font]
[font=Courier New]                        par2(config)#interface fastethernet 0/3 配置端口3
                        par2(config-if)#switchport access vlan 12 归属managing
                        vlan [/font]
[font=Courier New]                        par3(config)#interface fastethernet 0/1 配置端口1
                        par3(config-if)#switchport access vlan 10 归属counter vlan [/font]

[font=Courier New]                        par3(config)#interface fastethernet 0/2 配置端口2
                        par3(config-if)#switchport access vlan 11 归属market vlan [/font]
[font=Courier New]                        par3(config)#interface fastethernet 0/3 配置端口3
                        par3(config-if)#switchport access vlan 12 归属managing
                        vlan [/font]
[font=Courier New]                        …… [/font]
[font=Courier New]                            E、配置三层交换 [/font]
[font=Courier New]                           
                        到这里,vlan已经基本划分完毕。但是,vlan间如何实现三层(网络层)交换呢?这时就要给各vlan分配网络(ip)地址了。给vlan分配ip地址分两种情况,其一,给vlan所有的节点分配静态ip地址;其二,给vlan所有的节点分配动态ip地址。下面就这两种情况分别介绍。 [/font]

[font=Courier New]                            假设给vlan
                        counter分配的接口ip地址为172.16.58.1/24,网络地址为:172.16.58.0,
                            vlan market
                        分配的接口ip地址为172.16.59.1/24,网络地址为:172.16.59.0,
                            vlan managing分配接口ip地址为172.16.60.1/24,
                        网络地址为172.16.60.0
                        ……
                            如果动态分配ip地址,则设网络上的dhcp服务器ip地址为172.16.1.11。 [/font]
[font=Courier New]                            (1)给vlan所有的节点分配静态ip地址。 [/font]
[font=Courier New]                           
                        首先在核心交换机上分别设置各vlan的接口ip地址。核心交换机将vlan做为一种接口对待,就象路由器上的一样,如下所示: [/font]

[font=Courier New]                        com(config)#interface vlan 10
                        com(config-if)#ip address 172.16.58.1 255.255.255.0
                        vlan10接口ip [/font]
[font=Courier New]                        com(config)#interface vlan 11
                        com(config-if)#ip address 172.16.59.1 255.255.255.0
                        vlan11接口ip [/font]
[font=Courier New]                        com(config)#interface vlan 12
                        com(config-if)#ip address 172.16.60.1 255.255.255.0
                        vlan12接口ip
                        …… [/font]
[font=Courier New]                           
                        再在各接入vlan的计算机上设置与所属vlan的网络地址一致的ip地址,并且把默认网关设置为该vlan的接口地址。这样,所有的vlan也可以互访了。 [/font]

[font=Courier New]                            (2)给vlan所有的节点分配动态ip地址。 [/font]
[font=Courier New]                            首先在核心交换机上分别[/font]
[font=Courier New]                            设置各vlan的接口ip地址和同样的dhcp服务器的ip地址,如下所示: [/font]
[font=Courier New]                        com(config)#interface vlan 10
                        com(config-if)#ip address 172.16.58.1 255.255.255.0
                        vlan10接口ip
                        com(config-if)#ip helper-address 172.16.1.11 dhcp server
                        ip [/font]
[font=Courier New]                        com(config)#interface vlan 11
                        com(config-if)#ip address 172.16.59.1 255.255.255.0
                        vlan11接口ip
                        com(config-if)#ip helper-address 172.16.1.11 dhcp server
                        ip [/font]
[font=Courier New]                        com(config)#interface vlan 12
                        com(config-if)#ip address 172.16.60.1 255.255.255.0
                        vlan12接口ip
                        com(config-if)#ip helper-address 172.16.1.11 dhcp server
                        ip
                        …… [/font]
[font=Courier New]                           
                        再在dhcp服务器上设置网络地址分别为172.16.58.0,172.16.59.0,172.16.60.0的作用域,并将这些作用域的“路由器”选项设置为对应vlan的接口ip地址。这样,可以保证所有的vlan也可以互访了。 [/font]

页: [1]

Powered by Discuz! Archiver 7.0.0  © 2001-2009 Comsenz Inc.