拓扑图
IP地址配置按拓扑图中配置
老二层交换机部分不支持路由协议,因此就按照第二种方法操作。
配置
从SW2 telnet 到R1有两种方法
1、交换机支持路由协议的情况
SW1:
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 192.168.99.0 0.0.0.255
network 192.168.12.0 0.0.0.255
interface Vlanif12
ip address 192.168.12.1 255.255.255.0
interface Vlanif99
ip address 192.168.99.1 255.255.255.0
interface GigabitEthernet0/0/1
port link-type access
port default vlan 12
interface GigabitEthernet0/0/2
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 99
#SW2:
ip route-static 0.0.0.0 0.0.0.0 192.168.99.1
ip route-static 192.168.12.1 255.255.255.255 192.168.99.1
ip route-static 192.168.99.100 255.255.255.255 192.168.12.1
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 99
interface Vlanif99
ip address 192.168.99.2 255.255.255.0
R1:
[R1]user-interface vty 0 4
[R1-ui-vty0-4]authentication-mode pas
[R1-ui-vty0-4]set authentication pas cipher 123
[R1-ui-vty0-4]user privilege le 15
[R1-ui-vty0-4]protocol inbound telnet
interface LoopBack1
ip address 192.168.99.100 255.255.255.255
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 192.168.12.0 0.0.0.255
network 192.168.99.0 0.0.0.255
interface Ethernet0/0/0
ip address 192.168.12.2 255.255.255.0
第一种情况适用于二层交换机性能较高,承受负担能力大,有需求(要通过二层交换机管理路由器)的话,可以使用第一种方法。
2、
SW2:二层交换机不支持路由协议的情况
从SW2开始
telnet 192.168.99.1
到达SW1
telnet 192.168.99.100
再到R1
效果
查看SW2路由表,思路下:
首先打通二层链路ping通SW1的管理IP
然后配置到达SW1出接口的静态路由
最后配置/32位掩码的静态路由(ip route-staitc 192.168.99.100 32 192.168.12.1)
在ping通的情况下telnet结果成功