Hi, so been working on this for a week but not really happy with the solutions I find as they seem to be done by induviduals who rely heavily on ai. I got wireguard easy going and can remotly connect which is great but id love to be able to route any internet traffic to and from the wireguard clients to go though another server while filtering my local onsite services. Felt that if i can crack this i dont need to rely on tailscale. The end goal is to have no reliance on tailscale as i am preparing for the eventual enshitification.

  • B0rax@feddit.org
    link
    fedilink
    English
    arrow-up
    6
    ·
    5 months ago

    What router do you have?

    For example with a Unifi router you can quite easily create a routing for that.

    • LetchLemon@lemmy.blahaj.zonedeleted by creatorOP
      link
      fedilink
      English
      arrow-up
      4
      ·
      5 months ago

      Im picking up what your putting down tho. Be so much easier if i could have a vpn service on a dedicated vlan then just link through with some wg configs but annoyingly my router puts wireguard ontop of the entire topography and messes up everything else.

  • diminou@lemmy.zip
    link
    fedilink
    English
    arrow-up
    6
    ·
    5 months ago

    You could use headscale. Its the heart of tailscale but in an open source format.

    • LetchLemon@lemmy.blahaj.zonedeleted by creatorOP
      link
      fedilink
      English
      arrow-up
      5
      ·
      5 months ago

      I did consider it. But then im still using tailscale ecosystem which as much as i want to they are still an american company.

      • opi@lemmy.ca
        link
        fedilink
        English
        arrow-up
        10
        ·
        5 months ago

        Just a bit of a nitpik, but tailscale is a Canadian company.

        • LetchLemon@lemmy.blahaj.zonedeleted by creatorOP
          link
          fedilink
          English
          arrow-up
          4
          ·
          5 months ago

          Well. That changes everything :D i shall look more seriously into this then. Would still love anythoughts on iptable routing tho >.<

    • Jason2357@lemmy.ca
      link
      fedilink
      English
      arrow-up
      2
      ·
      5 months ago

      Head scale is actually a simpler implementation rather than the heart of what tailscale uses directly. It is perfectly complete for a single persons homelab application IMHO. Would be easy for the community to maintain a fork, but its also good to see other approaches that solve the same problem.

    • LetchLemon@lemmy.blahaj.zonedeleted by creatorOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      5 months ago

      I will tomorrow :) originally i was thinking about it then i got all caught up with wg-easy. Its looked promising when i first looked but it had one or two cavietes that made me decide against it. Will definantly revisit thanks for the suggestion!

      • skyline2@lemmy.dbzer0.com
        link
        fedilink
        English
        arrow-up
        3
        ·
        5 months ago

        Yeah I think the marketing speak for these mesh VPN solutions is confusing. But essentially it seems to me that for most people if they think of a feature they used to use with Tailscale, Netbird has it

  • IratePirate@feddit.org
    link
    fedilink
    English
    arrow-up
    4
    ·
    5 months ago

    I’ve started working on something very similar ( Client -> Wireguard -> homeserver -> Mullvad -> Internet), but didn’t get too far and saved the project for later. IIRC, I had issues defining more clearly in the post-up / post-down hooks which traffic was supposed to go where. Upon bringing up the tunnel to Mullvad, I’d lose SSH access instantaneously. I’ll watch this thread closely and contribute once I get around to tackle the issue sometime this summer.

    • LetchLemon@lemmy.blahaj.zonedeleted by creatorOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      5 months ago

      Yes! Thats the issue im having. I can make wireguard clients connect to mullvad and work but once i try to split tunnel through the post up down hooks i get stuck. Glad im not alone there. The conversations here i wonder if there is an issue with (if your using gluetun) iptables and the wireguard easy nftables. But yes so glad im not alone here with the weird fuckery :-) ill be honest im prob going to try a spin up headscale. Looking online it seems like its the most mature answer and the roads well worn. Just feel its might burn more resources than this would.

  • nexttech@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    5 months ago

    Is this english that i am reading ? or is it some other language ?

    i can’t understand a thing!

  • LetchLemon@lemmy.blahaj.zonedeleted by creatorOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    5 months ago

    Here is the compose and post up im working on

    services:
      gluetun:
        image: qmcgaw/gluetun:v3
        hostname: gluetun
        restart: always
        networks:
          wg:
            ipv4_address: 192.168.1.10    
        ports:
          - 51720:51720/udp # wireguard ui
          - 51821:51821 # wireguard tunnel
        cap_add:
          - NET_ADMIN
        devices:
          - /dev/net/tun:/dev/net/tun
        environment:
          - VPN_SERVICE_PROVIDER=${VPN_SERVICE_PROVIDER}
          - VPN_TYPE=${VPN_TYPE}
          - WIREGUARD_PRIVATE_KEY=${PRIVATE_KEY}
          - WIREGUARD_ADDRESSES=${WIREGUARD_ADDRESSES}
          - SERVER_CITIES=${SERVER_CITIES}
          - ALLOWED_IPS=0.0.0.0/1
          - FIREWALL_OUTBOUND_SUBNETS=${OUTBOUND_SUBNET}  #change to appropriate subnet
          - DNS_ADDRESS=${DNS}
    #      - HEALTH_TARGET_ADDRESS=cloudflare.com:80
    #      - HEALTH_VPN_DURATION_INITIAL=120s
    
      wg-easy:
        environment:
          - INSECURE=true #INITIAL SETUP NOT FOR PRODUCTION
        image: ghcr.io/wg-easy/wg-easy:15
        container_name: wg-easy
        restart: unless-stopped
        networks:
          wg:
            ipv4_address: 192.168.1.20 
        
        volumes:
          - ./data:/etc/wireguard
          - /lib/modules:/lib/modules:ro
        ports:
          - 51720:51720/udp #wireguard
          - 51821:51821/tcp #web ui
        cap_add:
          - NET_ADMIN
          - SYS_MODULE
        sysctls:
          - net.ipv4.ip_forward=1
          - net.ipv4.conf.all.src_valid_mark=1
          - net.ipv6.conf.all.disable_ipv6=0
          - net.ipv6.conf.all.forwarding=1
          - net.ipv6.conf.default.forwarding=1
    
    networks:
      vpn:
        driver: bridge
        enable_ipv6: false
        ipam:
          driver: default
          config:
            - subnet: 192.168.1.0/24 #container ipgateway
    #        - subnet: fdcc:ad94:bacf:61a3::/64
    
    
    

    Post up

    # Detect the VPN bridge interface by wg-easy's container IP
    VPN=$(ip -o -4 addr show | awk '$4 ~ /^192.168.1.20\// {print $2; exit}'); test -n "$VPN";
    iptables -P FORWARD DROP;
    ip6tables -P FORWARD DROP;
    iptables -A INPUT -p udp -m udp --dport {{port}} -j ACCEPT;
    ip6tables -A INPUT -p udp -m udp --dport {{port}} -j ACCEPT;
    
    # Direct subnets:
    ip route -A 10.1.0.0/16 via 192.168.1.0/24 dev $VPN table 200;
    ip -6 route -A 10.1.0.0/16 via 192.168.1.0/24 dev $VPN table 200;