At home I use a VPN and to share it with other devices I use the computer which connects to the VPN as access point for a second LAN, but I don't want all the traffic be routed through the VPN: I want to be able to choose whether to use plain internet or the VPN, so I have the following setting:
- My router is connected to my ISP and, on the local side, creates a LAN on the private addresses 10.10.10.* and it is the gateway with address 10.10.10.10 for the LAN
- My pc (which runs ubuntu and has local address 10.10.10.100) is connected to the router via wifi and it is connected to my VPN provider
- The same pc has a wifi dongle which is configured to be the access point for another LAN on the addresses 192.168.23.* (and the pc is the gateway for this LAN with address 192.168.23.1)
This way I have two LANs: one which connects directly to the internet (10.10.10.* ) and another which connects through the VPN (192.168.23.* ).
Also, I have another PC which is a DLNA server for the 10.10.10.* LAN and a smarttv which connects to the VPN.
Summing up:
- 10.10.10.10: main router
- 10.10.10.23: pc1 with a DLNA server
- 10.10.10.100: wlan0 on pc2, connected to VPN
- 192.168.23.1: wlan1 on pc2
- 192.168.23.10: smarttv
To manage the traffic on pc2 I use this rule:
iptables -t nat -A POSTROUTING -s 192.168.23.0/24 -o wlan0 -j MASQUERADE
and the routing rules are
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 10.175.1.5 0.0.0.0 UG 0 0 0 tun0
10.10.10.0 * 255.255.255.0 U 9 0 0 wlan0
10.175.1.1 10.175.1.5 255.255.255.255 UGH 0 0 0 tun0
10.175.1.5 * 255.255.255.255 UH 0 0 0 tun0
h88-150-252-230 10.10.10.10 255.255.255.255 UGH 0 0 0 wlan0
192.168.23.0 * 255.255.255.0 U 0 0 0 wlan1
Everything works fine.
Namely, from my smarttv (and any other device connected on the 192.168.23.*) I see the internet through the VPN whereas devices connected to the router get plain access to the internet.
The problem is that the tv doesn't see the DLNA server and the question is: is it possible to set it up in such a way that the tv can reach the DLNA server?