此任务在 SEFOS 中配置静态路由条目并验证通信是否可到达整个网络。
有关此任务的拓扑,请参见Routing Feature Topology。
SEFOS-1# configure terminal SEFOS-1(config)# set gvrp disable SEFOS-1(config)# set gmrp disable SEFOS-1(config)# end SEFOS-1# show vlan device info Vlan device configurations -------------------------- Vlan Status : Enabled Vlan Oper status : Enabled Gvrp status : Disabled Gmrp status : Disabled Gvrp Oper status : Disabled Gmrp Oper status : Disabled
set gvrp disable 和 set gmrp disable 命令禁用这些协议。show vlan device info 命令显示 VLAN 配置信息。
SEFOS-1# configure terminal SEFOS-1(config)# interface vlan 1 SEFOS-1(config-if)# no ip address SEFOS-1(config-if)# exit SEFOS-1(config)# vlan 10 SEFOS-1(config-vlan)# exit SEFOS-1(config)# interface range xl-ethernet 0/25-26 SEFOS-1(config-if-range)# switchport access vlan 10 SEFOS-1(config-if-range)# no shutdown SEFOS-1(config-if-range)# exit SEFOS-1(config)# interface vlan 10 SEFOS-1(config-if)# shut SEFOS-1(config-if)# ip address 10.0.0.201 255.255.255.0 SEFOS-1(config-if)# no shutdown SEFOS-1(config-if)# end
VLAN 1 的默认 IP 地址是 10.0.0.1,VLAN 10 的 IP 地址是 10.0.0.201。因此,必须先删除 VLAN 1 的 IP 地址,然后才能为 VLAN 10 添加 IP 地址。
SEFOS-1# ping 10.0.0.169
SEFOS-1# ping 10.0.0.152
# ping 10.0.201 10.0.201 is alive # ping 10.0.0.152 10.0.0.152 is alive #
SEFOS-2# configure terminal SEFOS-2(config)# interface vlan 1 SEFOS-2(config-if)# no ip address SEFOS-2(config-if)# exit SEFOS-2(config)# vlan 40 SEFOS-2(config-vlan)# exit SEFOS-2(config)# interface range xl-ethernet 0/25-26 SEFOS-2(config-if-range)# shutdown SEFOS-2(config-if-range)# switchport access vlan 40 SEFOS-2(config-if-range)# no shutdown SEFOS-2(config-if-range)# exit SEFOS-2(config)# interface vlan 40 SEFOS-2(config-if)# shutdown SEFOS-2(config-if)# ip address 40.0.0.200 255.255.255.0 SEFOS-2(config-if)# no shutdown SEFOS-2(config-if)# end SEFOS-2#
SEFOS-2# ping 40.0.0.110 SEFOS-2# ping 40.0.0.118
使用两台交换机上的端口 1 到 2。
SEFOS-1# configure terminal SEFOS-1(config)# interface range xl-ethernet 0/1-2 SEFOS-1(config-if-range)# switchport access vlan 20 SEFOS-1(config-if-range)# no shutdown SEFOS-1(config-if-range)# exit SEFOS-1(config)# interface vlan 20 SEFOS-1(config-if)# shutdown SEFOS-1(config-if)# ip address 20.0.0.201 255.255.255.0 SEFOS-1(config-if)# no shutdown SEFOS-1(config-if)# end SEFOS-1#
SEFOS-2# configure terminal SEFOS-2(config)# interface range xl-ethernet 0/1-2 SEFOS-2(config-if-range)# switchport access vlan 20 SEFOS-2(config-if-range)# no shutdown SEFOS-2(config-if-range)# exit SEFOS-2(config)# interface vlan 20 SEFOS-2(config-if)# shutdown SEFOS-2(config-if)# ip address 20.0.0.200 255.255.255.0 SEFOS-2(config-if)# no shutdown SEFOS-2(config-if)# end SEFOS-2# ping 20.0.0.201
现在可以将此配置用作不同路由器配置的起点。
SEFOS-1# write startup-config Building configuration _ [OK]
SEFOS-2# write startup-config Building configuration _ [OK]
交换机在重新引导时将使用保存的配置启动。
SEFOS-1# show ip route Codes: C - connected, S - static, R - rip, B - bgp, O - ospf C 10.0.0.0/24 is directly connected, vlan10 C 20.0.0.0/24 is directly connected, vlan20 SEFOS-1#
SEFOS-2# show ip route Codes: C - connected, S - static, R - rip, B - bgp, O - ospf C 20.0.0.0/24 is directly connected, vlan20 C 40.0.0.0/24 is directly connected, vlan40 SEFOS-2#
如果没有从 SEFOS-1 到主机 B 的已知路由,则从主机 A 对主机 B 执行的 ping 命令将失败。
SEFOS-1# configure terminal SEFOS-1(config)# ip route 40.0.0.0 255.255.255.0 20.0.0.200 SEFOS-1(config)# end
SEFOS-2# configure terminal SEFOS-2(config)# ip route 10.0.0.0 255.255.255.0 20.0.0.201 SEFOS-2(config)# end
SEFOS-1# show ip route Codes: C - connected, S - static, R - rip, B - bgp, O - ospf C 10.0.0.0/24 is directly connected, vlan10 C 20.0.0.0/24 is directly connected, vlan20 S 40.0.0.0/24 [-1] via 20.0.0.200
SEFOS-2# show ip route Codes: C - connected, S - static, R - rip, B - bgp, O - ospf S 10.0.0.0/24 [-1] via 20.0.0.201 C 20.0.0.0/24 is directly connected, vlan20 C 40.0.0.0/24 is directly connected, vlan40