• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Настройка выборочного роутинга через Tailscale Exit Node

Russian
5
10
4.0k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T
    Timotheos
    last edited by Timotheos Feb 20, 2023, 8:01 AM Feb 20, 2023, 7:55 AM

    Всем привет!

    В продолжении темы ping сети Tailscale хотел бы поделиться как у меня получилось настроить выборочный роутинг сайтов через Exit Node в Tailscale сети, так как нигде, включая англоязычные сайты, этой информации нет.

    Опустим простое действие по установке Tailscale на PFSense по этому поводу есть много гайдов.

    Предподготовка. Настройка возможности прямого подключения к нодам, тут все описано в документации в офф. сайте Tailscale.com - pfSense settings to enable direct connections. Статус подключений можно проверить в консоли PFSense через команду в консоли tailscale status или в GUI PFSense VPN -> Tailscale -> Status.

    Если в статусе видим примерно такое:

    active; direct XX.XXX.XXX.XXX:41641, tx 5022632 rx 6353916
    

    Значит подключение прямое, следовательно скорость будет гораздо выше, чем когда статус relay.

    По ссылке выше выше внесите доп. правило в NAT outbound ОБЯЗАТЕЛЬНО. Скрин всё же добавлю)

    login-to-view
    192.168.125.0 - тут должна быть ваша LAN сеть, у меня она такая.

    Далее, выборочный роутинг будет проходить по стандартной схеме - отправляем выборочные сайты ходить через Gateway (Exit node Tailscale), который надо создать. Для этого идем в Interfaces -> Assignments и добавляем интерфейс:

    login-to-view

    Заходим в интерфейс (OPT1) и заполняем настройки:
    login-to-view

    IP адрес берем тот, что в статусе TS присвоился PFSense, маска 10 (по документации TS они назначают IP из приватной сети 100.64.0.0/10), нажимаем Save, Apply и далее тут же "Add a new gateway". Оговорка, здесь предполагаем, что ранее вы уже создали какую либо выходную ноду, гайды можно найти на офф сайте: Exit nodes. Вписываем IP выходной ноды:

    login-to-view

    Дефолтным его не делаем, так как мы будем пускать туда трафик по Alias списку. Можно по желанию зайти в System -> Routing -> TSGW и вписать Monitor IP (у меня это IP моей выходной ноды):

    login-to-view

    После этого, я думал, что всё должно заработать, но нет, пока не осознал, что Tailscale запущен без флага --exit-node=100.x.x.x (gateway который вписывали ранее), кстати, разрабы могли бы добавить эту функцию в GUI. Чтобы всё получилось надо пойти в косоль (SSH) и запустить команду вида tailscale up --reset --exit-node=100.x.x.x --accept-routes. Этим мы скажем, что выходная нода будет нужный нам gateway. Чтобы этот процесс автоматизировать после перегрузки создадим простой скрипт:

    nano /usr/local/etc/rc.d/tailscale-node.sh

    #!/bin/sh
    sleep 3
    tailscale up --reset --exit-node=100.X.X.X --accept-routes
    

    (если nano не установлено, то сначала pkg install nano -y)

    Делаем файл исполняемым:
    chmod +x /usr/local/etc/rc.d/tailscale-node.sh

    Можно тут же его выполнить:
    sh /usr/local/etc/rc.d/tailscale-node.sh

    Готово, теперь самое простое, идем в Firewall -> Aliases добавляем сайт к примеру myip.ru:

    login-to-view

    Идем Firewall -> Rules -> LAN добавляем правило:

    login-to-view

    Источник - LAN сеть, направление - Single host or alias и список в нашем случае unblock (писать ручками)

    login-to-view

    Далее, Save, Apply. Готово, после можно зайти на сайт myip.ru и убедиться, что там стоит адрес IP вашей выходной ноды.

    W B 2 Replies Last reply Feb 24, 2023, 9:39 AM Reply Quote 4
    • T Timotheos referenced this topic on Feb 20, 2023, 7:58 AM
    • W
      werter @Timotheos
      last edited by Feb 24, 2023, 9:39 AM

      Добрый.
      @timotheos
      Супер, спасибо!

      1 Reply Last reply Reply Quote 0
      • A alite-ha referenced this topic on May 31, 2023, 11:59 AM
      • A
        alite-ha
        last edited by alite-ha May 31, 2023, 12:04 PM May 31, 2023, 12:03 PM

        Hello @Timotheos
        Is your guide still correct?

        Since assigning the interface made my pfSense box not rebooting correctly and asking for interface configuration? Furthermore did you manage to get Subnet Routing and using an Exit node to work?

        The Video of Christian McDonald where he shows the package also mentions to not assign the interface here: https://youtu.be/Fg_jIPVcioY?t=1182

        Getting official support in the Tailscale Package for using an Exit Node would be really great!

        Thanks.

        T 1 Reply Last reply Jun 1, 2023, 9:37 PM Reply Quote 0
        • T
          Timotheos @alite-ha
          last edited by Jun 1, 2023, 9:37 PM

          @alite-ha Hi! The guide is still correct, and yes it is I believe a bug with the assignment Tailscale interface to pFsense where it's not working after rebooting (you have to reassign all from the beginning which is annoying). But selective routing via Exit Node works with interface assignment only, cuz when you create a Firewall rule where you need to choose the gateway it's only possible when it exists, right?

          Speaking of Subnet routing it works out if the box with no issues. You have any problems?

          A 1 Reply Last reply Jun 5, 2023, 2:52 PM Reply Quote 1
          • A
            alite-ha @Timotheos
            last edited by Jun 5, 2023, 2:52 PM

            @Timotheos Hi.

            Thanks for the quick response. I think that's why he said not to assign it.
            Currently Exit-Nodes won't work, but this could be an issue on our side too.

            The question is, is there a workaround for the problem with the interfaces, to get them reassigned correctly on reboot?

            I think there is a progress on this function here:
            https://github.com/tailscale/tailscale/issues/5573
            And https://github.com/rcmcdonald91 is working on it.

            T 1 Reply Last reply Jun 6, 2023, 6:36 AM Reply Quote 0
            • T
              Timotheos @alite-ha
              last edited by Jun 6, 2023, 6:36 AM

              @alite-ha nope, I didn't find any for now. Hopefully it will be fixed soon. But as I mentioned above the exit node is working with TS assignment as an interface.

              1 Reply Last reply Reply Quote 0
              • T Timotheos referenced this topic on Jun 6, 2023, 6:44 AM
              • A
                Andan60
                last edited by Sep 25, 2023, 11:31 PM

                Having a little trouble with the setup.

                When you create the PfSense Interface for TailScale, you add the Static IPv4 Address that was provided for the PfSense device.
                Selecting the "Add a new gateway" are you inputting a different address for Gateway IPv4 ?
                Because I tried to input the IP address of the exit node I would like but got the following error,
                The gateway address 100.xxx.xxx.xxx does not lie within one of the chosen interface's subnets.

                T 1 Reply Last reply Sep 26, 2023, 8:35 PM Reply Quote 0
                • T
                  Timotheos @Andan60
                  last edited by Sep 26, 2023, 8:35 PM

                  @Andan60 hi,
                  Yeah, as for the gateway you input the IP of your exit node. Don't forget on the previous page where you set IP of your pfsense in that newly created TS interface put the subnet mask /10. And all should be fine, and of course you need to say to tailscale daemon to set flags --exit-node=100.X.X.X --accept-routes as explained above.

                  A 1 Reply Last reply Sep 27, 2023, 3:16 AM Reply Quote 0
                  • A
                    Andan60 @Timotheos
                    last edited by Sep 27, 2023, 3:16 AM

                    @Timotheos thanks
                    I had the subnet mask as /32 instead of /10
                    Fixed it

                    1 Reply Last reply Reply Quote 0
                    • B
                      Brain @Timotheos
                      last edited by Oct 7, 2023, 12:34 PM

                      This post is deleted!
                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post
                      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.