You can do Remote SSH Full TUN VPN (it will not just do one port
forwarding but all protocols) by Doing as below.

You can skip iptables part , these are for sharing connection from remote end.

You need to be root on the server machine .



>From Gentoo Wiki Archive:

http://www.gentoo-wiki.info/HOWTO_VPN_over_SSH_and_tun

Let's say that machine S will be the vpn server, and machine C will be
the vpn client

    * ssh into the machine S and change sshd_config:

File: /etc/ssh/sshd_config

PermitRootLogin yes
PermitTunnel yes
TCPKeepAlive yes # Not required but makes things much more stable.
This is default now

    * then restart ssh on the machine S and quit your current ssh connection
    * then ssh with this command from the machine C:

ssh -w 0:0 the_external_ip_of_machine_S

    * then inside the machine S do:

ifconfig tun0 10.0.0.1 netmask 255.255.255.0

note that the netmask is 255.255.255.255 by default so you must add
the netmask...

    * inside the machine C do:

ifconfig tun0 10.0.0.2 netmask 255.255.255.0

normally each machine could ping each others...

    * inside Machine A do:

echo "1" > /proc/sys/net/ipv4/ip_forward
echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
iptables  -t  nat  -A  POSTROUTING  -o  eth2  -j  MASQUERADE
iptables  -A  FORWARD -j  ACCEPT
iptables  -A  FORWARD  -j  ACCEPT

    * inside the machine B do:

route del default
route add default gw 10.0.0.1 tun0


On 11/23/10, G <[email protected]> wrote:
> Interesting, that makes sense. Except why does it seem to work so well
> with the built in web2py webserver but not apache. Is there a
> configuration setting in apache that would make it act more like the
> web2py server in this regard?
> Thanks for the response.
>
> On Nov 22, 2:15 pm, Phyo Arkar <[email protected]> wrote:
>> Yes thats happen for me too
>> seems that it is caused due to ssh tunnel is single connection where web
>> request open multiple connections.
>>
>> Try testing with a page with no external css/js and it will work fine.
>>
>> There may be work around for ssh-tunnel not doing multiple requests .
>>
>> On Tue, Nov 23, 2010 at 2:43 AM, G <[email protected]> wrote:
>> > Hello,
>> > I have a strange problem. My server is behind a fire wall so I must
>> > use ssh tunnels to access web2py pages running on it. This works great
>> > with the default webserver included with web2py. To achieve better
>> > performance, I have now installed apache and got web2py working with
>> > it after a few gotchas. Everything works fine on computers behind the
>> > firewall. But now when I view the pages through the ssh tunnel (at
>> >http://localhost:32197where 32197 is the port that is tunneled
>> > through ssh to the servers port 80), the pages do not seem to load
>> > completely. Refreshing the page repeatedly shows that the page loads
>> > to different points each time. Sometimes the page does load
>> > completely, but most often not. It seems that the various static/.js
>> > and .css files are often what fails to load all the way, though I've
>> > seen the main content also fail to load. Is there perhaps some (very
>> > short) timeout that is causing this somewhere? It would have to be
>> > very short as the page loads only take a fraction of a second. I am
>> > just testing with the basic welcome and admin apps. I have also
>> > forwarded port 443 and find the same behavior there.
>>
>> > Any ideas?
>> > Thanks,
>> > G
>>
>>

Reply via email to