交换机的默认网管 (实现跨网段telnet)

拓扑图

完成交换机的基础配置(如何配置基础配置)后,为了能够实现跨网段管理交换机,要为交换机配置缺省网关

进入到交换机的全局配置模式,使用ip default-gateway来为交换机添加缺省网关


sw1(config)#ip default-gateway 192.168.1.254


sw1(config)#end

end 退出到特权模式然后保存配置

sw1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]

接下来为路由器进行配置

路由器的命令与交换机基本一致Router>

Router>enable                          进入特权模式

Router#configure terminal
                    进入全局配置模式


Enter configuration commands, one per line.  End with CNTL/Z.    


Router(config)#interface f0/1                   
进入到端口 f0/1 

Router(config-if)#ip address 192.168.1.254 255.255.255.0      给予IP地址

Router(config-if)#no shutdown                    打开端口
 
Router(config-if)#

%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
 
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up  
 
Router(config-if)#exit
 
Router(config)#interface fastEthernet 0/0               进入到端口 f0/0

Router(config-if)#ip address 192.168.0.254 255.255.255.0        给予IP地址
 
Router(config-if)#no shutdown                   打开端口 
 
Router(config-if)#

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
 
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
 
Router(config-if)#end                       退出到特权模式

Router#

%SYS-5-CONFIG_I: Configured from console by console
 
Router#write                           保存配置    (write命令等于交换机上的copy running-config  startup-config)

Building configuration...

[OK]
给计算机配置IP地址和网关

用ping命令来测试连通性

确认连通后便可用telnet跨网段连接交换机

原文地址:https://www.cnblogs.com/knightysa/p/9151063.html