本帖最後由 gfx86674 於 2015-1-9 11:26 編輯
相信各位都知道RouterOS很早就支援OpenVPN(OVPN),
但設定iOS/Android可能不是清楚...
所以小弟整理一篇大家都看得懂的,讓各位不用懂腦筋去猜想該怎麼動手.
使用OVPN最基礎的是要建立憑證 ,
不過小弟不再提憑證是如何製做,而是直接開放給有緣人下載使用.
ca.crt /ca.key /client.crt /client.key
先把下載的ca.crt 與ca.key 拉放至winbox的files檔案夾 ,
再至/system certificates 用Import進行匯入.
先匯入ca.crt ,再匯入ca.key ,
匯入完成Certificate會標示KT
要使用OVPN Server ,當然得先開啟它
iOS/Android要指定使用OVPN的ip-mode ,
而Port可以自訂,小弟將原本預設Port:1194 變成現在的1195
修改/PPP Profile的default-encryption設定檔 ,將DNS-Server變更成您的Gateway
確保路由是經您的RouterOS主機查尋遞出的.
建立用戶的OVPN帳號
因ip-mode遮罩被固定為255.255.255.252不能變更 ,設DHCP-Pool意義不大.
所以直接在帳號指定Local/Remote Address .
也因遮罩限定255.255.255.252 ,所以不同帳號請用不同網段區分.
如範例的10.0.1.0/30 ,10.0.2.0/30 ,10.0.3.0/30 如此類推 ,
更禁用戶同帳號重覆登入Server.
若您是使用小弟所提供的憑證,接下只要打開電腦的記事本,
將下面的文字存為client.ovpn即可.- client
- dev tun
- remote 1.23.123.123 1195
- proto tcp
- auth-user-pass pw.txt
- redirect-gateway
- mute-replay-warnings
- ;ca.crt
- ;client.crt
- ;client.key
- <ca>
- -----BEGIN CERTIFICATE-----
- MIIDBDCCAm2gAwIBAgIJAM8oNFlxL3rSMA0GCSqGSIb3DQEBBAUAMGAxCzAJBgNV
- BAYTAlRXMQswCQYDVQQIEwJUVzEPMA0GA1UEBxMGVGFpcGVpMQ0wCwYDVQQKEwRo
- b21lMSQwIgYJKoZIhvcNAQkBFhV4eHh4eHh4eEB5YWhvby5jb20udHcwHhcNMTIx
- MjExMTYyNDIzWhcNMjIxMjA5MTYyNDIzWjBgMQswCQYDVQQGEwJUVzELMAkGA1UE
- C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G7fQmOpqH0e1
- jkRxlf1HUaXq3dCWEP2dQMSNIMfxJZjzW4brT/K9XZX/tZbR5YjaLDj8PQIDAQAB
- AoGAYhEUdq3c2QLm8mPvTTBpEZdSWsgLs++KnOJFh5mnRbwjVulM40WdbyH1/rq9
- anEksqIAH1fP2jfZavaV65ogVk1q8sSZ1JfY6m0SDlvlMryPmEHnuWbUIJsvmKRB
- nN/BwAkbbOB1s2uRHntgs+ktxVTATnre0iI+P5PVfmluKkECQQDx71mcrEvDSL6t
- MYPgmm99OoaCC0JuqNMbh1Qw2hMSzreCJFDeghPOwfYDcj235egXjuLdWJCNdsLk
- oTx72P+tAkEAzH/perm9Rq1M7UUhw+nKIJqFRyf+VtR1Wk3j4xQmbRfvBns2YjGR
- 4BB7FlVNyP94z/H1X6TZrrNHPMmjQVlA0QJAU2V9T2t5Bk0KJWt/GSpDKjjFawh0
- ku6xLrkchWZ20rHdQghAtCLEry3fHtr/eWfP9Gb1vvUrhwgcMHGABvULVQJAD67X
- lwPbkioENkYQ+tdZGvr+saBNjxcoEM7cZTPMZp1pRVP5rbojd82LwwCzwHBnMXta
- 2ATqdM1m7zB/hqlzoQJBAOM89P0LVPQrcKlp/fN+lIJQQli3jOsUwLNFYbWlqTr8
- sa3O2zc8OFj/aPlcSgvmm64H3z5Aa4Pld6lz58ic8bU=
- -----END RSA PRIVATE KEY-----
- </key>
複製代碼 注意remote 1.23.123.123 1195 是您的地址與port ,要修正成您的.
另外還得存pw.txt ,是存放用戶帳號/密碼用的.
第一行為用戶帳號 ,第二行則為密碼.iOS/Android裝置安裝OpenVPN Connect ,並將client.ovpn/pw.txt上傳並進行匯入
先關閉OpenVPN Connect的Force AES-CBC ciphersuites
若沒意外 ,iOS/Android接下來即順利與OVPN-Server連線.
|