网络基础Cisco路由交换一

VLAN概述

Virtual LAN(虚拟局域网)是物理设备上链接的不受物理位置限制的用户的一个逻辑组,。

引用VLAN:

交换机分割了冲突域,但是不能分割广播域,随着交换机端口数量的增多,网络中广播增多,降低了网络的效率,为了分割广播域,引入了VLAN。

VLAN的优点:

广播控制。

宽带利用。

延迟降低。

安全提高。

VLAN种类:

静态VLAN:基于端口划分的静态VLAN。

动态VLAN:基于MAC地址划分的动态VLAN。

 

交换机配置文件在bangong#show running-config 这个文件里

 

查看mac地址表:

bangong#show mac-address-table

 

 

查看交换机系统版本:

bangong#show version

 

默认控制台会话时间为10分钟,导致用户配置一半需要重新进入

可以配置控制台会话时间永不超时:

bangong#configure terminal
bangong(config)#line console 0
bangong(config-line)#exec-timeout 0 0
bangong(config-line)#

 

输出日志消息自动弹出,打断输入:

bangong(config)#line console 0(进入console口)
bangong(config-line)#logging synchronous(输出日志同步)

 

当输错命令时,交换机会让你等待:

bangong(config)#no ip domain-lookup(禁用域名解析就不会等待了)

 

cdp协议,查看邻居Cisco设备的信息(可以检查网络拓扑):

service#show cdp neighbors detail(查看邻居Cisco设备的详细信息)

 

 

配置交换机console口令:

ceshi1#configure terminal (进入全局配合模式)
ceshi1(config)#line console 0(进入console口,默认只有一个,就console0)
ceshi1(config-line)#password 123456(设置密码)
ceshi1(config-line)#login(注册)

 

配置交换机特权密码:

ceshi1>enable (先进入特权模式)
ceshi1#configure terminal (进入全局配置模式)
ceshi1(config)#enable password 123456(设置特权用户密码为123456,明文状态)

。。。。

ceshi1>enable (先进入特权模式)
ceshi1#configure terminal (进入全局配置模式)

ceshi1(config)# enable secret 123456(设置密文密码)

 

查看特权密码:

ceshi1#show running-config
Building configuration...

。。。。。。。。。。
enable secret 5 $1$mERr$H7PDxl7VYMqaD3id4jJVK/(密文)
enable password 123456(明文)

 

配置VLAN两种方法:

Switch#vlan database (进入vlan数据库)

Switch(vlan)#vlan 2 name xxx(创建vlan2 并改名字为xxx)

————————————————————

Switch(config)#vlan 3(创建vlan 3)

Switch(config-vlan)#name x(改名字为x)

 

删除vlan:

Switch#vlan database (进入vlan数据库 或者Switch(config)# no vlan2(全局变量直接删除))

Switch(vlan)#no vlan 2(删除vlan2)

 

批量接口加入vlan:

Switch(config)#interface range f0/1 - 2(选中1.2端口号)

Switch(config-if-range)#switchport access vlan 3(把1.2端口接入vlan3)

 

接口加入vlan:

Switch(config)#interface fastEthernet 0/1(进入1号接口)

Switch(config-if)#switchport access vlan 2(把1号接口配置进vlan2)

 

Trunk中继链接:

实现跨交换机之间的vlan通信

中继链路可以承载多个vlan

Vlan的标识:

ISL(cisco私有的标记方法)

ISL外部封装头部26个字节,尾部4个字节,共30个字节

IEEE 802.1q(公有的标记方法)

内部封装在标准以太网帧内插入了4个字节,其中12位vlan标识。

ISL和802.1q异同:

同:都是显示了vlan的信息。

异:

IEEE 802.1q是公有的标记方法,ISL是cisco私有的。

ISL采用外部标记的方法,802.1q采用内部标记的方法。

ISL标记的长度为30个字节,8021q标记的长度为4字节。

 

 

接口的工作模式:

service#show interfaces fastEthernet 0/24  (查看以太网第24口的双工模式和通信速率)
FastEthernet0/24 is down, line protocol is down (disabled)
  Hardware is Lance, address is 0001.63a9.1b18 (bia 0001.63a9.1b18)
 BW 100000 Kbit, DLY 1000 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA, loopback not set
  Keepalive set (10 sec)
  Full-duplex, 100Mb/s

service(config-if)#duplex  {full   half   auto }  full全双工    half半双工   auto自动协调   指定接口的双工模式

  测试:service(config-if)#duplex auto (先进入24接口,配置为自动协调)

 

service(config-if)#speed {10  100  1000 auto } 指定接口通信速率

  测试:service(config-if)#speed auto(先进入24接口,配置为自动协调)

 

查看以太网接口的双工模式和通信速率:

service#show interfaces fastEthernet 0/24(查看第24口)
FastEthernet0/24 is down, line protocol is down (disabled)
  Hardware is Lance, address is 0001.63a9.1b18 (bia 0001.63a9.1b18)
 BW 100000 Kbit, DLY 1000 usec,
     reliability 255/255, txload 1/255, rxload 1/

 

Trunk配置

Switch(config)#interface fastEthernet 0/15(进入0/15接口)

Switch(config-if)#switchport mode trunk (配置为trunk模式)

 

Switch(config)#interface fastEthernet 0/15 (进入0/15接口) 

Switch(config-if)#switchport mode dynamic desirable (配置为动态企望)

 

Switch(config)#interface fastEthernet 0/15 (进入0/15接口)

Switch(config-if)#switchport mode dynamic auto(动态自动)

 

在trunk链路上移除某个vlan:

Switch(config-if)#(进入接口)

Switch(config-if)#switchport trunk allowed vlan remove 2(中继链路不允许传送vlan2的数据)

 

在teunk链路上添加某vlan:

Switch(config-if)#(进入接口)

Switch(config-if)#switchport trunk allowed vlan add 2(添加vlan2

查看接口模式:

Switch#show interfaces f0/5 switchport (查看5号端口)

 

以太网通道:

也称为以太端口捆绑,端口聚集或以太链路聚集,英文名EtherChannel,

以太网通道为交换机提供了端口捆绑技术,允许两个交换机之间通过连个或多个端口并行链接,同时传输数据,以提高更高的带宽。

多线条负载均衡,当一条线路失效时,其他线路通信,不会丢包,

以太网通道的配置:

Switch(config)#interface range f0/x - x(选中x-x的端口)

Switch(config-if-range)#switchport mode trunk (将端口配置为trunk模式)

Switch(config-if-range)#channel-group 1 mode on(开启通道)

 

 

在路由器上配置DHCP服务

Router(config)#

Router(config)#ip dhcp pool hydra(定义一个地址池)

Router(dhcp-config)#network 192.168.1.0 255.255.255.0(动态分配ip地址段)

Router(dhcp-config)#default-router 192.168.1.254(动态分配网关地址)

Router(dhcp-config)#dns-server 202.106.0.20(动态分配DNS服务器地址,次命令后可以跟多个备用的DNS地址)

Switch(config)#ip dhcp excluded-address 192.168.1.1(预留已静态分配的ip地址)

posted @ 2017-05-26 09:18  Hydraxx  阅读(637)  评论(0编辑  收藏  举报