在上图所示的拓扑中,Cloud1与交换机LSW1直连,我们将Cloud1规划在VLAN100内,同时也为交换机在VLAN100的虚拟接口规划了IP地址192.168.35.101/24。其中Cloud1添加的是虚拟机的虚拟网卡。
完成交换机的配置,使得物理机能够通过SSH的方式登录到该交换机。
cloud的配置如下:
SW1的配置如下:
创建VLAN100:
[SW1] vlan 100 [SW1-vlan100] quit
配置接口GE0/0/1:
[SW1] interface GigabitEthernet 0/0/1 [SW1-GigabitEthernet0/0/1] port link-type access [SW1-GigabitEthernet0/0/1] port default vlan 100
为交换机的Vlanif100配置IP地址:
[SW1] interface Vlanif 100 [SW1-Vlanif100] ip address 192.168.35.101 24
配置用于SSH登录的用户名(sshuser)、密码(huawei123):
[SW1] aaa [SW1-aaa] local-user client001 password cipher Huawei123 [SW1-aaa] local-user client001 privilege level 3 [SW1-aaa] local-user client001 service-type ssh [SW1-aaa] quit
在交换机上生成本地密钥对:
[SW1] rsa local-key-pair create The key name will be: SW_Host The range of public key size is (512 ~ 2048). NOTES: If the key modulus is greater than 512, it will take a few minutes. Input the bits in the modulus[default = 512]: Generating keys... ...++++++++++++ .++++++++++++ ..................++++++++ ......++++++++
激活Stelnet服务:
[SW] stelnet server enable [SW] ssh authentication-type default password [SW] ssh user client001 authentication-type password [SW] ssh user client001 service-type all
配置VTY(虚拟终端)界面,身份认证方式为AAA认证,允许用户以SSH的方式接入:
[SW] user-interface vty 0 4 [SW-ui-vty0-4] authentication-mode aaa [SW-ui-vty0-4] protocol inbound ssh
这样就完成了ssh远程登录交换机啦,是不是很简单呢