本文共 2949 字,大约阅读时间需要 9 分钟。
sw1(config)#int f0/0 #进接口
sw1(config-if)#ip add 12.0.0.1 255.255.255.0 #配置IP地址子网掩码网段sw1(config-if)#no shut #开启端口sw1(config-if)#int f1/0
sw1(config-if)#sw mo t sw1(config-if)#sw t en dot1q sw1(config-if)#ex 三层交换技术就是:二层交换技术+三层转发技术。它解决了局域网中网段划分之后,网段中子网必须依赖路由器进行管理的局面,解决了传统路由器低速、复杂所造成的网络瓶颈问题。sw1(config)#vlan 10,20 #添加VLAN 10,20
sw1(config)#int vlan 10 #进VLAN10 虚拟接口sw1(config-if)#ip add 192.168.11.1 255.255.255.0 #给VLAN10配置IP地址子网掩码sw1(config-if)#no shut #开启虚拟端口sw1(config-if)#int vlan 20sw1(config-if)#ip add 192.168.12.1 255.255.255.0sw1(config-if)#no shutsw1(config-if)#exsw1(config)#do show ip int bsw1(config)#do show ip int b #查看 端口 详细
Interface IP-Address OK? Method Status ProtocolFastEthernet0/0 12.0.0.1 YES manual up upVlan10 192.168.11.1 YES manual up up
Vlan20 192.168.12.1 YES manual up upsw1(config)#vtp do abc #创一个vtp 名称为abc
sw1(config)#vtp mo ser #服务器模Server 学习,转发,添加,删除,修改sw1(config)#vtp version 2 #配置VTP版本sw1(config)#vtp vtp pruning #配置VTP修剪sw1(config)#ip route 0.0.0.0 0.0.0.0 12.0.0.2 # 配置默认路由sw1(config)#do show ip rout # 查看路由表C 192.168.12.0/24 is directly connected, Vlan20C 192.168.11.0/24 is directly connected, Vlan1012.0.0.0/24 is subnetted, 1 subnetsC 12.0.0.0 is directly connected, FastEthernet0/0S* 0.0.0.0/0 [1/0] via 12.0.0.2sw2(config)#no ip routing
sw2(config)#vtp do abcsw2(config)#vtp version 2sw2(config)#vtp pruningsw2(config)#int f1/1sw2(config-if)#sw mo acc sw2(config-if)#sw acc vlan 10sw2(config-if)#int f1/2 sw2(config-if)#sw mo acc sw2(config-if)#sw acc vlan 20sw2(config)#do show vlan-sw dVLAN Name Status Ports1 default active Fa1/3, Fa1/4, Fa1/5, Fa1/6
Fa1/7, Fa1/8, Fa1/9, Fa1/10Fa1/11, Fa1/12, Fa1/13, Fa1/14Fa1/1510 VLAN0010 active Fa1/120 VLAN0020 active Fa1/21002 fddi-default act/unsup 1003 trcrf-default act/unsup 1004 fddinet-default act/unsup 1005 trbrf-default act/unsupR3(config)#int f0/1
R3(config-if)#ip add 192.168.8.1 255.255.255.0R3(config-if)#no shutR3(config)#int f0/0R3(config-if)#ip add 12.0.0.2 255.255.255.0R3(config-if)#no shutR3(config-if)#exR3(config)#ip route 192.168.11.0 255.255.255.0 12.0.0.1 #实现互联互通 因为在非直连网网段上要配置目的地网段下一跳网段R3(config)#ip route 192.168.12.0 255.255.255.0 12.0.0.1R3(config)#do show ip routCodes: C - connected, S - static, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2ia - IS-IS inter area, * - candidate default, U - per-user static routeo - ODR, P - periodic downloaded static routeGateway of last resort is not set
S 192.168.12.0/24 [1/0] via 12.0.0.1
C 192.168.8.0/24 is directly connected, FastEthernet0/1S 192.168.11.0/24 [1/0] via 12.0.0.112.0.0.0/24 is subnetted, 1 subnetsC 12.0.0.0 is directly connected, FastEthernet0/0转载于:https://blog.51cto.com/13660858/2113258