Hello,
I been running OpenVPN on my dedicated server just fine. I tried to install an OpenVPN on shared server with shared IP on OpenVZ. I can connect fine but no internet connection.
below my settings
# Flush existing rules from iptables.
# IF YOU HAVE PREEXISTING RULES, DON'T DO THIS
# I MEAN IT
/sbin/iptables -F
# Allow all outgoing packets
/sbin/iptables -P OUTPUT ACCEPT
# Allow packets that are from an established connection
/sbin/iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
# Allow packets coming from the VPN IP address range
/sbin/iptables -A FORWARD -s 10.9.0.0/24 -j ACCEPT
# Reject all other packets from other sources - in theory unnecessary, but good for security
/sbin/iptables -A FORWARD -j REJECT
# Perform NATing on outgoing packets to change the IP address the packets come from
/sbin/iptables -t nat -A POSTROUTING -s 10.9.0.0/24 -j SNAT --to-source my.open.fz.ip.address
# Accept the OpenVPN connection (UDP on port 1194)
/sbin/iptables -A INPUT -p udp --dport 1194 -j ACCEPT
# Accept ICMP packets
/sbin/iptables -A INPUT -p icmp -j ACCEPT
# Accept everything on the loopback interface
/sbin/iptables -A INPUT -i lo -j ACCEPT
# Accept everything coming from the OpenVPN adaptor
/sbin/iptables -A INPUT -i tun0 -j ACCEPT
# Accept packets from an established connection
/sbin/iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Save the firewall rules so they persist beyond a reboot
/sbin/service iptables save
I tried also adding
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
my settings iptables --table nat --list
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
PREROUTING_direct all -- anywhere anywhere
PREROUTING_ZONES_SOURCE all -- anywhere anywhere
PREROUTING_ZONES all -- anywhere anywhere
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
POSTROUTING_direct all -- anywhere anywhere
POSTROUTING_ZONES_SOURCE all -- anywhere anywhere
POSTROUTING_ZONES all -- anywhere anywhere
SNAT all -- 10.9.0.0/24 anywhere to:my.open.fz.ip.address
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
OUTPUT_direct all -- anywhere anywhere
Chain OUTPUT_direct (1 references)
target prot opt source destination
Chain POSTROUTING_ZONES (1 references)
target prot opt source destination
POST_public all -- anywhere anywhere [goto]
Chain POSTROUTING_ZONES_SOURCE (1 references)
target prot opt source destination
POST_trusted all -- anywhere 10.8.0.0/24
Chain POSTROUTING_direct (1 references)
target prot opt source destination
SNAT all -- 10.8.0.0/24 !10.8.0.0/24 to:my.open.fz.ip.address
Chain POST_public (1 references)
target prot opt source destination
POST_public_log all -- anywhere anywhere
POST_public_deny all -- anywhere anywhere
POST_public_allow all -- anywhere anywhere
Chain POST_public_allow (1 references)
target prot opt source destination
Chain POST_public_deny (1 references)
target prot opt source destination
Chain POST_public_log (1 references)
target prot opt source destination
Chain POST_trusted (1 references)
target prot opt source destination
POST_trusted_log all -- anywhere anywhere
POST_trusted_deny all -- anywhere anywhere
POST_trusted_allow all -- anywhere anywhere
Chain POST_trusted_allow (1 references)
target prot opt source destination
Chain POST_trusted_deny (1 references)
target prot opt source destination
Chain POST_trusted_log (1 references)
target prot opt source destination
Chain PREROUTING_ZONES (1 references)
target prot opt source destination
PRE_public all -- anywhere anywhere [goto]
Chain PREROUTING_ZONES_SOURCE (1 references)
target prot opt source destination
PRE_trusted all -- 10.8.0.0/24 anywhere
Chain PREROUTING_direct (1 references)
target prot opt source destination
Chain PRE_public (1 references)
target prot opt source destination
PRE_public_log all -- anywhere anywhere
PRE_public_deny all -- anywhere anywhere
PRE_public_allow all -- anywhere anywhere
Chain PRE_public_allow (1 references)
target prot opt source destination
Chain PRE_public_deny (1 references)
target prot opt source destination
Chain PRE_public_log (1 references)
target prot opt source destination
Chain PRE_trusted (1 references)
target prot opt source destination
PRE_trusted_log all -- anywhere anywhere
PRE_trusted_deny all -- anywhere anywhere
PRE_trusted_allow all -- anywhere anywhere
Chain PRE_trusted_allow (1 references)
target prot opt source destination
Chain PRE_trusted_deny (1 references)
target prot opt source destination
Chain PRE_trusted_log (1 references)
target prot opt source destination