
路由器交换机配置.pdf
26页根据 5IJSJ 教程制作 作者:流浪狗 1 一、一、 交换机的基本配置与管理交换机的基本配置与管理 exit:返回上一级操作模式 end:从全局以下级别直接返回特权模式 reload:特权模式下重启交换机 speed、duplex:端口视图下设置速度和双工 hostname:全局模式下修改交换机名称 通过通过 console 口配置交换机:口配置交换机: Switch> Switch>enable Switch#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#interface fastEthernet 0/1 Switch(config-if)#speed ? 10 Force 10 Mbps operation 100 Force 100 Mbps operation auto Enable AUTO speed configuration Switch(config-if)#speed 100 Switch(config-if)#duplex ? auto Enable AUTO duplex configuration full Force full duplex operation half Force half-duplex operation Switch(config-if)#duplex full Switch(config-if)#end Switch# Switch#show version „„„„ 二、二、 交换机交换机 telnet 远程登录配置远程登录配置 全局模式下输入 enable password ******, 设置进入特权模式的密码; 全局模式下输入 line vty 0 4、password ******设置远程登录密码。
拓扑图:用配置线和直通线连接一台 PC 机和交换机 根据 5IJSJ 教程制作 作者:流浪狗 2 1、配置交换机、配置交换机 Switch>en Switch#conf t Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#hostname zou //设置交换机名称 zou(config)#int vlan 1 //interface vlan 1 zou(config-if)#ip address 192.168.1.1 255.255.255.0 //设置交换机 ip zou(config-if)#no shutdown //开启端口 /*/* 在路由器在路由器 telnettelnet 配置中,应对路由器与配置中,应对路由器与 pcpc 连接的端口进行连接的端口进行 ipip 地址的配置,如:地址的配置,如: int int fa 0/0fa 0/0 ip add 192.168.1.1 255.255.255.0ip add 192.168.1.1 255.255.255.0 no shutdownno shutdown */*/ zou(config-if)#exit zou(config)#enable password 123456 //设置进入特权模式的密码为 123456 zou(config)#line vty 0 4 zou(config-line)#password zouxiaobo //设置远程登录密码为 zouxiaobo zou(config-line)#login zou(config-line)#end 2、配置、配置 pc 机机 PC 机的 ip 需与交换机 ip 在同一网段(192.168.1.0) ,网关为交换机 ip 3、测试、测试结果结果 根据 5IJSJ 教程制作 作者:流浪狗 3 三、三、 交换机划分交换机划分 vlan 配置配置 相同 VLAN 内的主机可以相互直接通信, 不同 VLAN 间的主机之间互相访问必须经由路由设备进行转 发。
广播数据包只可以在本 VLAN 内进行广播,不能传输到其他 VLAN 中 1、、 设置设置 PC 机机 ip 地址、子网掩码、默认网关地址、子网掩码、默认网关 PC1:192.168.1.2 255.255.255.0 192.168.1.1 PC2:192.168.1.3 255.255.255.0 192.168.1.1 PC3:192.168.1.4 255.255.255.0 192.168.1.1 PC4:192.168.1.5 255.255.255.0 192.168.1.1 2、、 配置配置 switch1 和和 switch2 交换机交换机 Switch>en Switch#conf t Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#vlan 2 Switch(config-vlan)#exit Switch(config)#vlan 3 根据 5IJSJ 教程制作 作者:流浪狗 4 Switch(config-vlan)#exit Switch(config)#int fa 0/1 Switch(config-if)#switchport access vlan 2 Switch(config-if)#exit Switch(config)#int fa 0/2 Switch(config-if)#switchport access vlan 3 Switch(config-if)#exit Switch(config)#int fa 0/24 Switch(config-if)#switchport mode trunk %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to up Switch(config-if)#end Switch# %SYS-5-CONFIG_I: Configured from console by console Switch#show vlan „„ 2 VLAN0002 active Fa0/1 3 VLAN0003 active Fa0/2 „„ 3、、 测试结果测试结果 相同 vlan 的 Pc 能相互 ping 通,不同 vlan 的 pc 则不能 ping 通。
四、四、 利用三层交换机实现利用三层交换机实现 vlan 间路由间路由 1、、 设置设置 PC 机机 ip 地址、子网掩码、默认网关地址、子网掩码、默认网关 Pc1: 192.168.1.2 255.255.255.0 192.168.1.1 Pc2: 192.168.2.2 255.255.255.0 192.168.2.1 Pc3: 192.168.1.3 255.255.255.0 192.168.1.1 2、、 设置二层交换机设置二层交换机 Switch>en Switch#conf t Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#vlan 2 Switch(config-vlan)#exit Switch(config)#vlan 3 Switch(config-vlan)#exit 根据 5IJSJ 教程制作 作者:流浪狗 5 Switch(config)#int fa 0/2 Switch(config-if)#switchport access vlan 2 Switch(config-if)#int fa 0/3 Switch(config-if)#switchport access vlan 3 Switch(config-if)#int fa 0/1 Switch(config-if)#switchport mode trunk 3、、 设置三层交换机设置三层交换机 Switch>en Switch#conf t Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#vlan 2 Switch(config-vlan)#exit Switch(config)#vlan 3 Switch(config-vlan)#exit Switch(config)#int fa 0/1 Switch(config-if)#switchport mode trunk Switch(config)#int fa 0/2 Switch(config-if)#switchport access vlan 2 Switch(config-if)#int vlan 2 //配置虚接口配置虚接口 %LINK-5-CHANGED: Interface Vlan2, changed state to upSwitch(config-if)# %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan2, changed state to up Switch(config-if)#ip address 192.168.1.1 255.255.255.0 //pc1 网关网关 Switch(config-if)#no shutdown Switch(config-if)#int vlan 3 //配置虚接口配置虚接口 %LINK-5-CHANGED: Interface Vlan3, changed state to upSwitch(config-if)# %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan3, changed state to up Switch(config-if)#ip address 192.168.2.1 255.255.255.0 //pc2 网关网关 Switch(config-if)#no shutdown Switch(config-if)#end 4、、 测试结果测试结果 分属于 vlan2 和 vlan3 之间的 pc 能相互 ping 通。
五、五、 快速生成树配置快速生成树配置 1、、 设置设置 PC 机机 ip 地址、 子网掩码、地址、 子网掩码、根据 5IJSJ 教程制作 作者:流浪狗 6 默认网关默认网关 Pc1:192.168.1.2 255.255.255.0 192.168.1.1 Pc2:192.168.1.3 255.255.255.0 192.168.1.1 2、、 对对 switch1 和和 switch2 做同样配置做同样配置 Switch>en Switch#conf t Enter configuration commands, one per line. End w。
