歡迎您光臨本站 註冊首頁

在分支機構能連上VPN服務端

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

在分支機構能連上VPN服務端

在分支機構能連上VPN服務端

客戶端IP段192。168。10。0
在客戶端能PING通服務端的虛擬ip10.8.0.1及真實的IP192。168。10。111

但是ping不通,服務端所在的網路局的其他的機子,

好像要加什麼參數是服務端,還是在客戶端加參數啊,?

跟我說一下加在哪個端及加什麼配置謝謝啊,
《解決方案》

# 下面這句使客戶端能訪問伺服器後面的子網機器
# 比如:伺服器子網網段是192.168.10.0和192.168.10.2
# 你需要在openVPN伺服器端配置文件中添加下面這兩句
push "route 192.168.10.0 255.255.255.0"


# 使伺服器子網內機器可以訪問客戶端子網內機器
# 僅用於路由模式
# 假設:客戶端子網網段192.168.40.0
# 首先,在伺服器配置文件中添加下面這兩行
#     client-config-dir ccd
#   和route 192.168.40.0   255.255.255.0
# 然後在伺服器端ccd目錄下創建一個文件,文件名是客戶端的公共名
# 文件內容是:
#     iroute 192.168.40.0   255.255.255.0
;client-config-dir ccd
;route 192.168.40.0   255.255.255.0


push "route 192.168.10.0 255.255.255.0"
上面這條配置參數我寫在服務端了哦,


這個參數我加了啊,為什麼192。168。10。2/192。168。10。4還是PING不能啊,?
《解決方案》

服務端配置:



port 1194


proto udp


dev tun



ca ca.crt   #OpenVPN使用的ROOT CA,使用build-ca生成的,用於驗證客戶是證書是否合法
cert server01.crt #Server使用的證書文件
key server01.key   #Server使用的證書對應的key,該文件必須嚴格控制其安全性


dh dh1024.pem


server 10.8.0.0 255.255.255.0


ifconfig-pool-persist ipp.txt



# 下面這句使客戶端能訪問伺服器後面的子網機器
# 比如:伺服器子網網段是192.168.10.0和192.168.10.2
# 你需要在openVPN伺服器端配置文件中添加下面這兩句
push "route 192.168.10.0 255.255.255.0"
;push "route 192.168.1.0 255.255.255.0"

# 使伺服器子網內機器可以訪問客戶端子網內機器
# 僅用於路由模式
# 假設:客戶端子網網段192.168.40.0
# 首先,在伺服器配置文件中添加下面這兩行
#     client-config-dir ccd
#   和route 192.168.40.0   255.255.255.0
# 然後在伺服器端ccd目錄下創建一個文件,文件名是客戶端的公共名
# 文件內容是:
#     iroute 192.168.40.0   255.255.255.0
;client-config-dir ccd
;route 192.168.40.0   255.255.255.0


# EXAMPLE: Suppose you want to give
# Thelonious a fixed VPN IP address of 10.9.0.1.
# First uncomment out these lines:
;client-config-dir ccd
;route 10.9.0.0 255.255.255.252
# Then add this line to ccd/Thelonious:
#   ifconfig-push 10.9.0.1 10.9.0.2

# 支持對不同客戶端組執行不同的防火牆策略
# 這裡有兩種方法
# (1) 運行多個OpenVPN守護進程, 每個對應不同的組
#     並且防火牆對不同的組和進程執行不同的策略
# (2) (高級)創建1個動態腳本使防火牆對接入的不同客戶端執行不同的策略
;learn-address ./script


# 下面這句使客戶端所有網路通信通過vpn
# If enabled, this directive will configure
# all clients to redirect their default
# network gateway through the VPN, causing
# all IP traffic such as web browsing and
# and DNS lookups to go through the VPN
# (The OpenVPN server machine may need to NAT
# the TUN/TAP interface to the internet in
# order for this to work properly).
# CAVEAT: May break client's network config if
# client's local DHCP server packets get routed
# through the tunnel.   Solution: make sure
# client's local DHCP server is reachable via
# a more specific route than the default route
# of 0.0.0.0/0.0.0.0.
;push "redirect-gateway"

# 客戶端DHCP設置
# Certain Windows-specific network settings
# can be pushed to clients, such as DNS
# or WINS server addresses.   CAVEAT:
# http://openvpn.net/faq.html#dhcpcaveats
;push "dhcp-option DNS 10.8.0.1"
;push "dhcp-option WINS 10.8.0.1"

# 下面這句使客戶端能相互訪問
# 否則,默認設置下客戶端間不能相互訪問
client-to-client

# 這段常用於測試用途,註釋該條可實現限制一個證書在同一時刻只能有一個客戶端接入
# Uncomment this directive if multiple clients
# might connect with the same certificate/key
# files or common names.   This is recommended
# only for testing purposes.   For production use,
# each client should have its own certificate/key
# pair.
# IF YOU HAVE NOT GENERATED INDIVIDUAL
# CERTIFICATE/KEY PAIRS FOR EACH CLIENT,
# EACH HAVING ITS OWN UNIQUE "COMMON NAME",
# UNCOMMENT THIS LINE OUT.
;duplicate-cn

# 活動連接保時期限
# The keepalive directive causes ping-like
# messages to be sent back and forth over
# the link so that each side knows when
# the other side has gone down.
# Ping every 10 seconds, assume that remote
# peer is down if no ping received during
# a 120 second time period.
keepalive 10 120

# 為防止遭到DDoS攻擊
# 生成ta.key文件,並cp到伺服器端和每個客戶端
# 該文件用以下命令生成
# openvpn --genkey --secret ta.key
# 伺服器端0,客戶端1
# 該文件要嚴格保護
tls-auth ta.key 0 # 伺服器端是0


auth-user-pass-verify checkpsw.exe via-env
client-cert-not-required
username-as-common-name

# 選擇一種加密演算法,Server端和client端必須一樣
# Select a cryptographic cipher.
# This config item must be copied to
# the client config file as well.
;cipher BF-CBC         # Blowfish (default)
;cipher AES-128-CBC   # AES
;cipher DES-EDE3-CBC   # Triple-DES

# 允許數據壓縮
# 客戶端配置文件也需要有這項
comp-lzo

# 最大客戶端併發連接數量
;max-clients 100

#定義運行openvpn的用戶
user nobody
group nobody

#通過keepalive檢測超時后,重新啟動VPN,不重新讀取keys,保留第一次使用的keys
persist-key
#通過keepalive檢測超時后,重新啟動VPN,一直保持tun或者tap設備是linkup的,
#否則網路連接會先linkdown然後linkup
persist-tun

#定期把openvpn的一些狀態信息寫到文件中,以便自己寫程序計費或者進行其他操作
status status.log

#記錄日誌,每次重新啟動openvpn后刪除原有的log信息
;log         openvpn.log  
#或者
#記錄日誌,每次重新啟動openvpn后追加原有的log信息
;log-append   openvpn.log   #[為便於管理log可將該項改為/var/log/openvpn.log]

# 設置日誌記錄冗長級別
# Set the appropriate level of log
# file verbosity.
#
# 0 is silent, except for fatal errors
# 4 is reasonable for general usage
# 5 and 6 can help to debug connection problems
# 9 is extremely verbose
verb 3

# 重複日誌記錄限額
# Silence repeating messages.   At most 20
# sequential messages of the same message
# category will be output to the log.
mute 20
《解決方案》

客戶端配置:



client

dev tun

port 1194
proto udp


remote jet.vicp.net 1194
;remote my-server-2 1194


;remote-random


resolv-retry infinite


nobind


user nobody
group nobody


route 192.168.10.0 255.255.255.0
persist-key
persist-tun


ca ca.crt


auth-user-pass

ns-cert-type server


tls-auth ta.key 1

# 選擇一種加密演算法,必需和伺服器端一致
;cipher x

# 允許數據壓縮
# 這項和伺服器配置文件一樣
comp-lzo

# 設置日誌記錄冗長級別
verb 3

# 重複日誌記錄限額
mute 20

[火星人 ] 在分支機構能連上VPN服務端已經有305次圍觀

http://coctec.com/docs/service/show-post-33333.html