在交換機上配置VLAN

Switch>                                              //用戶模式
Switch>enable                                        //進入特權模式
Switch#                                             
Switch#config terminal                              //進入全局配置模式
Switch(config)#hostname Benet1                      //設置主機名
Benet1(config)#enable password ciscoswitch          //設置enable口令
Benet1(config)#exit                                 //退出到特權模式
Benet1#
Benet1#show running-config                          //查看信息(看是否配置正確?)
----------------------------------
Benet1#config terminal                              //進入全局配置模式
Benet1(config)#enable secret cisco                  //設置enable密碼
Benet1(config)#exit                                 //退出到特權模式
Benet1#
Benet1#show running-config                          //查看信息(看是否配置正確?)  
----------------------------------
Benet1#config terminal                              //進入全局配置模式
Benet1(config)#line console 0                       //進入line模式
Benet1(config-line)#password 123                    //設置console密碼
Benet1(config-line)#login                           //登錄激活
Benet1(config-line)#exit                            //退出到特權模式
Benet1(config)#exit
Benet1#
Benet1#show running-config                         //查看信息(看是否配置正確?)
----------------------------------
Benet1#config terminal                                 //進入全局配置模式
Benet1(config)#interface vlan 1                        //進入接口配置模式
Benet1(config-if)#ip address 172.16.1.1 255.255.0.0   //配置IP地址和掩碼
Benet1(config-if)#no shutdown                          //激活
Benet1(config-if)#                                    
Benet1(config-if)#exit                                //退出全局配置模式
Benet1(config)#ip default-gateway 172.16.1.100        //配置網關
Benet1(config)#exit                                   //退出到特權模式
Benet1#show running-config                             //查看信息(看是否配置正確?)
----------------------------------
Benet1#vlan database                                   //進入VLAN數據庫
Benet1(vlan)#vlan 2                                    //添加VLAN2
VLAN 2 added:
    Name: VLAN0002
Benet1(vlan)#vlan 2 name v2                            //將VLAN2命名
VLAN 2 modified:
    Name: v2
Benet1(vlan)#vlan 3 name v3                           //添加vlan3並將VLAN3命名
VLAN 3 added:
    Name: v3
Benet1(vlan)#exit                                     //退出到特權模式
----------------------------------
Benet1#config terminal                               //進入全局配置模式
Benet1(config)#interface range f0/2 - 8              //設置接口範圍
Benet1(config-if-range)#switchport access vlan 2     //設置接口屬於VLAN2
Benet1(config-if-range)#interface range f0/9 - 12     //設置接口範圍
Benet1(config-if-range)#switchport access vlan 3      //設置接口屬於VLAN3
Benet1(config-if-range)#end                           //退回到特權模式
Benet1#
----------------------------------
Benet1#                                             
Benet1#show running-config                           //查看信息(看是否配置正確?)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章