Your setup is not completely defined.
I make this assumption:
PC A is already in the VPN and in the 192.168.. subnet.
So PC A can reach PC B normally.
The exact addresses of PC A and PC B in the local subnet are not given, unfortunately.
Since you don't have control over PC B you have to create a port forwarding on PC A for every port you want access at PC B.
On debian you should forward ports using iptables.
I have a similar setup with a opensuse machine that forwards RDP on PC B over the VPN.
This would be on PC A.
pc_b=192.168...
macbook=10.8.0.6
case "$1" in
'start')
iptables -F FORWARD
iptables -t nat -F
iptables -P FORWARD DROP
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
# VPN FORWARD of the RDP port (3389)
iptables -A FORWARD -p tcp -s $pc_b --sport 3389 -d $macbook -j ACCEPT
iptables -A FORWARD -p icmp -s $pc_b -d $macbook -j ACCEPT
iptables -A FORWARD -p tcp -d $pc_b --dport 3389 -s $macbook -j ACCEPT
iptables -A FORWARD -j REJECT
# RDP from VPN
iptables -t nat -A PREROUTING -i tun0 -p tcp --dport 3389 \
-j DNAT --to-destination $pc_b
;;
'stop')
iptables -F FORWARD
iptables -t nat -F
iptables -P FORWARD ACCEPT
echo 0 > /proc/sys/net/ipv4/ip_forward
;;
'status')
iptables -t nat -L PREROUTING
;;
esac
This script accepts start, stop and status and can be used in rc.d as a run-level script on PC A
tun0 is the VPN interface.
This will disallow any traffic between the 192.168.. subnet and the VPN except for the ports explicitely opened (3389 in this example).
You don't have to disallow all other forwarding, but I would recommend it.
This will also forward access to 10.8.0.7:3389 to 192.168..:3389.
If you don't want to use port forwarding, you have to change the routing on PC B somehow.
If you don't have access to PC B, then you need to route the traffic from the default gateway of PC B to the VPN.
One possibility is to route traffic for the VPN from the default gateway to PC A.
This only works if you use a different subnet at the location of the macbook than the one used between PC A and PC B
If you use some type of router with your macbook you probably also have a 192.168.. subnet there.
For this setup you don't use the previous script.
You still need
echo 1 > /proc/sys/net/ipv4/ip_forward
(same as sysctl -w net.ipv4.ipforward=1)
How to setup routing depends on the OS on the default gateway and your macbook.
In general it works like this:
On macbook (route to PC B):
route add 192.168.. gw 10.8.0.7
This only works if there is no 192.168.. local subnet already present for the macbook!
On the default gateway of PC B (route to VPN over PC A):
route add 10.8.0.6 gw 192.168..
Of course, since the internal subnet addresses of PC A and PC B are not given by the question, I can't give the exact routing information either.
PC AandPC Bin the 192.168.. subnet. What local subnet does the macbook use, or is no router involved at the macbook location? – JonnyJD Dec 31 '12 at 15:07