VyOS--企業軟路由推薦

分類:IT技術 時間:2016-10-07

  今天給大家推薦一個好用的開源路由操作系統---VyOS,也是我個人非常喜歡的一款軟路由器。VyOS 是基於 Debian GNU/linux 的,提供了和其他諸如cisco的IOS、Juniper的JUNOS類似的操作方式,配置起來感覺特別的舒服,尤其可以使用compare、rollback之類的命令,方便對比配置和錯誤回滾,深得我心。

 由於之前用的Mikrotik RouterOS,在使用過程中逐漸發現了一些其性能和穩定性上的弊端,所以逐漸轉向了VyOS,聽一個資深linux老司機說,他曾經對VyOS進行過單純的流量壓力測試,一臺VyOS虛機打到800M的流量沒有任何壓力。當然RouterOS提供了winbox之類的客戶端管理工具,非常容易上手,如果沒有特殊需求,完全夠用。

一、簡介

  VyOS的前身是Vyatta,是Vyatta系統的社區fork版本;Vyatta公司在2002年提供了開源版本的虛擬路由,後來被博科收購。Vyatta是博通的企業級的產品,linux下知名的開源路由器項目,在其官方的測試中性能甚至超過了cisco 7200系列路由器,可以支持RIP、OSPF、BGP等路由協議以及VPN、NAT、HA等特性。企業路由的所有功能基本都支持,還支持虛擬機。

  VyOS這個項目的第一個版本釋放於2013年,目前還在持續活躍中。相對其他項目——像Juniper管理下的opencontrail,它有完整的使用與安裝文檔,更提供了API文檔供開發者參考(這點也是我喜歡這個操作系統的原因之一)。可以用它來實現軟件防火墻、路由器、vpn等功能。

二、特性

1、平臺支持

  • 32-bit x86

  • 64-bit x86

  • KVM (virtio drivers included)

  • Xen HVM (including XenServer and EC2)

  • VMWare (open-vm-tools included)

  • Hyper-V (drivers included)

  • VirtualBox (guest additions not included)、

    (默認情況下支持串口的終端是啟用的)

2、路由

  • BGP (IPv4 and IPv6)

  • OSPFv2

  • OSPFv3 (incomplete)

  • RIP

  • RIPng

  • Policy-based routing

3、網絡接口

  • Ethernet

  • 802.1q VLAN, QinQ

  • NIC bonding

  • Bridges, STP (no RSTP or other extensions)

  • Port mirroring and redirection

  • Dummy interfaces (analogous to multiple loopbacks)

  • Pseudo-ethernet (aka MAC VLAN)

  • 802.11 wireless (client and access point)

  • Some wireless modems (not very good support)

  • PPPoE

Note: No support for serial WAN, ISDN, dial-up, DSL cards. Use an external device for that.

4、防火墻與NAT

  • Stateful firewall

  • Network/address/port groups (IPv4 only for now)

  • Zone-based firewall

  • Source and destination NAT

5、VPN

  • Site-to-site IPsec (with pre-shared key or x.509 authentication)

  • VTI (Virtual Tunnel Interfaces)

  • OpenVPN (client, server, site-to-site)

  • GRE, IPIP, IPIP6, IP6IP6 tunnels

  • VXLAN

  • Unmanaged L2TPv3

  • L2TP/IPsec and PPTP remote access VPN

  • DMVPN (experimental)

6、網絡服務

  • DHCP server and relay

  • Caching DNS server

  • Web proxy with some URL filtering support (no HTTPS filtering)

  • Telnet and SSH for remote management

  • IGMP proxy

  • QoS support

7、高可用

  • VRRP (IPv4 only for now)

  • Conntrack sync

  • WAN failover and load balancing

8、IPV6支持

  • IPv6 routing (static and dynamic)

  • Router advertisment

  • DHCPv6 client and server/relay

  • IPv6 firewall

9、系統維護和監控

  • Task scheduler

  • SNMP

  • Configuration versioning and remote archiving

  • Event handling

  • Remote syslog

其他特性詳見鏈接:http://vyos.net/wiki/Feature_list

三、安裝

  官方推薦的配置是,2G磁盤空間,512M內存。其硬件要求很小,2G磁盤完全夠用,如果不放心可以增加其內存的配置。比較好的一點,它提供了一種基於鏡像的安裝方式,這使得在同一機器上存在多個版本的軟件成為可能,方便版本升級。

  下載地址:http://packages.vyos.net/iso/release/選擇你需要的版本,當前最新版本號1.1.7,另外其也提供了OVA的格式,可以直接部署到vmware等平臺上。這裏說下iso鏡像安裝方式,wiki上也有詳細的安裝手冊:http://vyos.net/wiki/User_Guide

  掛盤之後,進系統引導,會看到如下的界面,默認的用戶名/密碼是:vyos/vyos

wKioL1dp86bDkrWPAADRY-DVpTc631.png-wh_50

  這裏有兩種安裝方式:install image和install system,推薦使用install image方式:

運行install image安裝:

vyos@vyos:~$ install image

wKioL1dp9RTQb_pbAACwoOAl1eo773.png-wh_50

安裝過程很簡單,基本一路回車用默認配置即可,中間需要配置vyos用戶的密碼,安裝成功後用的就是vyos這個用戶進行系統配置:

wKiom1dp9avBGYGYAACVzax_taI839.png-wh_50

提示Setting up grub:OK,即安裝成功,之後卸載CDROM,reboot重啟之後就可以進行系統配置:

wKiom1dp9avDROwgAACj6Mrpdwg400.png-wh_50

四、簡單配置

 VyOS CLI提供兩種模式:operational mode和configuration mode.輸入configure之後即進入configuration模式,跟路由器和其他linux發行版一樣,支持[tab]補齊和查看幫助信息。配置完之後用compare命令查看修改的配置,commit提交配置,save保存到/config/config.boot配置文件中。

  show命令:

#查看全部配置
vyos@vyos#  show configuration  
#匹配某個配置字段,類似思科交換機上的include或者linux上的grep
vyos@vyos:~$ show configuration commands | match eth1 
set interfaces ethernet eth1 address '172.16.0.1/24'
set interfaces ethernet eth1 description 'To Private Net'
set interfaces ethernet eth1 hw-id '00:xx:xx:b9:xx:xx

  簡單NAT配置實例:

set interfaces ethernet eth0 address 'xx.xx.xx.34/xx'  #配置出網IP地址
set interfaces ethernet eth0 description 'To Internet'
set protocols static route 0.0.0.0/0 next-hop 'xx.xx.xx.33' #配置全局靜態路由,33為網關
set service ssh listen-address 'xx.xx.xx.34' #設置ssh監聽的本地地址
set service ssh port '2222'  # 更改vyos的ssh端口號
set nat source rule 100 description 'NAT Outside'  #配置NAT source規則,內網映射出網
set nat source rule 100 outbound-interface 'eth0' 
set nat source rule 100 source address '192.168.0.0/24'
set nat source rule 100 translation address 'xx.xx.xx.34'
set nat destination rule 101 description 'To agent port 5045' #配置NAT dest規則,映射到內網
set nat destination rule 101 destination address 'xx.xx.xx.34' 
set nat destination rule 101 destination port '5045'
set nat destination rule 101 inbound-interface 'eth0'
set nat destination rule 101 protocol 'tcp'
set nat destination rule 101 translation address '192.168.0.2'
set nat destination rule 101 translation port '5045'

配置完成之後,報存配置;

vyos@vyos# compare  #查看更改的配置
vyos@vyos# commit   #提交配置
vyos@vyos#save      #保存到文件,重啟不失效
vyos@vyos# exit     #退出
vyos@vyos# rollback 1 #如果發現錯誤,rollback回滾到指定時間的配置

參考鏈接:

http://vyos.net/wiki/Main_Page

本文出自 “Jason'blog” 博客,請務必保留此出處http://xujunxian.blog.51cto.com/8614409/1791647


Tags:

文章來源:


ads
ads

相關文章
ads

相關文章

ad