Juniper-Ex系交换,VLAN配置

说明:EX交换机除了具有二层VLAN功能之外,还具有三层VLAN路由功能。

EX交换机会有一个名字为vlan的三层逻辑端口,这个三层逻辑端口可以划分多个逻辑unit单元,unit号范围是(0..16385),而每个逻辑unit单元可以配置IP地址然后跟一个VLAN绑定,实际上unit 单元号和VLAN号没有对应关系,但是为了维护方便,我们建议在实际应用中unit单元号和vlan号配置相同(如下面的vlan.10中的10是unit单元号,它实际上可以跟VLAN 20绑定,但是在实际中最好将它和vlan 10绑定),这样在EX上就可以配置不同VLAN的网关地址了。

例如下面交换机划分了3个VLAN,每个VLAN对应的网关IP分别配置在vlan.10 、vlan.20以及vlan.30端口(跟Cisco的interface vlan10和interface vlan20,interface vlan30效果一样的)。


一、添加/修改VLAN

如果创建一个名字为liy_vlan的VLAN 10,并且网关设置为192.168.1.1/24,ge-0/0/1属于该VLAN。

配置步骤:

(1)创建VLAN

#编辑vlan信息liy_vlan是vlan名字,如果不存在则新建一个VLAN

[email protected]# edit vlans liy_vlan    #"以下所有操作都是对liy_vlan进行"

[edit vlans liy_vlan]

[email protected]# set vlan-id 10   #"设置liy_vlan的vlan id"

[email protected]# set description "Server VLAN"    #"设置vlan描述"

[email protected]# set mac-limit 200  #"设置mac数量,范围是(1..65535),通常不配置"

[email protected]# set mac-table-aging-time 600 #"设置mac生存时间(秒),范围是(60-1000000) "

[email protected]# set l3-interface vlan.10  #"将绑定三层逻辑子端口"

[email protected]# set interface ge-0/0/1.0  #"将端口加入到VLAN中"

[email protected]# set interface ge-0/0/2.0  #"将端口加入到VLAN中"


(2)创建三层逻辑子端口

[email protected]# top   #"回到最外层菜单"

[edit]

[email protected]# set interfaces vlan unit 10 family inet address 192.168.1.1/24


(3)将交换机端口修改为access模式并加入到新创建的VLAN中

[email protected]# top   #"回到最外层菜单"

[edit]

[email protected]# set interfaces ge-0/0/1  unit 0 family ethernet-switching port-mode access

[email protected]# set interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members 10

[email protected]# set interfaces ge-0/0/2  unit 0 family ethernet-switching port-mode access

[email protected]# set interfaces ge-0/0/2 unit 0 family ethernet-switching vlan members 10


(4)commit提交:

[email protected]#commit

二、删除VLAN

由于一个VLAN创建之后,会被端口引用,可能还创建了三层端口,因此在删除vlan的时候需要把端口引用关系接触同时删除三层vlan子端口,删除步骤如下:

1.删除端口vlan

[email protected]# top  

[edit]

[email protected]# delete interfaces ge-0/0/1  unit 0 family ethernet-switching port-mode access

[email protected]# delete interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members 10

[email protected]# delete interfaces ge-0/0/2  unit 0 family ethernet-switching port-mode access

[email protected]# delete interfaces ge-0/0/2 unit 0 family ethernet-switching vlan members 10


2.删除vlan对应的L3子端口

[email protected]# top  

[edit]

[email protected]# delete interfaces vlan unit 10


3.接着删除vlan配置

[email protected]# top  

[edit]

[email protected]# delete vlans liy_vlan


转载自:http://mtonet.com/?p=268

添加新评论 »