Программный роутер для linux

Best free Linux router and firewall distributions of 2020

This article has been last updated on August 3, 2020.

There are countless Free an Open Source Linux/BSD distributions to choose from for your router. However, there are many outdated recommendations on the internet, so it’s not an easy choice. For that reason, we have decided to create a definitive firewall comparison for 2020.

Wikipedia has a list of router and firewall distributions, but the list is not useful, because it’s inaccurate (as of August 2020) and it doesn’t really compare these systems in any useful way. It also lists many outdated and irrelevant systems that should be avoided in 2020.

If you are looking to get the most of your hardware appliance, or are building a new firewall, we have done the research for you.

Why is our router distro comparison better than others?

For many years we have been selling hardware for building Open Source firewalls and routers. Over the last year, we have installed and configured most, if not all the distributions out there. We install and configure pfSense, OPNSense, OpenWRT, ClearOS, IPFire, and other OSes every day, so we have a good idea which Operating systems work better than others. We don’t make any money from any software vendors, which make this recommendation relatively objective.
We hear customer feedback daily, if there are performance issues or problems with updates, we hear about it.

Top 10 Open Source Firewall Software to avoid — what you should NOT use.

Other comparisons out there are recommending Operating Systems that are long dead or no longer relevant. This is most likely because these «Top 10 Open Source Linux Firewall Software» lists are copied from year to year by non-technical users, without doing the actual comparison.

Some Operating Systems have been superseded or simply stopped being maintained and became irrelevant. You want to avoid such systems because of security reasons — these distros use outdated and have insecure Linux/BSD kernels which can potentially expose you to security exploits.

1. IPCop — avoid at all cost

Once popular operating system, included in all «top 10» lists such as this one. You should avoid using it. The last release was in 2015, and the system is ancient by today’s standards. The official website is dead, but the source code is still out there. Don’t use it.

2. Smoothwall — long dead

Smoothwall got some good reputation in the early days when it was competing with IPCop. It went silent in 2014. Smoothwall OS has been abandoned and is no longer relevant, or secure. You should avoid it. The website is still up and running, but hasn’t been updated in many years.

3. DD-WRT — no longer competitive

This is a little controversial recommendation because I know that many users still feel that DD-WRT is good. It certainly was back in the day. Today DD-WRT is still functional and works, but it’s not great or innovative. It’s mostly unchanged since 2014 and fell far behind other open source competitors. Today there are many good alternatives, such as OpenWRT.

4. M0n0wall — retired

M0n0wall is the godfather of the most successful operating systems we have today. It’s been one of the most innovative projects in its day, but it’s now retired. System hasn’t received any updates since early 2014 and is officially abandoned.
Manuel Kasper, the author of M0n0wall recommends OPNSense as its successor.

5. Tomato — not for new routers

Tomato is cool, and we love it, but it’s a minimal firmware designed for flashing off-the-shelf routers such as D-Link and Asus. The system is still relevant if you want to resurrect your old hardware and make it functional again, but if you are building a new router you probably don’t want to use tomato on it. We are building powerful routers from scratch, so we generally don’t use this system (we still love it).

Читайте также:  Что такое manjaro linux

6. Zeroshell — poor choice

We like the concept of Zeroshell, and we hope it succeeds, but today the system is far behind it’s competitors. The Web UI is very rudimentary, and the functionality is limited. We will keep an eye on it, and update this recommendation if things change. The website hasn’t been updated since 2018, so at the moment this project doesn’t look promising.

There are other systems that are relevant, and receive updates, but we still don’t recommend them, at least to less technical users.

We don’t recomment the below systems, because they require relatively high expertise to perform simple tasks. These days, SOHO routers (Small Office / Home Office) should be easy to setup and have Intuitive Web Interface to manage. For these reasons we don’t recommend the following systems:

7. VyOS — no Web interface

We love VyOS, but we highly discourage our customers from getting it, unless they really know what they are doing. This system must be managed from command line, and it requires high level of expertise to maintain and use.

8. OpenBSD and FreeBSD — use only if you have 10+ years of the command line experience

OpenBSD and FreeBSD are actively developed and are very capable, but these systems require a high level of understanding of operating system internals, and low-level networking to be used as routers.

We routinely install both systems for customers that are experts, such as network administrators or software developers. If you don’t want to mess with system internals and spend hours reading manuals, this is not a system for you. It does not provide any Web UI or GUI tools for configuration. It’s a barebones terminal based system.

9. Debian and Ubuntu — don’t use general purpose OS for your router

These systems are not intended for routers. They are general purpose operating systems, and should not really be used as routers. Similar to OpenBSD and VyOS, you will have to configure everything by hand without a Web Interface.

There are also a few systems we don’t recommend because they are not truly free or open source.

10. Untangle — is it really free if OS asks you to upgrade to a paid version?

Untangle NG Firewall is truly great software, with many happy users. We don’t recommend it because the free version is very limited, and the operating system constantly incentivizes the users to upgrade to a paid subscription to unlock the cool functionality. The cheapest license is $50 USD/year.

11. Sophos — small fish in an enterprise pond

Sophos «XG Firewall» distribution has a very nice user interface and is free for home use. We generally don’t recommend it because it’s not a system that Sophos itself promotes. Sophos’ website seems to make it purposefully hard to find, and the community is very small. Sophos, in general, is an enterprise software company, with one community product. There’s no Open Source spirit here.

12. Endian — you really have to pay to use it fully

Endian is actually pretty cool, and free. We don’t recommend it because features like WiFi are available only in paid subscriptions. Similar to Untangle, it’s good software, but you have to pay for it — this disqualifies it from our consideration.

Best Linux/BSD Router distribution in 2020 (4 recommendations)

To choose the best Operating System for routers we have set a few basic guidelines. All systems not compatible with these guidelines have been rejected.

Basic requirements for choosing Firewall Operating System

  1. The system must be actively maintained, and regularly receive security patches.
  2. The system must be fully Free and Open Source
  3. The system must have a Web interface or GUI. Command line operating systems are disqualified.
  4. The system must be performant, and work well for a typical user.

These basic requirements are reducing the list of recommendations to 4 systems. pfSense, OpenWRT, OPNSense and IPFire.

1. OPNsense — a raising star

OPNSense is one of the most quickly developing operating systems on the market today. It’s an easy to use, mature system with slick UI. OPNSense includes most if not all features found in expensive, enterprise commercial firewalls. It has the quality of a commercial product while being completely free and open source.

It includes features not available in competing products, such as supports for WireGuard — the latest and greatest VPN software. OPNSense is based on pfSense/M0n0wall.

Читайте также:  Windows 10 nas smb

OPNSense offers weekly security updates, which makes is one of the most secure solutions on the market. Each year there are 2 major releases of the operating system, that bring many new features.

It’s a stable solution that we often recommend to users that are not sure which operating system to choose.

Advantages

  • Best Web Interface / GUI
  • Most frequently updated
  • Support for features not found elsewhere

Disadvantages

OPNSense is BSD-based, which is a disadvantage in some cases;

  • WiFi support is very limited. If you plan on using WiFi on your router, get Linux-based operaing sustem.
  • BSD also limits the maximum throughput per connection. Single connection on OPNSense will not utilize full capacity of multi-core CPU. (this is often not important unless you have a gigabit internet connection)

2. OpenWRT — a proven veteran

OpenWRT is a Linux-based operating system for routers, recognized almost by everyone. It’s been first released in 2004, over 15 years ago and is still actively developed and maintained.

Unlike IPFire, OpenWRT has large number of optional packages in its repository. You can configure this OS in countless different ways. Most importantly, OpenWRT has drivers for all hardware supported by Linux. This means that almost all Wireless modems are supported, making it the most versatile OS for creating Access Points.

OpenWRT has the lowest hardware requirements of all operating systems we have reviewed.

Advantages

  • It has the best WiFi support. It supports all the latest wireless standards and has a great Web Interface for quickly configuring and managing WiFi access points.
  • Utilized all CPU cores for routing, and achieves the best routing performance
  • There are about 3500 optional software packages available for installation
  • It boots in about 7 seconds. Much faster than other distributions.

Disadvantages

  • Its Web interface is functional, but not the most modern. It looks a little behind it’s times.
  • The installation process requires more steps than other systems.

pfSense is by far the most popular router operating system today. It’s a BSD-based system, similar to OPNSense, but with a much longer history. pfSense started in 2004, since then it grew to be the most well known open source platform in the industry.

pfSense has the most extensive documentation, and the biggest community, making it a good operating system to start with. There are throusands of tutorials, forums, blogs and youtube videos all over the internet that will be helpful if you get stuck on something.

Advantages

  • Frequently updated, and considered solid
  • Biggest community
  • A large number of tutorials/documentation on the web

Disadvantages

Similar to OPNSense, pfSense is based on BSD so:

  • WiFi support is very limited. If you plan on using WiFi on your router, get a Linux-based operating system.
  • BSD also limits the maximum throughput per connection. A single connection on OPNSense will not utilize the full capacity of multi-core CPU. (this is often not important unless you have a gigabit internet connection)

4. IPFire — contender

IPFire is a Linux-based distribution intended for Firewalls and Routers.
IPfire is a continuation of IPCop (mentioned above) but has been rewritten from scratch. The system is regularly updated and maintained, but it doesn’t have many features found in pfSense or OPNSense. It passes all our requirements, but we recommend trying it only if the other 3 systems don’t satisfy your needs.

Advantages

  • It’s Linux-based so it supports WiFi well (but not as well as OpenWRT)
  • It utilized all CPU cores, making it very fast on multi-core CPUs

Disadvantages

  • The Web interface is probably the worst of the 4 recommended systems. Not very modern and not intuitive.
  • Harder to configure WiFi in comparison to OpenWRT.
  • Very few software packages available for installation
  • Not all functions can be configured via the web interface. Some require tinkering with a command line.

Final verdict

In short, if you are planning on using WiFi in your router you should choose OpenWRT. It has the absolute best support for wireless of all systems we have tested.

If you plan on using a separate Access Point and are looking for the best Open Source operating system in terms of features, documentation, community and easy to manage user interface, we strongly recommend trying OPNSense or pfSense.

Источник

Наш рецепт отказоустойчивого Linux-роутера

В высоконагруженных проектах всегда повышенные требования к избыточности и надежности. Одним из важнейших звеньев инфраструктуры является маршрутизатор, потому что от его устойчивости зависит доступность сети в целом. Именно на таких узлах мы используем одну из схем реализации отказоустойчивого виртуального роутера на базе GNU/Linux с использованием iproute2, NetGWM, keepalived, ISC DHCPD, PowerDNS. Как мы всё это настраиваем, читайте в этой статье.

Компоненты

В идеальной схеме отказоустойчивого роутера мы резервируем все элементы, которые могут привести к недоступности сети, то есть:

  • каналы связи,
  • коммутаторы,
  • маршрутизаторы.

В общем виде схема (на уровне L2) выглядит так:

Как видно из схемы, нам нужны 2 коммутатора с поддержкой 802.1Q VLAN. Оператор 1 коммутируется в Коммутатор 1 и ему выделяется отдельный VLAN (например, 110). Оператор 2 коммутируется в Коммутатор 2, в другой VLAN (например, 120). Отдельный VLAN (в нашем случае — 200), выделяется под локальную сеть. Между коммутаторами организуется транк, и транком же линкуем оба маршрутизатора, которые и будут «сердцем» нашего виртуального роутера (схема router-on-a-stick).

Читайте также:  Где хранятся пароли internet explorer windows

Такая компоновка позволяет оставлять работоспособной сеть при выходе из строя любого компонента: роутера, коммутатора или оператора.

Стек базовых компонентов, которые мы используем в работе роутеров:

  • Ubuntu Linux;
  • NetGWM — утилита приоритезации основного шлюза в решении. Это наша Open Source-разработка, о которой мы готовим отдельную статью (пока предлагаю ознакомиться с базовой документацией) [Обновлено 08.08.2017: статья опубликована как «Настройка основного и двух резервных операторов на Linux-роутере с NetGWM»];
  • iproute2 — для создания нескольких таблиц маршрутизации;
  • keepalived — для реализации протокола VRRP в Linux;
  • ISC DHCPD — как горизонтально масштабируемый DHCP-сервер;
  • PowerDNS — как DNS-сервер для локальной сети.

Маршрутизаторы настраиваются примерно одинаково, за исключением конфигурации IP-адресов и keepalived.

Настройка интерфейсов

Настраиваем VLAN. Конфигурация /etc/network/interfaces будет выглядеть примерно так:

  • настраиваем blackhole — хорошая практика для того, чтобы локальные пакеты не улетали по маршруту по умолчанию в сторону провайдера;
  • net.ipv4.conf.$IFACE.rp_filter=0 — необходим для корректной работы multi-wan;
  • для каждого провайдера настраиваем отдельную таблицу маршрутизации с единственным маршрутом по умолчанию.

Настроим маркинг пакетов для направления в определенные таблицы — добавим в iptables правила:

И настроим правила маршрутизации для промаркированных пакетов — мы это делаем вызовом скрипта iprules.sh при выполнении ifup lo (смотри выше в /etc/network/interfaces ). Внутри скрипта:

Эти таблицы маршрутизации необходимо объявить в /etc/iproute2/rt_tables :

Балансировщик основного шлюза

Настроим NetGWM — утилиту для приоритезации основного шлюза. Она будет устанавливать маршрут по умолчанию, выбирая операторов в соответствии с двумя правилами: а) установленным нами приоритетом, б) статусом оператора (жив или нет).

Чтобы установить NetGWM, можно воспользоваться исходниками на GitHub или нашим репозиторием для Ubuntu. Второй способ в случае Ubuntu 14.04 LTS выглядит так:

Укажем в конфиге /etc/netgwm/netgwm.yml , что у нас 2 оператора, маршруты по умолчанию для каждого из них, приоритезацию и настройки для контроля доступности:

Обратите внимание на имена oper1 и oper2 — это названия таблиц маршрутизации из /etc/iproute2/ip_tables . Рестартнем сервис netgwm , чтобы он начал управлять шлюзом по умолчанию для системы:

Настройка keepalived

Keepalived — реализация протокола VRRP для Linux. Этот протокол позволяет реализовать схему с отказоустойчивой маршрутизацией, создавая виртуальный IP, который будет использоваться в качестве маршрута по умолчанию для обслуживаемой сети. Виртуальный IP автоматически передается резервному серверу при выходе из строя основного сервера.

На этом этапе мы определяемся, что Маршрутизатор 2 будет играть роль Backup, а Маршрутизатор 1 — роль Master. Настраиваем keepalived, изменяя конфигурационный файл /etc/keepalived/keepalived.conf :

Так как наш отказоустойчивый роутер — многокомпонентный, мы решили использовать режим, в котором переключение keepalived режимов Backup → Master происходит только в случае отказа Master-сервера. За это как раз отвечает параметр nopreempt .

Настройка ISC DHCPD

ISC DHCPD был выбран нами, так как позволяет масштабировать DHCP на несколько серверов. Он прост в конфигурировании и хорошо зарекомендовал себя на практике. Кроме того, нам понравилось, что разработчики этого DHCP-сервера придумали изящное решение для организации реплики между серверами. Для основного и второстепенного серверов выделяются разные пулы адресов и на запросы отвечает сервер, который успел сделать это первым, выдавая адрес из своего пула. При этом база арендованных IP синхронизируется. В случае, если один из серверов отказывает, второй как ни в чем не бывало продолжает выдачу адресов из своего пула. При возврате отказавшего сервера он начинает выдачу из своего пула, при этом не возникает коллизий.

Правим конфиг /etc/dhcp/dhcpd.conf :

Нам понадобится сгенерировать ключ update_key , с помощью которого мы будем обновлять зону mynet . Сгенерируем его и выведем на экран:

Скопируйте сгенерированный ключ и вставьте в конфигурационный файл вместо слова КЛЮЧ.

Настройка PowerDNS

В качестве DNS-сервера мы предпочли PowerDNS, так как он имеет возможность хранить зоны в СУБД MySQL, которую удобно реплицировать между первым и вторым сервером. Кроме того, PoweDNS — это производительное решение, хорошо функционирующее в высоконагруженном роутере.

Настройку PowerDNS начнем с подготовки базы данных.

Теперь нужно настроить PowerDNS и научить его работать с БД. Для этого требуется установить пакет pdns-backend-mysql и изменить конфиг /etc/powerdns/pdns.conf :

На этом базовая конфигурация PowerDNS закончена. Нам же ещё потребуется настроить рекурсор — обработчик рекурсивных DNS-запросов, который позволяет значительно повысить производительность DNS-сервера. Правим файл /etc/powerdns/recursor.conf :

В файл forward_zones вносим зоны intranet, которые обслуживают соседние серверы:

По окончании настройки перезапускаем сервисы pdns и pdns-recursor .

После запуска настраиваем реплику MySQL между серверами.

Заключение

Мы используем данное решение не только в чистом виде. В большинстве случаев оно усложняется добавлением туннелей VTun, OpenVPN или IPSec через основного и резервного оператора связи и динамической маршрутизацией, которая реализуется с помощью Quagga. Поэтому схему, предложенную в статье, предлагаю воспринимать как фундамент для создания более сложных решений.

Будем рады, если вы зададите свои вопросы в комментариях или укажете на места в схеме, которые можно улучшить. И, конечно, подписывайтесь на наш хаб, чтобы не пропускать новые полезные материалы! )

Источник

Оцените статью