电脑技术学习

思科路由交换命令总结

dn001

  「基础配置」

  进入console口进行本地配置用户模式 xx>enable n特权模式 xx#configure terminal全局配置模式 xx(config)#interface [f|s] n/m进入接口配置模式xx(config-if)#

  进入(子)接口模式后配置IP(config-if)#ip addr A.B.C.D 子网掩码激活接口(config-if)#no shutdown配置速度(config-if)#speed {auto|10|100}配置接口工作模式(config-if)#duplex {auto|half|full}配置时钟(串行口DCE端)

  (config-if)#clock rate n反向操作(删除配置)

  no + 命令在换回接口上配多个ip(config-if)#ip addr A.B.C.D 子网掩码(config-if)#ip addr A.B.C.D 子网掩码 secondary查看所有配置#show running-config

  路由器关闭路由功能充当主机(config)#no ip routing为路由器设置网关(config)#ip default-gateway ip地址

  改机器名字(config)#hostname yy控制线路超时(config)#line n(config-line)#exec-timeout 0 0关闭域名解析功能(config)#no ip domain-lookup开启路由器http功能(config)#ip http server(config)#username xxx password yyy(config)#username xxx secret yyy(config)#enable secret yyy启用密码加密服务(config)#service password-encryption yyy开启路由器https功能(config)#ip http secure-server开启路由器远程登录功能(config)#line vty 0 4(config)#login local或者(config)#no login(config)#enable n登录时使用命令 telnet A.B.C.D

  「交换机」

  查看mac地址表#show mac-address-table绑定静态mac地址(config)#mac-address-table static H.H.H vlan n interface fx/x #show arp在主机上使用arp -a查看arp信息开启交换机端口安全(防止连接主机恶意发送随机mac填满mac地址表)

  (conifg)#switchport port-security(conifg)#switchport ?

  #show port-security int fx/x恢复(config)#errdisable recovery

  为交换机vlan1配置管理ip(conifg)#int vlan 1(config-if)#ip addr A.B.C.D 子网掩码(config-if)#no shut

  「交换机vlan」

  查看vlan #show vlan-switch或是#show vlan创建vlan #vlan database(vlan)#vlan n将端口加入到vlan中(config-if)#switchport access vlan n给允许多个vlan的接口打trunk(config-if)#switchport mode trunk

  「单臂路由vlan」

  路由器上配置子接口实现不同vlan之间通信,先必须激活其父接口,另外IP不允许重复(config)#interface fx/x.x(config-subif)#encapsulation dot1q vlan-id(config-subif)#ip addr A.C.D.E 子网掩码(config-subif)#no shut

  「使用三层交换机交换虚拟接口」

标签: