Post

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.

From Clash to V2RayN: Unlocking SOCKS5

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โ€

firefox_network_setting_v2ray

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 and 8.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

LineMeaning
nameserver 127.0.0.53Stub resolver - systemd-resolved interception
options edns0 trust-adExtended 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)

AppResult
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โ€ฆ

Support me on Ko-fi
This post is licensed under CC BY 4.0 by the author.