cisco通过控制口或者通过远程配置交换机

时间:2024-01-21 20:23:45

学而不思则罔,思而不学则殆,每天坚持一小步,则成功一大步

下面我们通过Cisco Packet来模拟交换机和路由器的远程和控制台登录配置交换机。

交换机console口的连接与配置方法

(1),在Cisco Packet下选择一台计算机,交换机

(2),通过控制线连接电脑的com口和交换机的console口

(3),打开计算机的terminal,然后可以通过计算机进入交换机,然后就可以开始配置了。

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAW8AAADXCAIAAABasEfvAAAQuUlEQVR4nO3dSWxbd37AcRk99dRbgfYwPRQF2mIWoJc56NhrC/TaBTOXAgJazAQNCgwymU7jiWN5iWVqsSeS7SRjJ3EdJ5ZkS7QWihRFSpS4PVKLxUULSS0kte+LZer1QC1cJYp60nt87/vB/2CLpGk+/94X73FzmQgAUiiT+y8AQCWoCQBpUBMA0qAmAKRBTQBIg5oAkAY1ASANagJAGtQEgDSoCQBpUBMA0qAmAKRBTQBIg5oAkAY1ASANagJAGtQEgDSoCQBpUBMA0qAmUJvE/r4rFK03Cw1m4UGP50GP56HF+9DiTf4650peId/SddrrzcJDa9qf8IXV+1m38LOvW+V+uApCTaAqG7tvX3mCtV3OWqOrzui6b3LXdjkr9X1V7QP3jK66XKu2y3lD31vZmmPdet13tdl8v6v/2svua696agyO2i5nbZfzM5O7xuD8u9tf/vjmI7kfsYJQE6hHfHXjK9twbZezrstZ1THwcYvlg+8MV5tMN1vNH74wVur7rrf2pq5PWns/be+/qe+72mTUtfdWtVlT19323l8/b+seHRNFMbay/pnJXtnaW2d0fWZyVxscP7rxedkvrv/k0y/lftAKQk2gEv7YYr1ZSB476DodN1st3zuGxuILG7u7XW/Gq9qsd9qtVVnr4+ZuXaf9gTnzZOdz6+DtNtvnPa6R2fmX3uBDi7fe7EmmpKrT/sMbj8p+eb3s/VvUJBU1QclL7O/bxqeTHUmuaoOjvlvoG5+Jr23qh8Ybejx/6BvKXo/7hhrMQl2XM3m+k1x1Rled0V1ndN3tGLhvct/tt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NkTeHkBq3Vw7P+cb14MBvYSCVEUN3ffmv1h02i42xe2BiJN3kDb6Ljcjx6Qn3pqAkBe1ASANKgJAGmouyZBXfmVYxX6fJekX3bCzfUVV7KU6/gWNkDUQE2O93V9xeGOr6/IaEDa9U69+cHvcgYI0C4N1eSwAOlZOPPNc/wGgKilmgR15Vcq9HmPQwq9+QFqAmRSfU2ynt84oSbHV09eI9fND1ATIJPqa5JdjmLPdDL/EGoCpNFgTZKHHJmHGqc+C5uOmgCZtFiTg0sKeoWYmgCFUndNAFweagJAGtQEgDSoCQBpUBMA0qAmAKShtZqc/VPFmW+QBZCbBmtypk8Vp3w8p/D30AKapOmanP6p4rSrn+HzgoAGabkmBXyqmJoABdNgTc74qWJqAhRGgzU5y6eKqQlQMGpy8NM8nyrmWVigUNQk5RJeIQbOQWs1AXBRqAkAaVATANKgJgCkQU0ASIOaAJAGNQEgDWoCQBrUBIA0qAkAaVATANKgJgCkQU0ASIOaAJAGNQEgDWoCQBrUBIA0qAkAaVATANL4fxHrTp89ipTSAAAAAElFTkSuQmCC" alt="" />

下面是配置代码

Switch>en
Switch#config
Switch#configure
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#line co
Switch(config)#line console 0
Switch(config-line)#pa
Switch(config-line)#pas
Switch(config-line)#password cisco
Switch(config-line)#login
Switch(config-line)#exit
Switch(config)#exit

通过这样配置之后打开终端,进入交换机必须输入密码才能进入。

下面通过配置交换机,实现远程登录交换机

Switch(config)#line vty 0 4
Switch(config-line)#pa
Switch(config-line)#pas
Switch(config-line)#password cisco
Switch(config-line)#login
Switch(config-line)#exit
Switch(config)#int vlan 1
Switch(config-if)#ip ad
Switch(config-if)#ip address 192.168.1.254 255.255.255.0
Switch(config-if)#exit

这时候用网线连交换机上,再把计算机上的IP地址设置为192.168.1.0-254 任意一个IP地址,并且说明远程和网关没有关系。为什么交换机要在vlan1下配置IP地址呢?不可以在其他vlan下配置IP地址吗?其实我想告诉的是,可以配置的。原因是因为所有端口默认都是只允许vlan1通过,所以只能在当前vlan下配置。

路由器配置console登录和交换机一样,可以按照前面的配置去做。

具体看一下telnet的配置为什么不一样?

Router(config)#int fa0/0
Router(config-if)#ip ad
Router(config-if)#ip address 192.168.2.1 255.255.255.0
Router(config-if)#exit
Router(config)#
Router(config)#li
Router(config)#line vty 0 4
Router(config-line)#pa
Router(config-line)#pas
Router(config-line)#password cisco
Router(config-line)#login
Router(config-line)#exit

和交换机不同的是必须在接口上配置IP地址,因为路由器具有路由功能,而交换机只要vlan三层接口具有路由功能。