ctunnel icon indicating copy to clipboard operation
ctunnel copied to clipboard

I tried to use vpn, still one thing i don't understand

Open momiji opened this issue 4 years ago • 1 comments

Hello, I have 2 networks I want to connect together: server A - public ip A, private ip 11.0.0.1, other servers with ips 11.0.0.2, ... server B - public ip B, private ip 12.0.0.1, other servers with ips 12.0.0.2, ...

I started ctunnel like this: server A: ctunnel -V -t 8 -i 1.0.0 -n -s -l 0.0.0.0:5001 -C aes-128-cfb -r 11.0.0.0/25 server B: ctunnel -V -t 8 -i 1.0.0 -n -c -f ip_A:5001 -C aes-128-cfb -r 12.0.0.0/25

I can ping 12.0.0.1 from A and 11.0.0.1 from B with no issue, however I can't figure why pinging other servers does not work. from A: ping 12.0.0.2 returns Destination Host Prohibited from B: ping 11.0.0.1 returns the same

Do you have any idea ? Is it something related to iptables, where I should do something, but really don't know what :) I looked at the example, but couldn't understand what it was for.

By the way, great work :)

momiji avatar Dec 06 '19 00:12 momiji

Please make sure that ip forwarding on both machines is enabled.

cat /proc/sys/net/ipv4/ip_forward
1

0 = IP Forwarding is disabled. 1 = IP Forwarding is enabled.

To enabled IP Forwarding:

echo 1 > /proc/sys/net/ipv4/ip_forward

Routing

Hosts on either side of your VPN need to know how to get to their respective destination networks. This requires setting up routing tables either per-host, or on each network's default gw.

For instance: Machines behind 'server B', no nothing about the 11.0.0.0/24 network. Packets on the 'server B' network will traverse the default gateway, so machines on your network need to know that packets destined for 11.0.0.0/24 are handled by the ctunnel VPN

On server A's network, you need a static route that points to server B's network with a gateway of 11.0.0.1 On server B's network, you need a static route that points to server A's network with a gateway of 12.0.0.1

alienrobotarmy avatar Jan 02 '20 18:01 alienrobotarmy