交换机的基本配置

实验环境

如拓扑图所示:

 实验需求

1.观察交换机的MAC地址表

1.1首先,我们在不进行任何操作的情况下观察MAC地址表看看,利用到的代码如下:

//首先我们要先进入特权模式
Switch> enable
Switch#
Switch#show mac address-table             //查看MAC表
          Mac Address Table
-------------------------------------------

Vlan    Mac Address       Type        Ports
----    -----------       --------    -----

   1    0060.7058.7b01    DYNAMIC     Fa0/3

我们发现,与我们的拓扑图中两个交换机的连接线是存在与MAC中的,而其余与PC端连接的网线是没有出现的,这时候我们开始进行下一步操作。

1.2首先进入PC端的终端模式,做以下代码操作:

​​C:\>ping 192.168.1.254

我们在PC端ping我们另一台主机的ip地址然后我们再输入上述查看MAC的代码

看看效果如何:

Switch#show mac address-table 
          Mac Address Table
-------------------------------------------

Vlan    Mac Address       Type        Ports
----    -----------       --------    -----

   1    0002.1770.131e    DYNAMIC     Fa0/2
   1    0010.11ca.e3d4    DYNAMIC     Fa0/1
   1    0060.7058.7b01    DYNAMIC     Fa0/3
Switch#

我们发现,新添加了几条线路,就是我们两台PC的线路,如此,我们可以判断,交换机是通过学习来记录以下线路的MAC和Ports

2.配置接口的双工模式及速率,观察交换机的提示

首先我们进入交换机的配置环境,自适应模式下协商为双工模式,网速为100mb,如代码所示:

在注释为n个1的地方即使协商为双工模式,网速为100mb

Switch#show interfaces fastEthernet 0/24
FastEthernet0/24 is down, line protocol is down (disabled)
  Hardware is Lance, address is 0060.2f28.b618 (bia 0060.2f28.b618)
 BW 100000 Kbit, DLY 1000 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA, loopback not set
  Keepalive set (10 sec)
  Half-duplex, 100Mb/s          //111111111111111111111111111111111111111111111111111111
  input flow-control is off, output flow-control is off
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 00:00:08, output 00:00:05, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue :0/40 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     956 packets input, 193351 bytes, 0 no buffer
     Received 956 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     0 watchdog, 0 multicast, 0 pause input
     0 input packets with dribble condition detected
     2357 packets output, 263570 bytes, 0 underruns

Switch#

我们通过调配第一个交换机的模式来看看会有什么影响,注释全为1的是我们的观察重点,如代码所示:

//首先我们进入接口0/24
Switch#show interfaces fastEthernet 0/24
FastEthernet0/24 is down, line protocol is down (disabled)
  Hardware is Lance, address is 0060.2f28.b618 (bia 0060.2f28.b618)
 BW 100000 Kbit, DLY 1000 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA, loopback not set
  Keepalive set (10 sec)
  Half-duplex, 100Mb/s                 //1111111111111111111111111111111111111111111
  input flow-control is off, output flow-control is off
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 00:00:08, output 00:00:05, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue :0/40 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     956 packets input, 193351 bytes, 0 no buffer
     Received 956 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     0 watchdog, 0 multicast, 0 pause input
     0 input packets with dribble condition detected
     2357 packets output, 263570 bytes, 0 underruns

Switch#

我们发现,当第二个路由器是auto,自适应的时候,路由器改为半双工模式下,0/24的接口也会变为半双工,我们将第二个路由器改为双工模式试试看看,代码与上述类似,就展示部分重要代码了,如代码所示:

Switch(config-if)#duplex full 

然后我们返回拓扑图进行观察,就会发现接口处变成了红色,也就是通信失败,如图所示:

完结-------------------------------------

  • 15
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值