Linux Server 18.04 installed vsftpd as my FTP server. This machine is also running openVPN, but when VPNs tun0 is active obviously my IP changes. Is there anyway i can route FTP traffic to connect to another machine on my network and direct it to the server like when i ssh via a jumpbox, or is there anyway to bind vsftpd to use my actual network and ignore tun0?

  • (1) Don't think in terms of "my IP". It's not a single one. Each network interface has an IP (or possibly several). (2) What you have is a routing problem, where you distinguish between FTP traffic and the rest. You can do this with (3) iptables and connection tracking, or, simpler, (4) create a network namespace, and run vsftpd in the namespace where tun0 and associated routing rules are not visible. – dirkt Jan 20 at 12:28
  • Let's assume I have no idea how to do any of that..... – zerikscythe Jan 21 at 0:26
  • If you have no idea how to do anything of that, please read up on networking basics, routing, network namespaces, and iptables. And plan some time for that. I could give a step-by-step description, but very likely it won't work in your particular configuration, and without understanding what is happening, you won't be able to debug it and make it work. Here is a related question about a bridged network namespace, if you want to experiment with namespaces. – dirkt Jan 21 at 6:52
  • OK, so following a tut on creating namespaces i have done such ns1, i can now load a program in the namespace, to only see 1 interface device of which i have 2. eth0 & tun0. loading a service seems to work just fine, and if tun0 is removed say by killing the vpn service my program does indeed drop... however it somehow rebinds to eth0 after about 45 seconds... why? i though when i created the v-link to tun0 and added the iptable Allow/Rejects eth0 should in theory be "invisible"... – zerikscythe Jan 21 at 9:43
  • i did this step by step only dff is where the code says eth0 i replaced it with tun0 blogs.igalia.com/dpino/2016/04/10/network-namespaces – zerikscythe Jan 21 at 9:48

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.