使用 Juniper VPN 將所有 Ubuntu 流量路由到 Windows 7 Virtualbox

使用 Juniper VPN 將所有 Ubuntu 流量路由到 Windows 7 Virtualbox

我必須使用 Juniper VPN 連接到我公司的 VPN。不幸的是,我的公司不允許直接從 Ubuntu 進行連線。因此,我在 VirtualBox 中有一個最小的 Windows 7 虛擬機,並從那裡運行 Juniper,我可以在其中成功連接到我公司的企業網路。

我的想法是使用我的linux來工作,並使用virtualbox僅透過VPN路由所有流量。 (不能在 Linux 上使用 VPN)

問題是我不知道如何透過訪客上的 VPN 路由所有流量。 (HTTP、SSH、...)。我嘗試了端口轉發,但我不知道這是否是答案,也許我應該使用 virtualbox 作為管理員來監聽 < 1024 端口,但似乎 virtualbox 沒有監聽該端口。

答案1

我今天成功了!

設定實際上並不難。我運行 Ubuntu 17.04 並擁有 Windows 7 虛擬機器。

Windows虛擬機器網路設定:

adapter 1: host only (give a static ip: 192.168.56.11)
adapter 2: bridged   (got a DHCP ip from my router: 192.168.0.106)

烏班圖設定:

wlp5s0: DHCP ip from router 192.168.0.105
vboxnet0: 192.168.56.1

我在 Windows 虛擬機器上有 CheckPoint VPN 連線。

在此輸入影像描述

Ethernet 2 = Host only
Ethernet 3 = Bridged
Ethernet 4 = VPN. This is the one you will need to share with Ethernet 2 (hostony)
  • 右鍵單擊“屬性”
  • 共享選項卡
  • 與「僅主機」網路共享

然後在我的 Ubuntu 機器上:(192.168.222.50 只是公司網路上的主機)

sudo route add 192.168.222.50 via 192.168.56.11

或路由整個範圍

sudo route add 192.168.222.0/24 via 192.168.56.11

另外,不要忘記將您的公司 DNS 伺服器新增到 /etc/resolv.conf 中!

答案2

在 Windows 7 VM 上,ICS(Internet 連線共用)可能會起作用:

   ICS and VPN connections

   If you create a virtual private network (VPN) connection on your host 
   computer to a corporate network and then enable ICS on that 
   connection, all Internet traffic is routed to the corporate network 
   and all of the computers on your home network can access the 
   corporate network. If you don't enable ICS on the VPN connection, 
   other computers won't have access to the Internet or corporate 
   network while the VPN connection is active on the host computer.

根據您的設定(以及在上一段的上下文中),Windows 7 VM 將成為主機。在 Ubuntu 系統(在虛擬機器上下文中被視為「主機」)上,類似這樣的事情可以運作:

停用網路

sudo /etc/init.d/networking stop

為客戶端提供靜態 IP 位址

sudo ip addr add 192.168.0.100/24 dev eth0

此 IP 位址可以是網關私有 IP 範圍內的任何位址。

配置路由

sudo ip route add default via 192.168.0.1

https://help.ubuntu.com/community/Internet/ConnectionSharing了解更多。

在上述場景中,Ubuntu 將是 ICS 用戶端,Windows 7 是 ICS 伺服器(或「網關」)。

另外,您確定無法在 Linux 上連線 VPN 嗎?http://kb.juniper.net/InfoCenter/index?page=content&id=KB25230似乎表明 Juniper 確實有 Linux VPN 用戶端。即使您的公司正在使用某種不同的專有軟體來讓人們連接到 VPN,該軟體也很可能會在 Wine 中運作。也https://serverfault.com/questions/363061/how-to-connect-to-a-juniper-vpn-from-linux可能與此相關。

相關內容