{"id":44642881,"url":"https://github.com/nthings/dietpi-tailnet","last_synced_at":"2026-02-14T19:06:37.317Z","repository":{"id":336529098,"uuid":"1150068821","full_name":"nthings/dietpi-tailnet","owner":"nthings","description":null,"archived":false,"fork":false,"pushed_at":"2026-02-04T21:34:59.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-05T09:36:36.739Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nthings.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-04T21:03:41.000Z","updated_at":"2026-02-04T21:35:01.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/nthings/dietpi-tailnet","commit_stats":null,"previous_names":["nthings/dietpi-tailnet"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/nthings/dietpi-tailnet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nthings%2Fdietpi-tailnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nthings%2Fdietpi-tailnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nthings%2Fdietpi-tailnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nthings%2Fdietpi-tailnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nthings","download_url":"https://codeload.github.com/nthings/dietpi-tailnet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nthings%2Fdietpi-tailnet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29452671,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T15:52:44.973Z","status":"ssl_error","status_checked_at":"2026-02-14T15:52:11.208Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-14T19:06:36.560Z","updated_at":"2026-02-14T19:06:37.306Z","avatar_url":"https://github.com/nthings.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DietPi Tailscale Setup with Exit Node\n\nA comprehensive guide and automation script for setting up Tailscale on DietPi nodes with exit node routing capabilities.\n\n## Overview\n\nThis repository provides tools and instructions to configure a DietPi device as a Tailscale client that routes traffic through an exit node. It includes:\n\n- Automated setup script for NAT/Masquerade configuration\n- IP forwarding enablement for subnet routing\n- Exit node configuration with LAN access\n- Static IP configuration utilities\n\n## Prerequisites\n\nBefore setting up Tailscale on your DietPi node, ensure you have:\n\n- A DietPi device (Raspberry Pi, x86, or other supported hardware)\n- Root/sudo access to the device\n- An active internet connection\n- A Tailscale account (free at [tailscale.com](https://tailscale.com))\n- An exit node already configured in your Tailnet (optional, if you want to route traffic through it)\n\n## Installation\n\n### Step 1: Install Tailscale on DietPi\n\n1. **Connect to your DietPi device via SSH:**\n   ```bash\n   ssh root@\u003cyour-dietpi-ip\u003e\n   ```\n\n2. **Install Tailscale using the official installation script:**\n   ```bash\n   curl -fsSL https://tailscale.com/install.sh | sh\n   ```\n\n   Alternatively, you can use DietPi's software installer:\n   ```bash\n   dietpi-software install 200\n   ```\n   (Tailscale is software ID #200 in DietPi-Software)\n\n3. **Start Tailscale and authenticate:**\n   ```bash\n   tailscale up\n   ```\n   \n   This will provide you with a URL to authenticate your device. Open the URL in a web browser and log in to your Tailscale account.\n\n4. **Verify Tailscale is running:**\n   ```bash\n   tailscale status\n   ```\n\n### Step 2: Configure an Exit Node (if you want to route traffic)\n\nIf you want this DietPi node to route its internet traffic through another device in your Tailnet:\n\n1. **Ensure you have an exit node available in your Tailnet.** You can configure another device as an exit node by:\n   - Going to the [Tailscale admin console](https://login.tailscale.com/admin/machines)\n   - Selecting a device to act as your exit node\n   - Enabling \"Use as exit node\" in the device settings\n   - OR running this on the exit node device: `sudo tailscale up --advertise-exit-node`\n\n2. **Find your exit node's name:**\n   ```bash\n   tailscale status\n   ```\n   Look for the device you want to use as an exit node (e.g., `raspberrypi4`, `home-server`, etc.)\n\n### Step 3: Run the Setup Script\n\nThis repository includes a comprehensive setup script that automates the NAT/Masquerade configuration and exit node setup.\n\n1. **Download the setup script:**\n   ```bash\n   wget https://raw.githubusercontent.com/nthings/dietpi-tailnet/main/setup-tailscale-nat.sh\n   chmod +x setup-tailscale-nat.sh\n   ```\n\n2. **Edit the script to set your exit node name** (optional):\n   \n   Open the script and modify the `TAILSCALE_EXIT_NODE` variable:\n   ```bash\n   nano setup-tailscale-nat.sh\n   ```\n   \n   Search for and change:\n   ```bash\n   TAILSCALE_EXIT_NODE=\"raspberrypi4\"\n   ```\n   to your exit node's name (as shown in `tailscale status`)\n\n3. **Run the setup script:**\n   ```bash\n   sudo ./setup-tailscale-nat.sh\n   ```\n\n   The script will:\n   - Enable IP forwarding (IPv4 and IPv6)\n   - Configure NAT/Masquerade rules for Tailscale\n   - Persist iptables rules across reboots\n   - Configure your exit node with LAN access enabled\n   - Install and configure iptables-persistent\n\n### Step 4: Verify the Configuration\n\n1. **Check Tailscale status:**\n   ```bash\n   tailscale status\n   ```\n   \n   You should see your exit node listed and marked as active.\n\n2. **Test internet connectivity through the exit node:**\n   ```bash\n   curl ifconfig.me\n   ```\n   \n   This should return the public IP address of your exit node, not your DietPi's local IP.\n\n3. **Verify IP forwarding is enabled:**\n   ```bash\n   sysctl net.ipv4.ip_forward\n   sysctl net.ipv6.conf.all.forwarding\n   ```\n   \n   Both should return `1`.\n\n4. **Check NAT rules:**\n   ```bash\n   sudo iptables -t nat -L POSTROUTING -v --line-numbers\n   ```\n\n## Manual Configuration (Alternative)\n\nIf you prefer to configure everything manually without using the script:\n\n### Enable IP Forwarding\n\n```bash\n# Enable immediately\nsudo sysctl -w net.ipv4.ip_forward=1\nsudo sysctl -w net.ipv6.conf.all.forwarding=1\n\n# Persist across reboots\necho \"net.ipv4.ip_forward = 1\" | sudo tee -a /etc/sysctl.d/99-tailscale-forwarding.conf\necho \"net.ipv6.conf.all.forwarding = 1\" | sudo tee -a /etc/sysctl.d/99-tailscale-forwarding.conf\nsudo sysctl -p /etc/sysctl.d/99-tailscale-forwarding.conf\n```\n\n### Configure Exit Node\n\n```bash\n# Set exit node (replace 'exit-node-name' with your exit node's hostname)\nsudo tailscale set --exit-node=exit-node-name --exit-node-allow-lan-access=true\n```\n\n### Setup NAT/Masquerade (if needed)\n\n```bash\n# Install iptables-persistent\nsudo apt-get update\nsudo apt-get install -y iptables-persistent\n\n# Add masquerade rules\nsudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE\nsudo iptables -A FORWARD -i tailscale0 -j ACCEPT\nsudo iptables -A FORWARD -o tailscale0 -m state --state RELATED,ESTABLISHED -j ACCEPT\n\n# Save rules\nsudo iptables-save | sudo tee /etc/iptables/rules.v4\nsudo ip6tables-save | sudo tee /etc/iptables/rules.v6\n```\n\n## Advanced Features\n\n### Static IP Configuration\n\nThe setup script includes utilities to configure a static IP that will be applied on the next boot:\n\n```bash\n# Configure static IP for next boot\nsudo ./setup-tailscale-nat.sh --set-static-ip -i 192.168.1.30 -g 192.168.1.1 -n 24 -d eth0\n\n# Check pending static IP configuration\nsudo ./setup-tailscale-nat.sh --static-ip-status\n\n# Cancel pending static IP configuration\nsudo ./setup-tailscale-nat.sh --cancel-static-ip\n```\n\n### Changing Exit Node\n\nTo switch to a different exit node:\n\n```bash\n# Method 1: Edit and re-run the script\nnano setup-tailscale-nat.sh  # Change TAILSCALE_EXIT_NODE variable\nsudo ./setup-tailscale-nat.sh\n\n# Method 2: Use Tailscale CLI directly\nsudo tailscale set --exit-node=new-exit-node-name --exit-node-allow-lan-access=true\n```\n\n### Disable Exit Node\n\nTo stop routing traffic through an exit node:\n\n```bash\nsudo tailscale set --exit-node=\n```\n\n## Use Cases\n\n### Home Lab Access\nConfigure your DietPi device to access your home network remotely by routing through a home exit node.\n\n### Privacy-Enhanced Browsing\nRoute your DietPi's internet traffic through an exit node in a different location for enhanced privacy.\n\n### Multi-Site Networking\nConnect multiple DietPi devices across different locations and route traffic through a central exit node.\n\n### IoT Device Protection\nSecure IoT devices by routing their traffic through a monitored exit node.\n\n## Troubleshooting\n\n### Tailscale is not connecting\n\n1. **Check Tailscale service status:**\n   ```bash\n   sudo systemctl status tailscaled\n   ```\n\n2. **Restart Tailscale:**\n   ```bash\n   sudo systemctl restart tailscaled\n   tailscale up\n   ```\n\n3. **Check firewall rules:**\n   ```bash\n   sudo iptables -L -v -n\n   ```\n\n### Exit node is not working\n\n1. **Verify exit node is approved** in the [Tailscale admin console](https://login.tailscale.com/admin/machines)\n\n2. **Check current exit node status:**\n   ```bash\n   tailscale status --peers=false\n   ```\n\n3. **Try setting the exit node again:**\n   ```bash\n   sudo tailscale set --exit-node=your-exit-node-name --exit-node-allow-lan-access=true\n   ```\n\n### Cannot access local network while using exit node\n\nMake sure you enabled LAN access when configuring the exit node:\n```bash\nsudo tailscale set --exit-node=your-exit-node-name --exit-node-allow-lan-access=true\n```\n\n### IP forwarding not persisting after reboot\n\n1. **Check if the sysctl configuration file exists:**\n   ```bash\n   ls -la /etc/sysctl.d/99-tailscale-forwarding.conf\n   ```\n\n2. **Manually verify and reload:**\n   ```bash\n   sudo sysctl -p /etc/sysctl.d/99-tailscale-forwarding.conf\n   ```\n\n### iptables rules not persisting\n\n1. **Check if iptables-persistent is installed:**\n   ```bash\n   dpkg -l | grep iptables-persistent\n   ```\n\n2. **Reinstall if necessary:**\n   ```bash\n   sudo apt-get install --reinstall iptables-persistent\n   ```\n\n3. **Manually save rules:**\n   ```bash\n   sudo iptables-save | sudo tee /etc/iptables/rules.v4\n   sudo ip6tables-save | sudo tee /etc/iptables/rules.v6\n   ```\n\n## Script Options\n\nThe `setup-tailscale-nat.sh` script supports several options:\n\n```bash\nUsage: ./setup-tailscale-nat.sh [OPTIONS]\n\nOptions:\n  (no options)           Run full NAT/Masquerade setup\n  --set-static-ip        Configure static IP for next boot\n      -i, --ip IP        Static IP address (required)\n      -g, --gateway GW   Gateway address (required)\n      -n, --netmask NM   Netmask in CIDR (default: 24)\n      -d, --interface IF Network interface (default: eth0)\n      --dns1 DNS         Primary DNS (default: 8.8.8.8)\n      --dns2 DNS         Secondary DNS (default: 8.8.4.4)\n  --cancel-static-ip     Cancel pending static IP configuration\n  --static-ip-status     Show pending static IP configuration\n  -h, --help             Show this help message\n```\n\n## Security Considerations\n\n- **Exit nodes have access to all your internet traffic.** Only use exit nodes you trust.\n- **Keep Tailscale updated** to ensure you have the latest security patches.\n- **Use ACLs (Access Control Lists)** in your Tailscale admin console to restrict which devices can access your DietPi node.\n- **Review iptables rules** regularly to ensure they match your security requirements.\n- **Enable MFA** on your Tailscale account for additional security.\n\n## Additional Resources\n\n- [Tailscale Documentation](https://tailscale.com/kb/)\n- [DietPi Documentation](https://dietpi.com/docs/)\n- [Exit Nodes Explained](https://tailscale.com/kb/1103/exit-nodes/)\n- [Subnet Routers](https://tailscale.com/kb/1019/subnets/)\n- [Tailscale ACLs](https://tailscale.com/kb/1018/acls/)\n\n## Contributing\n\nContributions are welcome! Please feel free to submit issues or pull requests.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Author\n\nMauricio Alejandro Martínez Pacheco\n\n## Support\n\nFor issues related to:\n- **This script**: Open an issue in this repository\n- **Tailscale**: Visit [Tailscale Support](https://tailscale.com/contact/support/)\n- **DietPi**: Visit [DietPi Forums](https://dietpi.com/forum/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnthings%2Fdietpi-tailnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnthings%2Fdietpi-tailnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnthings%2Fdietpi-tailnet/lists"}