交换机实验、VLAN创建

这篇博客详细记录了一次VLAN配置的实验过程,包括连接路由器、配置路由器和交换机的IP地址,以及在R1和R2路由器间的ARP报文交互。此外,还介绍了如何在交换机中创建VLAN,以及三层交换机的配置,强调了在同一广播域内设备间通信的条件,并探讨了VLAN技术的应用和工作原理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

2018-7-16

连接路由器

配置两台PC机的IP地址 处于不同网段

 

配置路由器

Router>en
Router#
Router#conf t
Router(config)#int fa0/0                       //定义0/0接口
Router(config-if)#ip add 192.168.1.254 255.255.255.0
Router(config-if)#no sh 
Router(config-if)#int fa0/1                    //定义0/1接口
Router(config-if)#ip add 192.168.2.254 255.255.255.0
Router(config-if)#no sh                        //激活接口
Router(config-if)#do wr
Router(config-if)#do show ip rou               //显示所有IP路由
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

C    192.168.1.0/24 is directly connected, FastEthernet0/0      //路由表
C    192.168.2.0/24 is directly connected, FastEthernet0/1

配置路由器R1 ip:192.168.1.1/24

R1#conf t
R1(config)#int g0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#do wr
Building configuration...
[OK]

配置路由器R2 IP:192.168.1.2/24

Router>en
Router#conf t
Router(config)#no ip domain lookup 
Router(config)#line console 0
Router(config-line)#no exec-timeout 
Router(config-line)#logg synchronous 
Router(config-line)#exit
Router(config)#do wr
Building configuration...
[OK]
Router(config)#int g0/0
Router(config-if)#ip address 192.168.1.2 255.255.255.0
Router(config-if)#no sh
Router(config-if)#do wr

配置交换机

Switch>en
Switch#conf t
Switch(config)#ho Sw1
Sw1(config)#no ip domain lookup 
Sw1(config)#line c 0
Sw1(config-line)#no exec-timeout 
Sw1(config-line)#logg s
Sw1(config-line)#exit
Sw1(config)#do wr

在R1路由器pingR2路由器

R1#ping 192.168.1.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 0/0/0 ms

R1显示ARP报文

R1#show arp 
Protocol  Address          Age (min)  Hardware Addr   Type   Interface
Internet  192.168.1.1             -   00D0.BCCA.5601  ARPA   GigabitEthernet0/0
Internet  192.168.1.2             0   0090.2B30.6C01  ARPA   GigabitEthernet0/0
  • 源IP地址:192.168.1.1
  • 源MAC地址:00D0.BCCA.56501
  • 目的IP地址:192.168.1.2
  • 目的MAC地址:0090.2B30.6C01

R2显示ARP报文

Router#SHOW ARp 
Protocol  Address          Age (min)  Hardware Addr   Type   Interface
Internet  192.168.1.1             4   00D0.BCCA.5601  ARPA   GigabitEthernet0/0
Internet  192.168.1.2             -   0090.2B30.6C01  ARPA   GigabitEthernet0/0

交换机中显示ARP报文

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

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

   1    0090.2b30.6c01    DYNAMIC     Fa0/2
   1    00d0.bcca.5601    DYNAMIC     Fa0/1

*如果是PC,查看ARP表项: arp -a


C:\Users\Grind>arp -a

接口: 192.168.42.51 --- 0x2
  Internet 地址         物理地址              类型
  192.168.42.129        9e-b0-36-97-f4-71     动态
  192.168.42.255        ff-ff-ff-ff-ff-ff     静态
  224.0.0.22            01-00-5e-00-00-16     静态
  224.0.0.252           01-00-5e-00-00-fc     静态
  255.255.255.255       ff-ff-ff-ff-ff-ff     静态

 搭建三PC连接统一交换机

Switch#conf t
Enter configuration comma
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值