ntop / n2n

Peer-to-peer VPN
GNU General Public License v3.0
6.05k stars 925 forks source link

Help extends from the entire office network to the entire home network #1155

Open ld-2022 opened 8 months ago

ld-2022 commented 8 months ago

I configured the following based on the document Routing.md

office(192.168.1.0/24)

eth0:192.168.1.220 StarVPN:192.168.188.62

Usage steps
  1. sysctl -w net.ipv4.ip_forward=1
  2. iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
  3. nohup ./n2n -a 192.168.188.62 -c -k -l :6262 -f -r -v -d StarVPN > test.log 2>&1 &
  4. iptables -A FORWARD -i eth0 -o StarVPN -m state --state RELATED,ESTABLISHED -j ACCEPT
  5. iptables -A FORWARD -i StarVPN -o eth0 -j ACCEPT
  6. ./n2n-route -n 192.168.100.0/24 192.168.188.63

home (192.168.100.0/24)

eth0:192.168.100.107 StarVPN:192.168.188.63

Usage steps
  1. sysctl -w net.ipv4.ip_forward=1
  2. iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
  3. nohup ./n2n -a 192.168.188.63 -c -k -l :6262 -f -r -v -d StarVPN > test.log 2>&1 &
  4. iptables -A FORWARD -i eth0 -o StarVPN -m state --state RELATED,ESTABLISHED -j ACCEPT
  5. iptables -A FORWARD -i StarVPN -o eth0 -j ACCEPT
  6. ./n2n-route -n 192.168.1.0/24 192.168.188.62

present situation

Company machine: eth0:192.168.1.220 can access home 192.168.100.0/24 Home machine: eth0:192.168.100.107 You can also access the company 192.168.1.0/24

problem

I want to access my home network (192.168.100.0/24) on company machine: eth0: 192.168.1.225 I have already configured: IP route add 192.168.100.0/24 via 192.168.1.220 dev eth0 src 192.168.1.215 on the company machine: eth0: 192.168.1.225

root@office225:~# ip route default via 192.168.1.1 dev eth0 proto static 172.16.1.0/24 dev eth1 proto kernel scope link src 172.16.1.16 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.225 192.168.100.0/24 via 192.168.1.220 dev eth0 src 192.168.1.225

But I am unable to connect to 192.168.100.1. It is known that I can connect on 192.168.1.220. May I know where the problem is with my configuration? thanks