当前位置:   article > 正文

使用Xshell连接虚机安装的vyOS

vmwore安装vyos

1518406-20190710170705494-1366636849.png

本文主要讲解:使用虚机(Vitual Box)安装的vyOS,如何使用Xshell来通过ssh方式连接。

首先咱们安装vyOS

1.安装vyOS

先用Vitual Box安装vyOS镜像。
接下来的操作其实官网教程讲的很清楚了,基本就是一路默认往下点就可以。

主要就是执行这条语句install image

  1. vyos@vyos:~$ install image
  2. Welcome to the VyOS install program. This script
  3. will walk you through the process of installing the
  4. VyOS image to a local hard drive.
  5. Would you like to continue? (Yes/No) [Yes]: Yes
  6. Probing drives: OK
  7. Looking for pre-existing RAID groups...none found.
  8. The VyOS image will require a minimum 2000MB root.
  9. Would you like me to try to partition a drive automatically
  10. or would you rather partition it manually with parted? If
  11. you have already setup your partitions, you may skip this step
  12. Partition (Auto/Parted/Skip) [Auto]:
  13. I found the following drives on your system:
  14. sda 4294MB
  15. Install the image on? [sda]:
  16. This will destroy all data on /dev/sda.
  17. Continue? (Yes/No) [No]: Yes
  18. How big of a root partition should I create? (2000MB - 4294MB) [4294]MB:
  19. Creating filesystem on /dev/sda1: OK
  20. Done!
  21. Mounting /dev/sda1...
  22. What would you like to name this image? [1.2.0-rolling+201809210337]:
  23. OK. This image will be named: 1.2.0-rolling+201809210337
  24. Copying squashfs image...
  25. Copying kernel and initrd images...
  26. Done!
  27. I found the following configuration files:
  28. /opt/vyatta/etc/config.boot.default
  29. Which one should I copy to sda? [/opt/vyatta/etc/config.boot.default]:
  30. Copying /opt/vyatta/etc/config.boot.default to sda.
  31. Enter password for administrator account
  32. Enter password for user 'vyos':
  33. Retype password for user 'vyos':
  34. I need to install the GRUB boot loader.
  35. I found the following drives on your system:
  36. sda 4294MB
  37. Which drive should GRUB modify the boot partition on? [sda]:
  38. Setting up grub: OK
  39. Done!
  40. vyos@vyos:~$

最后重启系统:

  1. vyos@vyos:~$ reboot
  2. Proceed with reboot? (Yes/No) [No] Yes

2.配置vyOS可通过SSH连接

2.1 进入配置模式

  1. vyos@vyos$ configure
  2. vyos@vyos#

2.2 配置网络接口

  1. vyos@vyos# set interfaces ethernet eth0 address dhcp
  2. vyos@vyos# set interfaces ethernet eth0 description 'OUTSIDE'

2.3 启用ssh

vyos@vyos# set service ssh port '22'

2.4 保存改动

  1. vyos@vyos# commit
  2. vyos@vyos# save

3. 配置Xshell连接

3.1 获取连接ip

接着2.4的操作:

  1. vyos@vyos# exit
  2. vyos@vyos$ sudo ifconfig
  3. eth0 Link encap:Ethernet HWaddr 08:00:27:40:ac:ef
  4. inet addr:你需要复制的地址 Bcast:XXX.XXX.XXX.XXX Mask:255.255.255.0
  5. inet6 addr: fe80::a00:27ff:fe40:acef/64 Scope:Link
  6. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
  7. RX packets:2425 errors:0 dropped:0 overruns:0 frame:0
  8. TX packets:185 errors:0 dropped:0 overruns:0 carrier:0
  9. collisions:0 txqueuelen:1000
  10. RX bytes:237660 (232.0 KiB) TX bytes:19908 (19.4 KiB)
  11. lo Link encap:Local Loopback
  12. inet addr:127.0.0.1 Mask:255.0.0.0
  13. inet6 addr: ::1/128 Scope:Host
  14. UP LOOPBACK RUNNING MTU:65536 Metric:1
  15. RX packets:30910 errors:0 dropped:0 overruns:0 frame:0
  16. TX packets:30910 errors:0 dropped:0 overruns:0 carrier:0
  17. collisions:0 txqueuelen:0
  18. RX bytes:1865376 (1.7 MiB) TX bytes:1865376 (1.7 MiB)

你如果直接把上面的ip地址复制进入Xshell连接配置的主机(H)栏,大概率是连不上虚机中的vyOS的,
在进行接下来的操作之前,我们还需要修改虚机的桥接模式

3.2 修改虚机桥接模式

选择vyOS虚机,右键 > 设置 > 网络 > 网卡1 > 连接方式 > 选择桥接网卡
修改虚机桥接模式

执行完上面操作后,咱们再次获取连接ip,操作同3.1

3.3 再次获取连接ip

将获取到的ip填入到Xshell连接配置的主机(H)栏。账号密码都是安装vyOS时候设置的。即vyos

这样一来,就OK了!

转载于:https://www.cnblogs.com/laolieren/p/connect_xyOS_with_Xshell_through_ssh.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/777462
推荐阅读
相关标签
  

闽ICP备14008679号