- 论坛徽章:
- 0
|
原帖由 plumblossom 于 2007-10-9 21:09 发表 小弟不是太瞭解多ip系統怎麼工作的,公司遇到了這樣的問題要解決。所以有幾點疑問:
1、我的linux系統(單網卡多ip----ip_1~ip_n)上的服務程序與其他終端鏈接;這個終端顯示我的ip,是這ip_1到ip_n隨機嗎?
不是,都是以 primary ip 對外連結。比方使用 eth0 的 ip, 而不是使用 eth0:0 這類 ip alias 的 ip 項目。
程式那是 layer7 層級,封包那是 layer2/layer3 層級,基本上沒有應對窗口。不過在 iptables 內可以搭配使用 -m owner 該 match module 使用,不過您得自己測試。
- owner
- This module attempts to match various characteristics of the packet creator, for locally-generated packets. It is only valid in the OUTPUT
- chain, and even this some packets (such as ICMP ping responses) may have no owner, and hence never match.
- --pid-owner processid
- Matches if the packet was created by a process with the given process id.
复制代码
3、如果應用程序不做控制,系統是怎麼選擇ip和其他終端鏈接的? 要如何配置呢?
可以指定整體的項目,在 nat table 內於 POSTROUTING 內設定即可,像是:
- iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source 1.2.3.4 --to-source 4.3.2.1
复制代码
-- |
|