ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

虚机安装vyOS使用Xshell连接

2019-07-10 17:01:25  阅读:360  来源: 互联网

标签:image vyOS vyos sda 虚机 Xshell Yes


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

首先咱们安装vyOS

1.安装vyOS

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

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

vyos@vyos:~$ install image
Welcome to the VyOS install program.  This script
will walk you through the process of installing the
VyOS image to a local hard drive.
Would you like to continue? (Yes/No) [Yes]: Yes
Probing drives: OK
Looking for pre-existing RAID groups...none found.
The VyOS image will require a minimum 2000MB root.
Would you like me to try to partition a drive automatically
or would you rather partition it manually with parted?  If
you have already setup your partitions, you may skip this step

Partition (Auto/Parted/Skip) [Auto]:

I found the following drives on your system:
 sda    4294MB

Install the image on? [sda]:

This will destroy all data on /dev/sda.
Continue? (Yes/No) [No]: Yes

How big of a root partition should I create? (2000MB - 4294MB) [4294]MB:

Creating filesystem on /dev/sda1: OK
Done!
Mounting /dev/sda1...
What would you like to name this image? [1.2.0-rolling+201809210337]:
OK.  This image will be named: 1.2.0-rolling+201809210337
Copying squashfs image...
Copying kernel and initrd images...
Done!
I found the following configuration files:
    /opt/vyatta/etc/config.boot.default
Which one should I copy to sda? [/opt/vyatta/etc/config.boot.default]:

Copying /opt/vyatta/etc/config.boot.default to sda.
Enter password for administrator account
Enter password for user 'vyos':
Retype password for user 'vyos':
I need to install the GRUB boot loader.
I found the following drives on your system:
 sda    4294MB

Which drive should GRUB modify the boot partition on? [sda]:

Setting up grub: OK
Done!
vyos@vyos:~$

最后重启系统:

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

2.配置vyOS可通过SSH连接

2.1 进入配置模式

vyos@vyos$ configure
vyos@vyos#

2.2 配置网络接口

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

2.3 启用ssh

vyos@vyos# set service ssh port '22'

2.4 保存改动

vyos@vyos# commit
vyos@vyos# save

3. 配置Xshell连接

3.1 获取连接ip

接着2.4的操作:

vyos@vyos# exit
vyos@vyos$ sudo ifconfig 
eth0      Link encap:Ethernet  HWaddr 08:00:27:40:ac:ef  
          inet addr:你需要复制的地址  Bcast:XXX.XXX.XXX.XXX  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe40:acef/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2425 errors:0 dropped:0 overruns:0 frame:0
          TX packets:185 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:237660 (232.0 KiB)  TX bytes:19908 (19.4 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:30910 errors:0 dropped:0 overruns:0 frame:0
          TX packets:30910 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          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了!

标签:image,vyOS,vyos,sda,虚机,Xshell,Yes
来源: https://www.cnblogs.com/laolieren/p/connect_xyOS_with_Xshell_through_ssh.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有