Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TUN Mode #66

Open
zoghal opened this issue Apr 5, 2024 · 11 comments
Open

TUN Mode #66

zoghal opened this issue Apr 5, 2024 · 11 comments
Labels
enhancement New feature or request

Comments

@zoghal
Copy link

zoghal commented Apr 5, 2024

سلام و عرض ادب
داشتم یه بتچ فایل برای خودم مینوشتم تا با کمک tun2socks بتونم تمام ترافیک سیستم رو به وارپ پلاس پروکسی کنم(اسکریپت).

مشکلی که هست اینه وارپ پلاس هروقت اجرا میشه ای‌پی endpoints متغیره و تغییر میکنه. که البته خیلی هم خوب است! منتهی من برای اجرای tun2socks لازم دارم قبلش اون ای‌پی که برای endpoints وارپ پلاس ست شده رو پیدا کنم و هنگام روت کردن ترافیک سیستم این این ای‌پی رو از کل سیستم مستثنی کنم.

برای اینکار دو راهکار پیشنهادی دارم.
۱- وارپ پلاس زمان اجرا خودش ای‌پی endpoints رو در یک متغییر(environment variables) ست کنه!
۲- وارپ پلاس زمان اجرا ای‌پی endpoints رو در یک فایل تو فولدر stuff ذخیره کنه!

@Amir2367
Copy link

Amir2367 commented Apr 8, 2024

سلام و عرض ادب داشتم یه بتچ فایل برای خودم مینوشتم تا با کمک tun2socks بتونم تمام ترافیک سیستم رو به وارپ پلاس پروکسی کنم(اسکریپت).

مشکلی که هست اینه وارپ پلاس هروقت اجرا میشه ای‌پی endpoints متغیره و تغییر میکنه. که البته خیلی هم خوب است! منتهی من برای اجرای tun2socks لازم دارم قبلش اون ای‌پی که برای endpoints وارپ پلاس ست شده رو پیدا کنم و هنگام روت کردن ترافیک سیستم این این ای‌پی رو از کل سیستم مستثنی کنم.

برای اینکار دو راهکار پیشنهادی دارم. ۱- وارپ پلاس زمان اجرا خودش ای‌پی endpoints رو در یک متغییر(environment variables) ست کنه! ۲- وارپ پلاس زمان اجرا ای‌پی endpoints رو در یک فایل تو فولدر stuff ذخیره کنه!

منم با این نظر دوستمون موافقم

@zoghal
Copy link
Author

zoghal commented Apr 8, 2024

@markpash مهندس کاری میشه واسه این مورد کرد؟ امیدی هست؟

@markpash
Copy link
Member

markpash commented Apr 8, 2024

Hi,

I'm thinking about enabling native tun support instead of tun2socks.
But if I can't, I could potentially use something called fwmark on Linux which would allow you to isolate the connections from this application and route them differently without knowing the endpoint IP.

These things are on my to-do list, no worries. ❤️

@markpash markpash added the enhancement New feature or request label Apr 23, 2024
@markpash
Copy link
Member

@zoghal Hi I have a testing build with Tun support on Linux. Can you please test it and report back?
Fetch the correct file for your platform from here: https://github.com/bepass-org/warp-plus/actions/runs/8858306802?pr=79
I have added a couple of new flags which enable the feature but it also requires configuration on the linux side too.

  1. Run the binary with sudo or root and then pass the following flags --scan --tun --fwmark 0x1375
  2. Run ip addr show and you should see a new network interface called warp0
  3. Run sudo ip link set warp0 up
  4. Run sudo ip addr add 172.16.0.2/24 dev warp0
  5. Run sudo ip rule add table main suppress_prefixlength 0
  6. Run sudo ip rule add not fwmark 0x1375 table 1375
  7. Run sudo ip route add default dev warp0 table 1375

The above commands configure the routing tables to send the traffic from warp-plus through your normal internet, but all other traffic through warp-plus. This is temporary and will reset after reboot or when warp-plus is closed.

Don't run this on a server or a device you can only access through SSH as this will break SSH connectivity. For that to work you will need to write iptables/nftables rules to prevent inbound connections from routing through warp-plus.

@zoghal
Copy link
Author

zoghal commented Apr 27, 2024

ضمن تشکر از بابت وقتی که گذاشتی 🙏

متاسفانه من تا چند روز دسترسی به سیستی که روش لینوکس دستکاپ باشم ندارم. لذا سعی کردم در WSL ویندوز تست کنم. اجرا شد، منتهی در روت کردن ترافیک، تلاشم به جایی نرسید.

تو پرانتز(): بنظرم یه سویچ -v هم برای نشون دادن نسخه هم اضافه بشود، خیلی عالی میشه.🥰

@markpash markpash changed the title نیاز به کشف endpoints برای تفکیک ترافیک جهت استفاده از tun2socks TUN Mode May 5, 2024
@markpash
Copy link
Member

There's experimental tun support for Linux and Windows in the latest version (v1.2.0). The linux version is manual and requires following the instructions I wrote above. Windows is automatic.

Please test and give feedback.

@zoghal
Copy link
Author

zoghal commented May 24, 2024

ممنون چه خبر خوبی!🤓
اما متاسفانه ترافیک کلادفلر روی adsl های‌وب هنوز مسدود هست!

به محض آزاد شدن! حتما امتحانش می‌کنم.

@AliGh1
Copy link

AliGh1 commented May 24, 2024

Issue: Error Creating Interface Due to Missing wintun.dll

Description

When running warp-plus with the --tun-experimental flag, the process fails to create the interface due to a missing wintun.dll library. The error message indicates that the specified module could not be found.

Steps to Reproduce

  1. Execute warp-plus --tun-experimental in the terminal.
  2. Observe the log output.

Log Output

time=2024-05-24T14:00:57.839+03:30 level=INFO msg="tun mode enabled"
time=2024-05-24T14:00:57.846+03:30 level=INFO msg="successfully generated wireguard configuration" subsystem=warp/account
time=2024-05-24T14:00:57.848+03:30 level=INFO msg="successfully generated wireguard configuration" subsystem=warp/account
time=2024-05-24T14:00:57.848+03:30 level=INFO msg="using warp endpoints" endpoints="[188.114.99.106:8742 188.114.99.106:8742]"
time=2024-05-24T14:00:57.848+03:30 level=INFO msg="running in normal warp mode"
time=2024-05-24T14:00:57.850+03:30 level=ERROR msg="Error creating interface: Error loading wintun.dll DLL: Unable to load library: The specified module could not be found."

Expected Behavior

The interface should be created successfully without errors when warp-plus is run in experimental TUN mode.

Actual Behavior

The process fails with an error indicating that the wintun.dll module could not be found, preventing the creation of the interface.

Environment

  • Operating System: Windows 11
  • warp-plus version: v1.2.1
  • Configuration details: Running with --tun-experimental flag

@Soberia
Copy link

Soberia commented May 24, 2024

@AliGh1
Download Wintun driver and place it beside the warp-plus.exe.

@AliGh1
Copy link

AliGh1 commented May 24, 2024

@Soberia @markpash
Thanks for the guidance. To enhance the user experience, it would be helpful if the requirement to download the Wintun driver was included in the project's README or the Wintun driver directly in the project. This way, new users will have clear instructions on what they need to do.

@mldaali
Copy link

mldaali commented Jun 30, 2024

Hi @markpash
Is it possible to have a switch to set the tunnel name and create multiple tunnels simultaneously? I want to have another tunnel on the same server to route my traffic using the --gool feature, while the rest of the traffic goes through the primary tunnel (warp0) for better speed.

Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants
@zoghal @markpash @mldaali @Soberia @AliGh1 @Amir2367 and others