Iptables configuration of openvpn in Ubuntu

Source: Internet
Author: User
Installing openvpn in Ubuntu is simple. apt-getinstallopenvpn is followed by buildkey and server and client configuration. For details about how to maintain the dns on the openvpn server, refer to/etc/resolv. after openvpn is installed in conf, save it ~ /Iptables-init.sh, and then run to iptables-tnat-APOSTROUTING-s1

Installing openvpn in Ubuntu is simple. apt-get install openvpn.

Build key, server, and client configuration. For more information, see openvpn maintenance.

The DNS information on the server can be obtained from/etc/resolv. conf.
After openvpn is installed, save the following part ~ /Iptables-init.sh, and then run

Iptables-t nat-a postrouting-s 10.8.0.0/24-o eth0-j MASQUERADE
Iptables-a input-I lo-p all-j ACCEPT
Iptables-a input-p all-m state -- state RELATED, ESTABLISHED-j ACCEPT
Iptables-a input-I tun +-j ACCEPT
Iptables-a forward-I tun +-j ACCEPT
Iptables-a input-p tcp-m tcp -- dport 465-j ACCEPT
Iptables-a input-p tcp-m tcp -- dport 110-j ACCEPT
Iptables-a input-p tcp-m tcp -- dport 25-j ACCEPT
Iptables-a input-p tcp-m tcp -- dport 22-j ACCEPT
Iptables-a input-p udp -- dport 1194-j ACCEPT
Iptables-a input-s 10.8.0.0/24-p all-j ACCEPT
Iptables-a forward-d 10.8.0.0/24-j ACCEPT
Iptables-a input-p tcp-m tcp -- dport 22-j ACCEPT

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.