Created
May 9, 2021 01:11
-
-
Save imWildCat/f1b2e38215d967f365d86db6db900956 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config openvpn 'myvpn' | |
option dev 'tun' | |
option topology 'subnet' # This is important | |
option comp_lzo 'adaptive' | |
option ca '/etc/openvpn/ca.crt' | |
option dh '/etc/openvpn/dh.pem' | |
option cert '/etc/openvpn/server.crt' | |
option key '/etc/openvpn/server.key' | |
option persist_key '1' | |
option persist_tun '1' | |
option user 'nobody' | |
option group 'nogroup' | |
option max_clients '10' | |
option keepalive '10 120' | |
option verb '3' | |
option status '/var/log/openvpn_status.log' | |
option push 'dhcp-option DNS 192.168.1.2' # Push your gateway (旁路由) IP address | |
option client_connect '/etc/openvpn/push_routing_rule' # Must push this rule | |
option script_security '2' | |
option log '/var/log/openvpn_multiple_client.log' | |
option proto 'udp4' | |
option port '12345' # your openvpn port. Remember to add a port forwarding rule on your main router | |
option ddns '[your_ddns_domain]' # If not set, you could also use your public IP | |
option server '10.0.2.0 255.255.255.0' | |
option mssfix '1420' | |
option client_to_client '1' | |
option enabled '1' | |
option duplicate_cn # allow multiple-clients (can be turned off) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo push \"route-delay 10\" > $1 | |
echo push \"route 192.168.1.0 255.255.255.0 $ifconfig_pool_local_ip\" >> $1 | |
echo push \"route 10.0.2.0 255.255.255.0 $ifconfig_pool_local_ip\" >> $1 | |
echo push \"redirect-gateway def1\" >> $1 | |
# Note: | |
# `192.168.1.0` is the IP range of the DHCP service on your main router | |
# `10.0.2.0` is the IP range of your OpenVPN service | |
# Please adjust the above two IP addresses |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment