2014年4月29日 星期二

on
測試平台: Debian 7 32bit (理論上兼容Debian 6)
VPS類型: OpenVZ
VPS要求:
        1) 2個IPv4或以上
        2) 已安裝VNC Server, Firefox或iceweasel
        3) NODE允許CT使用IPTABLE_NAT模組, 一般有提供, 沒有的可發Ticket要求開啟
同類比較: 跟SSH Port forwarding不同, 不會同時消耗OUTGOING, INCOMING的流量

步驟(在SHELL內操作)

1. 先添加一個新用戶(USERNAME改為你想要的用戶名)
複製內容到剪貼板
代碼:
useradd -G root -d /root USERNAME
2. 取得新用戶的UID(USERNAME改為新建的用戶名)
複製內容到剪貼板
代碼:
id -u USERNAME
3. 使用iptables進行轉發(USER_UID改為上一步取得的數字, YOUR_EXTRA_IP改為次IP)
複製內容到剪貼板
代碼:
iptables -t nat -A POSTROUTING -o venet0 -m owner --uid-owner USER_UID -j SNAT --to-source YOUR_EXTRA_IP
如果NODE沒有開放IPTABLE_NAT模組, 會有以下的錯誤
複製內容到剪貼板
代碼:
iptables v1.4.14: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
4. 保存iptables設定
複製內容到剪貼板
代碼:
iptables-save > /etc/iptables.conf
5. 載入iptables設定(需要開機載入的, 請把代碼同時寫入檔案/etc/rc.local)
複製內容到剪貼板
代碼:
iptables-restore < /etc/iptables.conf
6. 開啟VNC, 創建2個Firefox Profile
複製內容到剪貼板
代碼:
Firefox執行: firefox -no-remote --display=0:1 -P
iceweasel執行: iceweasel -no-remote --display=0:1 -P
7. 更改權限, 讓新用戶可運行firefox或iceweasel(需要開機載入的, 請把代碼同時寫入檔案/root/.vnc/xstartup)
複製內容到剪貼板
代碼:
chmod -R 777 /root
8. 在VNC內使用第一個Profile運行firefox(PROFILE_NAME改為Profile的名稱)
複製內容到剪貼板
代碼:
Firefox執行: firefox -no-remote --display=0:1 -P PROFILE_NAME &
iceweasel執行: iceweasel -no-remote --display=0:1 -P PROFILE_NAME &
9. 在VNC內使用另一個Profile運行firefox(USERNAME改為新用戶, PROFILE_NAME改為另一個Profile的名稱)
複製內容到剪貼板
代碼:
Firefox執行: su USERNAME -c "firefox -no-remote --display=0:1 -P PROFILE_NAME &"
iceweasel執行: su USERNAME -c "iceweasel -no-remote --display=0:1 -P PROFILE_NAME &"
10. 各自瀏覽查看IP的網站, 看看是否出現2個不同的IP
複製內容到剪貼板
代碼:
http://torvpn.com/myip.html
如何應用在CentOS 6 32bit的系統上?

步驟4改為
複製內容到剪貼板
代碼:
service iptables save
步驟5改為
複製內容到剪貼板
代碼:
chkconfig iptables on
步驟6,8,9的iceweasel不適用於CentOS系統

附上截圖









轉載地址:創富山莊 會員:newforum

0 意見:

張貼留言