当前位置: 首页 > article >正文

安装和初始化 VyOS 虚拟机

目录

  • 安装和初始化 VyOS虚拟机
    • 1. 安装VyOS系统
      • (1)进入系统安装界面
    • 2. 登录VyOS系统
      • (1)安装 Image 镜像
      • (2)进入初始话设置
        • 文字描述
        • 重启系统
    • 3. 配置路由
    • 3.1 设置静态IP地址
    • 3.2 SSH端口设置
    • 3.3 删除网卡IP地址
    • 3.4 静态路由 / 默认路由
      • (1)设置静态路由 / 默认路由
      • (2)查看静态路由
    • 3.5 OSPF路由
      • (1)设置OSPF
      • (2)查看OSPF配置
      • (3)查看 OSPF 邻居
      • (4)将静态路由重分布到OSPF中
      • (5)将默认路由重分布到OSPF中
    • 3.6 BGP 路由
      • (1)配置EBGP
  • 参考资料

安装和初始化 VyOS虚拟机

备注:本文中所有的配置均符合NSX-T管理与配置系列博文中T0网关的设置。

1. 安装VyOS系统

(1)进入系统安装界面

默认选项,按回车 Enter

在这里插入图片描述

进入系统加载界面。

在这里插入图片描述在这里插入图片描述在这里插入图片描述

2. 登录VyOS系统

用户名和密码均为:vyos

(1)安装 Image 镜像

在 CLI 中输入 install image

在这里插入图片描述

(2)进入初始话设置

具体填写信息,参考如下图所示:

①: yes
②: 直接按 Enter 回车。
③: 直接按 Enter 回车。
④: yes
⑤: 直接按 Enter 回车。
⑥: 直接按 Enter 回车。
⑦: 自定义vyos密码。
⑧: 确认yvos密码。
⑨: 直接按 Enter 回车。
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

文字描述
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系统已经安装和初始化完成。

3. 配置路由

VyOS系统类似于Cisco的路由操作系统,但又不完全相同。

3.1 设置静态IP地址

IP地址拓扑:

网络接口IP地址
eth0192.168.1.10/24
eth11.1.1.1/24
eth22.2.2.1/24
vyos@vyos:~$ configure
[edit]
vyos@vyos# set interface ethernet eth0 address 192.168.1.10/24
[edit]
vyos@vyos# commit
[edit]
vyos@vyos# set interface ethernet eth0 address 1.1.1.1/24
[edit]
vyos@vyos# commit
[edit]
vyos@vyos# set interfaces ethernet eth2 address 2.2.2.1/24
[edit]
vyos@vyos# commit
[edit]
vyos@vyos# save
Saving configuration to '/config/config.boot'...
Done

3.2 SSH端口设置

vyos@vyos# set service ssh port '22'
[edit]
vyos@vyos# commit
[edit]
vyos@vyos# save
Saving configuration to '/config/config.boot'...
Done

在这里插入图片描述

3.3 删除网卡IP地址

现象:vyos的eth0网卡存在多个IP地址,需要将多余或错误配置的IP删除

在这里插入图片描述

vyos@vyos# delete interfaces ethernet eth0 address [按Tab]
Possible completions:
   192.168.1.10/24
   192.168.1.11/24
   192.168.10.60/24

[edit]
vyos@vyos# delete interfaces ethernet eth0 address 192.168.1.11/24
[edit]
vyos@vyos# delete interfaces ethernet eth0 address 192.168.10.60/24
[edit]
vyos@vyos# commit
[edit]
vyos@vyos# save
Saving configuration to '/config/config.boot'...
Done
[edit]
vyos@vyos#

验证

在这里插入图片描述

3.4 静态路由 / 默认路由

(1)设置静态路由 / 默认路由

vyos@vyos# set protocols static route 0.0.0.0/0 next-hop 192.168.1.21
[edit]
vyos@vyos# commit
[edit]
vyos@vyos# save
Saving configuration to '/config/config.boot'...
Done
[edit]

(2)查看静态路由

vyos@vyos# show protocols static

在这里插入图片描述

3.5 OSPF路由

(1)设置OSPF

vyos@vyos# set protocols ospf area 0  network 1.1.1.1/32
[edit]
vyos@vyos# commit
[edit]
vyos@vyos# save
Saving configuration to '/config/config.boot'...
Done
[edit]

(2)查看OSPF配置

vyos@vyos# show protocols ospf

在这里插入图片描述

(3)查看 OSPF 邻居

show ip ospf neighbor

在这里插入图片描述

(4)将静态路由重分布到OSPF中

vyos@vyos# edit protocols ospf
[edit protocols ospf]
vyos@vyos# set redistribute connected
[edit protocols ospf]
vyos@vyos# show
 area 0 {
     network 1.1.1.1/32
 }
+redistribute {
+    connected {
+    }
+}
[edit protocols ospf]
vyos@vyos# commit
[edit protocols ospf]
vyos@vyos# save
Saving configuration to '/config/config.boot'...
Done
[edit]
vyos@vyos#

(5)将默认路由重分布到OSPF中

vyos@vyos# edit protocols ospf
[edit protocols ospf]
vyos@vyos# set default-information originate always
[edit protocols ospf]

[edit protocols]
vyos@vyos# show
 ospf {
     area 0 {
         network 1.1.1.1/32
     }
     default-information {
         originate {
             always
         }
     }
     redistribute {
         connected {
         }
         static {
         }
     }
 }
 static {
     route 0.0.0.0/0 {
         next-hop 192.168.1.21 {
         }
     }
 }
[edit protocols]
vyos@vyos# commit
[edit protocols ospf]
vyos@vyos# save
Saving configuration to '/config/config.boot'...
Done
[edit]
vyos@vyos#

3.6 BGP 路由

(1)配置EBGP

set protocols bgp system-as 200
set protocols bgp neighbor 2.2.2.2 address-family ipv4-unicast
set protocols bgp neighbor 2.2.2.2 remote-as 100
vyos@vyos# commit
[edit]
vyos@vyos# save
Saving configuration to '/config/config.boot'...
Done
[edit]

在这里插入图片描述

参考资料

  • VyOS User Guide

http://www.kler.cn/news/160788.html

相关文章:

  • VUE2+THREE.JS 模型上方显示信息框/标签(CSS3DSprite精灵模型)
  • c++遍历算法的transform算法
  • Python-上下文管理器
  • Matlab 在一个文件中调用另一个文件中的函数
  • CMakeLists中下载github仓库代码和设置代理
  • 【华为OD题库-082】TLV解析II-Java
  • 备考六级day1
  • mybatis的分页插件
  • SCI论文——respectively用法
  • Vue3整合Element Plus过程
  • 创业6个月裤衩都赔掉了;2023生成式AI年度大事表;AI工程师的自我修养;LLM开发者成长计划;OpenAI LLM入门课程 | ShowMeAI日报
  • Stable Diffusion Automatic1111 Web UI和dreambooth扩展的安装教程
  • 艾泊宇产品战略:低价的战争:阿里、京东、拼多多的终局推演
  • ssm党务政务服务热线平台源码和论文答辩PPT
  • L0、Linux常用命令
  • Linux学习笔记2
  • 什么是 AOP,AOP 的作用是什么?
  • numpy实现神经网络
  • 软件工程之UML建模
  • RocketMq环境搭建
  • AC840. 模拟散列表
  • 软件开发测试系统的建立
  • docker安装informix
  • 大模型发展对教育领域的巨大影响
  • 企业管理平台知识体系构建
  • 2024年江苏省职业院校技能大赛 信息安全管理与评估 第二阶段教师组 (样卷)
  • 酷开科技两大方向提升OTT大屏营销能力
  • ios 逆向分分析,某业帮逆向算法(二)
  • 英伟达将在日本建立AI工厂网络
  • 【高数:2 数列的极限、函数的极限】