I have got ubuntu 18 installed on a virtual machine. 2 virtual network adapters are connected to machine. 1 is for internet 1 is for share file with another virtual machine

when I connect ubuntu to a vpn server (special client of a private vpn, not open) over 1st network card, file share via samba on 2nd network card becomes unavailable. Each time when i want to share file, first i have to disconnect the vpn connection. So, without disconnection from vpn, would it be possible to share files over 2nd network card?


You are routing all your traffic via the 1st networkcard / vpn-server when you connect to your vpn.

You have at least two options now.

  1. Modify the vpn-server-config

    Chanage your server-config to not bypass your gateway anymore. In OpenVpn this option should be named

    push "redirect-gateway def1 bypass-dhcp"

    Delete or comment that option

  2. Modify your routing table

    Don't change the vpn-server config but write a new routing rule. Lets say your samba network is running at and your IP in that smb network is you could write a rule like this

    sudo ip route add via

    and the problem should be fixed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.