From Clash to V2RayN: Unlocking SOCKS5
A smooth walkthrough switching from Clash to V2RayN on Linux: fixing port conflicts, bypassing ads on Spotify, and fine-tuning SOCKS5 proxy magic that just works.
So recently, Clash has been performing well based on this setup.
But I ran into an issue when switching to V2Ray.
(v2rayN on Pop_OS, if that matters.)
I could connect to my node just fine on my phone - but not on my PC.
And when I tested all node delays in v2rayN, they all looked normal and green.
So, based on the previous setup, Iβm gonna troubleshoot a few key points
to make sure we can switch to V2Ray smoothly.
πͺ Proxy port setup
Check out your V2Ray mixed port(normally it should be 10808).
Edit your ~/.bashrc
or ~/.zshrc
and Comment the proxy setup for Clash, add one for v2rayN export all_proxy="socks5://127.0.0.1:10808"
.
1
2
3
4
5
6
7
# π© Clash Proxy for tools like curl/pip
#export http_proxy="http://127.0.0.1:7892"
#export https_proxy="http://127.0.0.1:7892"
#export all_proxy="socks5://127.0.0.1:7891"
# π© v2rayN Proxy for tools like curl/pip
export all_proxy="socks5://127.0.0.1:10808"
Use this alias if youβve used my previous setup.
1
git-proxy-v2ray
Or if not:
1
git config --global http.proxy http://127.0.0.1:10808 && git config --global https.proxy http://127.0.0.1:10808
Then reload:
1
source ~/.zshrc
or
1
source ~/.bashrc
π§ͺ Test with:
1
curl -x socks5h://127.0.0.1:10808 https://api.myip.com
Failed with error code: 1005
? Check if this part helps!
π¦ Make Firefox obey proxy
Go to:
Firefox β Settings β Network Settings β Manual Proxy Configuration Set:
- SOCKS Host:
127.0.0.1
- Port:
10808
- No proxy for:
localhost, 127.0.0.1
- Check βProxy DNS when using SOCKS v5β
Now test your IP & DNS servers with BrowserLeaks - it should work instantly.
π’ TUN Conflict Check (if you used Clash before)
Check if thereβs leftover tun0
or custom route:
1
2
ip a
ip r
If you see 198.18.x.x
, fake-ip
, or utun
, kill them:
1
2
3
4
sudo ip link delete tun0
sudo ip rule flush
sudo ip route flush table main
sudo systemctl restart NetworkManager
π§Ή Lock in Clean DNS
If youβre running systemd-resolved
, and your DNS is:
1
nameserver 127.0.0.53 β stub resolver (systemd-resolved)
Yet behind the scenes, itβs actually forwarding to router,
for example, static:
1
2
1.1.1.1
8.8.8.8
Now Just change /etc/resolv.conf
(keep systemd-resolved)
1
2
3
sudo rm /etc/resolv.conf # Remove symlinked `resolv.conf`
echo -e "nameserver 1.1.1.1\nnameserver 8.8.8.8" | sudo tee /etc/resolv.conf # Create static one
sudo chattr +i /etc/resolv.conf # Make it immutable (no more random override!)
Change
1.1.1.1
and8.8.8.8
to your router DNS.
π if you ever wanna revert:
1
2
sudo chattr -i /etc/resolv.conf
sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
This is totally safe and revertible. This way you skip the stub resolver, send DNS direct to your routerβs DNS servers (e.g. Cloudflare/Google).
β About the 3 lines in /etc/resolv.conf
Line | Meaning |
---|---|
nameserver 127.0.0.53 | Stub resolver - systemd-resolved interception |
options edns0 trust-ad | Extended DNS flags - fine to keep or ignore |
search . | Domain search - totally safe to remove or leave, it does nothing here |
You only really need to change the nameserver
to your desired DNS.
π§ͺ Final test: sudo reboot
+ launch v2rayN + use SOCKS
1
curl -x socks5h://127.0.0.1:10808 https://api.myip.com
Get error code: 1005
?
Try these:
1
2
3
4
5
6
7
8
9
10
11
curl -x socks5h://127.0.0.1:10808 https://httpbin.org/ip
# Set Custom User-Agent
curl -A "Mozilla/5.0" -x socks5h://127.0.0.1:10808 https://icanhazip.com
# Try one of these known good APIs:
curl -x socks5h://127.0.0.1:10808 https://ifconfig.me
curl -x socks5h://127.0.0.1:10808 https://ipinfo.io/ip
curl -x socks5h://127.0.0.1:10808 https://icanhazip.com
curl -x socks5h://127.0.0.1:10808 https://wtfismyip.com/text
π What Is Cloudflare error 1005
?
That means:
π Access Denied - Your IP has been flagged (by WAF, rate-limits, or country ban)
Cloudflare does this:
- If the IP is in a VPN range
- If the proxy IP is suspicious (many access requests)
- If your TLS signature, headers, or behavior looks bot-like
- Or if the site owner blocks entire countries
api.myip.com uses Cloudflare, and your nodeβs IP is probably on a list if you got error code: 1005
.
π§ All set! Whatβs Working Flawlessly Now (Based on my test)
App | Result |
---|---|
Discord | β YES |
Spotify(flatpak) | β YES (No Proxy) |
Chrome | β YES |
Telegram | β YES (needs SOCKS5 manually configured, similar with firefoxβs) |
VSCode Git | β YES |
HexChat | β YES |
Firefox | π Set manually or use system proxy settings |
π΅ Hereβs the Spicy one - About Spotify ads
So far, Iβve found two actually useful ways to block Spotify ads.
- Spotify Web + uBlock Origin
- Spotify Desktop: Route it through your V2Ray proxy - exactly what we set up earlier!
β Spotify Desktop = NO ads, but only when itβs running through V2RayN + private & clean nodes.
β Clash Verge + Rule mode? That doesnβt phreakinβ work.
What might be going on inside SOCKS5?
Honestly, Iβd love to knowβ¦