Answer the question
In order to leave comments, you need to log in
How to connect to machines with one ip?
Good afternoon.
Please tell me how to solve the issue. There are two machines, one as a vpn server, the second with connected vpn. They get the same ip. How it is possible to be connected on new ip to these machines from outside?
Answer the question
In order to leave comments, you need to log in
If everything is configured correctly, then no - it does not work that they have the same ip.
They get the same ip
If you have a VPN server with a white IP, and a VPN client behind it with a gray IP (for example, 212.213.214.215 (eth0) is the server, 10.8.0.1 (tun0) is the server behind the VPN, 10.8.0.2 (tun0) is the client ) - you will need to forward the port through iptables on the server in order to connect from the Internet to the computer for VPN.
For example like this:
iptables -t nat -A PREROUTING -d 212.213.214.215/32 -p tcp -m tcp --dport 62000 -j DNAT --to-destination 10.8.0.2:62000
iptables -t nat -A PREROUTING -d 212.213.214.215/32 -p udp -m udp --dport 62000 -j DNAT --to-destination 10.8.0.2:62000
iptables -t nat -A POSTROUTING -d 10.8.0.2/32 -p tcp -m tcp --sport 62000 -j SNAT --to-source 212.213.214.215:62000
iptables -t nat -A POSTROUTING -d 10.8.0.2/32 -p udp -m udp --sport 62000 -j SNAT --to-source 212.213.214.215:62000
for i in /proc/sys/net/ipv4/conf/*/rp_filter ; do echo 0 > $i ; done
sed -i 's/net.ipv4.conf.default.rp_filter=2/net.ipv4.conf.default.rp_filter=0/g' /etc/sysctl.d/10-network-security.conf
sed -i 's/net.ipv4.conf.all.rp_filter=2/net.ipv4.conf.all.rp_filter=0/g' /etc/sysctl.d/10-network-security.conf
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question