当前位置:   article > 正文

VyOS安装和配置_vyos图形界面

vyos图形界面

VyOS是基于Linux的网络操作系统,可提供基于软件的网络路由,防火墙和VPN功能。

VyOS项目于2013年底开始,是Vyatta Core 6.6R1 的GPL部分的社区分支, 目的是维护一个自由和开源的网络操作系统,以响应终止Vyatta社区版本的决定。在这里,每个人都喜欢学习,老一辈的经理和新用户。

VyOS主要基于Debian GNU / LinuxQuagga路由引擎。其配置语法和CLI大致是从XORP项目建模的Juniper JUNOS派生而来的,该 项目是Vyatta的原始路由引擎。

在Vyatta 4.0版本中,路由引擎已更改为Quagga。从VyOS 1.2版开始,VyOS现在使用FRRouting作为路由引擎。

VyOS与任何其他路由器发行版和平台有何不同?

  • VyOS不仅仅是防火墙和VPN,还包括OSPFv2,OSPFv3,BGP,VRRP等扩展的路由功能,以及广泛的路由策略映射和过滤
  • 硬件路由器样式的统一命令行界面。
  • 可编写脚本的CLI
  • 有状态的配置系统:准备更改并立即提交或丢弃,查看先前的修订或回滚,将修订存档到远程服务器并在提交时执行挂钩
  • 基于映像的升级:将多个版本保留在同一系统上,如果出现问题,则还原为以前的映像
  • 多种VPN功能:OpenVPN,IPSec,Wireguard,DPMVPN,IKEv2等
  • DHCP,TFTP,mDNS中继器,广播中继和DNS转发支持
  • IPv4和IPv6均支持
  • 在物理和虚拟平台上均可运行:小型x86板,大型服务器,KVM,Xen,VMware,Hyper-V等
  • 完全免费和开源,带有文档化的内部API和构建过程
  • 社区驱动。欢迎使用补丁程序,所有代码,错误和夜间构建均可公开访问

     

  • 要安装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!

    安装完成后,取出实时CD并重新引导系统:

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

     

    vyos 基础配置

     

    1 基本配置

    1. #配置外网接口
    2. set interfaces ethernet eth0 address 10.0.1.32/24
    3. set interfaces ethernet eth0 description public
    4. #配置内网接口
    5. set interfaces ethernet eth1 address 192.168.100.1/24
    6. set interfaces ethernet eth1 description private
    7. #指定静态路由
    8. set protocols static route 0.0.0.0/0 next-hop 10.0.1.1 distance 1
    1. #启动ssh服务器
    2. set service ssh port 29922
    3. #设置主机名
    4. set system host-name vyos-master
    5. #设备时区
    6. set system time-zone Asia/Shanghai
    1. #提交修改
    2. commit
    3. #保存到启动文件
    4. save
    5. Saving configuration to '/config/config.boot'...
    6. #回退
    7. rollback

    2 NAT

    1. Source NAT
    2. 1 The internal IP addresses we want to translate
    3. 2 The outgoing interface to perform the translation on
    4. 3 The external IP address to translate to
    5. # 内网开放访问外网权限
    6. set nat source rule 100 outbound-interface eth0
    7. set nat source rule 100 source address 192.168.100.0/24
    8. set nat source rule 100 translation address masquerade
    9. # 不使用防火墙外网地址,指派特定外网ip 10.0.1.100
    10. set interfaces ethernet eth0 address 10.0.1.100/24
    11. set nat source rule 100 outbound-interface eth0
    12. set nat source rule 100 source address 192.168.100.0/24
    13. set nat source rule 100 translation address 10.0.1.100
    14. # 内网主机数量大时,使用地址池,推荐每256台主机分配1个外网地址
    15. ......
    16. set nat source rule 100 translation address 10.0.1.101-10.0.1.132
    17. # NAT Reflection 这个没搞懂是做什么用的?
    18. set nat source rule 110 description 'NAT Reflection: INSIDE'
    19. set nat source rule 110 destination address 192.168.100.0/24
    20. set nat source rule 110 outbound-interface eth1
    21. set nat source rule 110 source address 192.168.100.0/24
    22. set nat source rule 110 translation address masquerade
    1. Destination NAT
    2. 1 The interface traffic will be coming in on
    3. 2 The protocol and port we wish to forward
    4. 3 The IP address of the internal system we wish to forward traffic to
    5. 端口映射
    6. # 10.0.1.100:80 -> 192.168.100.101:80
    7. set nat destination rule 10 description 'Port Forward: 10.0.1.100:80 to 192.168.100.101:80'
    8. set nat destination rule 10 inbound-interface eth0
    9. set nat destination rule 10 destination address 10.0.1.100
    10. set nat destination rule 10 destination port 80
    11. set nat destination rule 10 protocol tcp
    12. set nat destination rule 10 translation address 192.168.100.101
    13. set nat destination rule 10 translation port 80
    14. # 10.0.1.100:29922 -> 192.168.100.101:22
    15. set nat destination rule 20 description 'Port Forward: 10.0.1.100:29922 to 192.168.100.101:22'
    16. set nat destination rule 20 inbound-interface eth0
    17. set nat destination rule 20 destination address 10.0.1.100
    18. set nat destination rule 20 destination port 29922
    19. set nat destination rule 20 protocol tcp
    20. set nat destination rule 20 translation address 192.168.100.101
    21. set nat destination rule 20 translation port 22
    22. # 注意防火墙要增加规则放行22, 80的通讯
    23. ip映射
    24. set interfaces ethernet eth0 address 10.0.1.200/24
    25. # 10.0.1.200 -> 192.168.100.102
    26. set nat destination rule 30 description 'NAT 1 to 1: 10.0.1.200 to 192.168.100.102'
    27. set nat destination rule 30 inbound-interface eth0
    28. set nat destination rule 30 destination address 10.0.1.200
    29. set nat destination rule 30 translation address 192.168.100.102
    30. set nat source rule 30 description 'NAT 1 to 1: 10.0.1.200 to 192.168.100.102'
    31. set nat source rule 30 outbound-interface eth1
    32. set nat source rule 30 source address 192.168.100.102
    33. set nat source rule 30 translation address 10.0.1.200

    3 FIREWALL

    1. # public区域包含外网接口,private区域包含内网接口,
    2. set zone-policy zone public interface eth0
    3. set zone-policy zone private interface eth1
    4. # 防火墙所有端口禁ping
    5. set firewall all-ping disable
    6. # 防火墙初始策略
    7. # 默认丢弃所有包
    8. set firewall name private-public default-action drop
    9. # private -> public 方向的防火墙策略
    10. # 规则1 匹配成功的请求,允许建立与关联
    11. set firewall name private-public rule 1 action accept
    12. set firewall name private-public rule 1 state established enable
    13. set firewall name private-public rule 1 state related enable
    14. # 规则2 匹配失败的请求,记录日志
    15. set firewall name private-public rule 2 action drop
    16. set firewall name private-public rule 2 log enable
    17. set firewall name private-public rule 2 state invalid enable
    18. # 规则9999 匹配失败的请求,记录日志
    19. set firewall name private-public rule 9999 action drop
    20. set firewall name private-public rule 9999 log enable
    21. # 规则100 允许ping
    22. set firewall name private-public rule 100 action accept
    23. set firewall name private-public rule 100 log enable
    24. set firewall name private-public rule 100 protocol icmp
    25. # 规则200 允许http https
    26. set firewall name private-public rule 200 action accept
    27. set firewall name private-public rule 200 destination port 80,443
    28. set firewall name private-public rule 200 log enable
    29. set firewall name private-public rule 200 protocol tcp
    30. # 规则300 允许22(ssh), 29922
    31. set firewall name private-public rule 300 action accept
    32. set firewall name private-public rule 300 destination port 22,29922
    33. set firewall name private-public rule 300 log enable
    34. set firewall name private-public rule 300 protocol tcp
    35. # 规则200 允许来自10.0.1.0/24的dns请求
    36. set firewall name private-public rule 600 action accept
    37. set firewall name private-public rule 600 destination port 53
    38. set firewall name private-public rule 600 log enable
    39. set firewall name private-public rule 600 protocol tcp_udp
    40. set firewall name private-public rule 600 source address 10.0.1.0/24
    41. # private-public规则集作用于从private到public的访问,效果是允许ping外网ip,允许到外网80,443的请求,允许来自10.0.1.0/24子网到外网的dns请求
    42. set zone-policy zone public from private firewall name private-public
    43. # public -> private方向的防火墙策略
    44. set firewall name public-private default-action drop
    45. set firewall name public-private rule 1 action accept
    46. set firewall name public-private rule 1 state established enable
    47. set firewall name public-private rule 1 state related enable
    48. set firewall name public-private rule 2 action drop
    49. set firewall name public-private rule 2 log enable
    50. set firewall name public-private rule 2 state invalid enable
    51. # 规则100 允许80, 443, 22, 29922的请求
    52. set firewall name public-private rule 100 action accept
    53. set firewall name public-private rule 100 destination port 80,443,22,29922
    54. set firewall name public-private rule 100 log enable
    55. set firewall name public-private rule 100 protocol tcp
    56. set firewall name public-private rule 9999 action drop
    57. set firewall name public-private rule 9999 log enable
    58. # public-private规则集作用于从public到private的访问,允许到内网映射端口80,443,22,29922的访问,如ssh -p 29922 10.0.1.100, http://10.0.1.100
    59. set zone-policy zone private from public firewall name public-private

     

    ====================== End

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

闽ICP备14008679号