loading ...
loading...

2008-07-19 | Cisco交换机的部分命令解析

分享
一、交换机五种模式
Swith>                                     (用户模式)
Swith#                                      (特权模式)
Swith(config)#                            (全局配置模式)
Swith(config-if)#                             (接口模式)
Swith(config-line)#                         (线模式)

二、交换机模式切换
Swith>enable                         //切换到特权
Swith#config t                        //切换到全局配置模式
Swith(config)# interface f0/1             //进入接口f0/0
Swith(config)# interface vlan 1            //进入VLAN 1中
Swith(config-if)#ip address 192.168.1.1 255.255.255.0 //对VLAN1设置IP地址和子网掩码
Swith(config-if)#no shutdown            //激活VLAN1

三、设置交换机的密码
1、用户到特权的密码
Swith(config)#enable password 123   (优先级低)
Swith(config)#enable secret 456      (优先级高) //如果两个都设置则456生效

2、控制台console密码设置
Swith(config)# line con 0
Swith(config-line)#login
Swith(config-line)#password console123    //设置console密码为telnet123

3、启用telnet密码
Swith(config)#line vty 0 15    //最多有0~15人可以telnet访问swith,合计16人
Swith(config-line)#login
Swith(config-line)#password telnet123 //设置telnet密码为telnet123
注:要想真正生效telnet还要设置特权密码

三、交换机命名hostname BENETSW01
Swith(config)#hostname BENETSW01            //使用hostname命名交换机的名字

四、show命令集
Swith#show version               //显示IOS版本信息
Swith#show int vlan 1 brief         //简单的显示VLAN1的信息
Swith#show running-config         //显示正在运行的配置文件
Swith#show startup-config          //显示己经保存的配置文件
Swith#show mac-address-table       //显示MAC地址表
Swith#show mac-address-table       //显示MAC地址表更新的间隔,默认为5分钟
Swith#show neighbor detail          //显示邻居详细信息
Swith#show traffic                  //显示CDP流量
Swith#show
五、设置交换机的网关和DNS名称服务器的IP地址
Swith(config)# ip default-gateway 192.168.10.8       //交换机的网关设置为192.168.10.8
Swith(config)#ip domain -name server 202.106.0.20 //设置DNS名称服务器地址
Swith(config)# no ip domain-lookup            //交换机名称服务器的域名查询



六、创建、删除、查看VLAN
Switch#vlan database    //进入vlan数据库配置模式
Switch(vlan)#vlan 2     //创建VLAN2命名为vlan0002,也可以使用vlan2 name sales
VLAN 2 added:
    Name: VLAN0002
Switch(vlan)#exit         //退出时应用生效
Swith(vlan)#no vlan 2     //删除vlan2

Switch(config)# interface f0/1
Switch(config-if)# switchport access vlan 2     //将端口加入vlan 2中
Switch(config-if)# no switchport access vlan 2   //将端口从vlan2中删除

Switch(config)# interface range f0/1 – 10   // 进行F0/1到10端口范围
Switch(config-if-range)# switchport access vlan 2 //将f0/1到f0/10之间的所有端口加入vlan 2

Switch# show vlan brief                //查看所有VLAN的摘要信息
Switch# show vlan id vlan-id        //查看指定VLAN的信息


七、开启并查看trunk端
Swith(config)#interface f0/24
Swith(config-if)#swith mode trunk    //将f0/24端口设置为trunk

Switch#show interface f0/24 switchport //查看f0/24的接口状态

八、从Trunk中添加、删除Vlan
Switch (config-if )# switchport trunk allowed vlan remove 3   //从trunk端口删除v lan3通过
Switch (config-if)# switchport trunk allowed vlan add 3     //从trunk端口添加vlan3通过
Switch # show interface interface-id switchport           //检查中继端口允许VLAN的列表

九、单臂路由配置
Router(config)# interface f0/0.1
Router(config-subif)# encapsolution dot1q 1         //子接口封装dot1q 针对的是VLAN1
Router(config-subif)# ip address 192.168.1.1 255.255.255.0 //设置VLAN的网关地址

Router(config)# interface f0/0.2
Router(config-subif)# encapsolution dot1q 2    //子接口封装dot1q针对的是vlan2
Router(config-subif)# ip address 192.168.2.1 255.255.255.0 //设置vlan2的网关的地址
分享 分享 |  评论 (0) |  阅读 (?)  |  固定链接 |  类别 (cisco) |  发表于 19:56  | 最后修改于 2008-07-19 19:57
搜狐博客温馨提示:搜狐博客官方不会要求参加活动的各位博友缴纳任何的手续费用。请勿轻信留言、评论中的中奖信息,更不要拨打陌生电话及向陌生帐户汇款,谨防受骗!识别更多网络骗术,请 点击查看详情
您还未登录,只能匿名发表评论。或者您可以 登录 后发表。
 
  *中国人爱国心,搜狗输入法爱国主题皮肤下载>>
表  情:
加载中...
回复通知: 同时用小纸条通知对方该回复