How to specify outbound IP for specific applications on multiple venets?
I'm having problems with proxy/relay applications such as a BNC. I have a CentOS 5.6 VPS with 2 IP addresses which are virtual adapters (venet0:0 and venet0:1) under venet0.
In these applications I can choose which IP address to bind to (IP address of venet0:1) but when they create an outbound connection, it is done through venet0:0.
These are my current settings (found using webmin):
Interfaces
Name Type IP Address Netmask Status
lo Loopback 127.0.0.1 255.0.0.0 Up
Loopback 开发者_运维技巧 ::1 128 Up
venet0 Unknown 127.0.0.1 255.255.255.255 Up
venet0:0 Unknown (Virtual) xxx.xxx.xxx.xxx 255.255.255.255 Up
venet0:1 Unknown (Virtual) xxx.xxx.xxx.yyy 255.255.255.255 Up
Route and Gateways
Destination Gateway Netmask Interface
169.254.0.0 None 255.255.0.0 venet0
Default Route None venet0
::1 :: 128 lo
Please can someone help me figure out how to configure the VPS?
Try to remove the default routes you do not want. The command ip route list should give you three entries. For example, on my Debian VPS, I get :
192.0.2.1 dev venet0 scope link
default via 192.0.2.1 dev venet0 src 10.15.4.62
default via 192.0.2.1 dev venet0 src 10.15.4.61
I want the VPS to use 10.15.4.61 for outgoing connections, not 10.15.4.62, so I type :
ip route del default via 192.0.2.1 dev venet0 src 10.15.4.62
Now I have a single default route, and my VPS will use the IP I want.
精彩评论