Route Network Interface To Specific Application
Discover how to route network interfaces to specific apps using Firejail or Dante and Proxychains-ng, while preventing dual WiFi connections. The guide offers step-by-step instructions for installation, configuration, and usage.
It is not advised to do so with dual WiFi connections, which is a pain in the ass in daily usage (only one of them will be used at a time).
Ethernet and WiFi dual connections seem fine with firejail but failed with dante.
Use firejail
1 | sudo firejail --net=wlan0 --ip=dhcp --noprofile <program cmd> |
Use dante and proxychains-ng
1 | sudo apt install dante-server proxychains-ng |
Now edit the dante config file at /etc/dante.conf:
1 | internal: eth0 port = 1080 |
Run the daemon by:
1 | danted |
Find the [ProxyList] section and add the following line in /etc/proxychains.conf:
1 | socks5 127.0.0.1 1080 root <root_password> |
Run the program with proxychains-ng:
1 | proxychains <program cmd> |
You can test your configuration like:
1 | curl -x socks5://root:root@127.0.0.1:1080 https://www.baidu.com |
If you run danted like systemctl start danted, you can configure a separate user for authentication. You have to change /etc/danted.conf and /etc/proxychains.conf accordingly.
1 | sudo useradd -r -s /bin/false your_dante_user |