iptables ROUTE target 應用備忘

来源:百度文库 编辑:神马文学网 时间:2024/04/28 03:01:07
iptables ROUTE target 應用備忘
iptables ROUTE target 應用備忘:
讓兩條線路都能連入同一台伺服器 特定封包的路由規劃
其他備忘:
解決在 Linux 環境 ssh 到別台電腦時, 要等很久的問題 解決 PHP Warning: preg_match: internal pcre_fullinfo() error -3 的問題
備忘一: 讓兩條線路都能連入同一台伺服器
環境: 兩條線路, 一台伺服器, 一張網卡, 想讓兩條線路都能連入 Web Server

需求:
設置 Round Robbin DNSNetfilter Extensions: Patch-O-Matic 的ROUTE 模組 (在extra 類別中)
作法:
iptables -t mangle -A POSTROUTING -s 192.168.1.2 -j ROUTE --gw 192.168.1.253 --continue
這樣一來, 凡是從 eth0:0 (192.168.1.2) 出去的封包, 都會走 192.168.1.253 這個 Gateway.
也就是說, 從 192.168.1.253 這個 Gateway 進來, 導向到 192.168.1.2 的封包, 可順利的從同一個 Gateway 返回; 而從 192.168.1.254 進來的封包, 因為系統本身預設閘道即為 192.168.1.254, 當然沒有問題.
備忘二: 特定封包的路由規劃
環境: LAN User 透過 Linux NAT 預設從 192.168.1.254 出去, 但想讓 Skype 封包 (Skype to Skype) 走 192.168.1.253 這條線路

需求:
Linux layer 7 packet classifierNetfilter Extensions: Patch-O-Matic 的ROUTE 模組 (在extra 類別中)
作法:
iptables -t mangle -A POSTROUTING -s 192.168.2.0/24 -m layer7 --l7proto skypetoskype -j ROUTE --gw 192.168.1.253 --continue
備忘三: 解決在 Linux 環境 ssh 到別台電腦時, 要等很久的問題
症狀: ssh 內部.linux.host.ip → 約十秒鐘後才出現登入提示
解決方式:
vi /etc/resolv.conf
nameserver 正確的_或_更快的_DNS_Server_IP
備忘四: 解決 PHP Warning: preg_match: internal pcre_fullinfo() error -3 的問題
症狀:cacti 無法建立ZyWALL 70 統計圖表, httpd error_log 出現如上的錯誤訊息
解決方式:
重新安裝 PHP, configure 時原本 --with-pcre-regex=/usr 改為 --with-pcre-regex, 使用 built-in 的 PCRE library 即可.
重新編譯 PHP Source 時如果遇到問題, 可參考這篇:Help Re-compiling PHP
參考資料:
Bugzilla Bug 158729 - preg_match: internal pcre_fullinfo() error -3PHP Bugs: #31501: preg_match generates Warning: preg_match: internal pcre_fullinfo() error -3
Posted by Jamyy at 2006年05月04日 16:59
from: http://cha.homeip.net/blog/archives/2006/05/iptables_route_1.html#more