作者 主題: 想請教大家,openVPN Server架在台灣,如果是從大陸連線回台灣,有辦法讓上網也透過台灣上嗎?  (閱讀 7429 次)

0 會員 與 1 訪客 正在閱讀本文。

fireflybug

  • 憂鬱的高中生
  • ***
  • 文章數: 145
    • 檢視個人資料
這篇文章是 Brazilfw 建置 OpenVPN Server 與 Windows XP 用戶端連入 VPN
http://www.mml.com.tw/block/forum/index.php?action=forum_topicdetail&page=forum_topicdetail&f=431&t=135224

想請教大家,openVPN Server架在台灣,如果是從大陸連線回台灣,有辦法讓上網也透過台灣上嗎?

rainday

  • 鑽研的研究生
  • *****
  • 文章數: 740
  • 性別: 男
  • enhancing and optimizing
    • 檢視個人資料
上網是指瀏覽器的部份嗎?
封包流向台灣,再調整route and firewall , 即可
<0  =_=  Don't learn to hack , hack to learn.

fireflybug

  • 憂鬱的高中生
  • ***
  • 文章數: 145
    • 檢視個人資料
上網是指瀏覽器的部份嗎?
封包流向台灣,再調整route and firewall , 即可

請問我連到 openvpn 後,抓到的IP是 10.8.0.2 GW 10.8.0.1

route print如下:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0         10.8.0.1        10.8.0.2       1
      10.10.100.0    255.255.255.0         10.8.0.1        10.8.0.2       1

可以正常連到 10.10.100.0網段。

但是如果我把DF GW設成10.8.0.1 如下,就整個不能連線,不知道是那邊出問題。

Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0         10.8.0.1        10.8.0.2       1
          0.0.0.0          0.0.0.0     10.10.10.254     10.10.10.39       30
      10.10.100.0    255.255.255.0         10.8.0.1        10.8.0.2       1

BrazilFW防火牆我試著全開了,還是不能透過 openvpn 的連線出去外面,tracert 168.95.1.1會卡在 10.8.0.1 之後的節點,但是 tracert 10.10.100.1 則會經過 10.8.0.1節點後可順利到達 10.10.100.1。
« 上次編輯: 2010-03-24 14:13 由 fireflybug »

dark

  • 俺是博士!
  • *****
  • 文章數: 1581
    • 檢視個人資料
看了一下 Brazilfw 似乎也是 linux ... 也是 iptables
還要在 Brazilfw 多設
-i tun? -o internet -j nat
或用
-s 10.8.0.2

但問題是怎麼每次取得同介面或同 IP , 不然要動態改 iptables

fireflybug

  • 憂鬱的高中生
  • ***
  • 文章數: 145
    • 檢視個人資料
看了一下 Brazilfw 似乎也是 linux ... 也是 iptables
還要在 Brazilfw 多設
-i tun? -o internet -j nat
或用
-s 10.8.0.2

但問題是怎麼每次取得同介面或同 IP , 不然要動態改 iptables


網路上找到這篇,先試試看。

Here you should can connect with OpenVPN server thru VPN. However general web browsing will be accomplished with direct connections that bypass the VPN.
If you want to browse web thru VPN , please continue to follow the steps below.

1. Add the following directive to the server configuration file 'server.conf'
push "redirect-gateway def1"
push "dhcp-option DNS 168.95.1.1"

2. Setting NAT routing for VPN client on server
#vi /etc/openvpn/start-nat.sh
   #!/bin/bash

   ipt="/sbin/iptables"

   # Clean the all rules
   $ipt -F
   $ipt -X
   $ipt -t nat -F
   $ipt -t nat -X

   # Enable ip_forward
   echo "1" > /proc/sys/net/ipv4/ip_forward

   # For NAT routing
   $ipt -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
   $ipt -t nat -L

#cd /etc/openvpn
#./start-nat.sh
==============================================================================

還是不行,我對 iptables 看來要加強了,還是另外架一台 proxy server 讓openvpn 連回時透過proxy server 出去?這方式可行嗎?
« 上次編輯: 2010-03-24 16:08 由 fireflybug »