0

I am using raspberry as an OpenVPN client to connect to other networks. My routing table on that machine is:

root@raspberrypi:~# ip route list
default via 192.168.1.1 dev eth0  metric 202
10.1.0.0/24 via 10.1.0.1 dev tun0
10.1.0.1 dev tun0  proto kernel  scope link  src 10.1.0.30
10.10.10.0/24 via 10.1.0.1 dev tun0
192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.101  metric 202
192.168.88.0/24 via 10.1.0.1 dev tun0

Everything works fine, but I would like raspberry to access the internet ONLY through VPN, but in the same time I still want it to be accessible from LAN (192.168.1.0/24). I don't want to use "redirect-gateway def1" in config, as it "disappears from LAN". How can I achieve that?

5
  • two network interfaces?
    – jiggunjer
    Jan 4, 2018 at 2:22
  • What hinders you to use a firewall like ufw (based on iptables)?
    – GiantTree
    Jan 4, 2018 at 7:55
  • @jiggunjer only 1 physical interface. ifconfig gives: eth0 (192.168.1.101), lo (127.0.0.1), tun0 (10.1.0.30)
    – matiaszon
    Jan 4, 2018 at 8:27
  • @GiantTree you suggest to use ufw? Never tried, so I don't know that too.
    – matiaszon
    Jan 4, 2018 at 8:31
  • ufw is simply a front-end to iptables. I use it to block all outgoing traffic that doesn't go through a VPN (tun0) unless is comes or goes to my local network. It's not too complicated to setup (ufw is an abbreviation of "uncomplicated firewall" for a reason).
    – GiantTree
    Jan 4, 2018 at 9:16

0

You must log in to answer this question.

Browse other questions tagged .