Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to make sure my clients outgoing ip address uses the dedicated ip they are assigned.

For example, has an ip of (resolves fine when incoming)

but it is using my main server ip (eth0) when it makes outgoing requests

How can I go about changing this?

I am using centOS on the dedicated server.

share|improve this question

By default, everything will go out the default route, which is associated with the default eth0 ip. You can change the eth0 and eth0:0 ips and then change the default route....

If you only want it for some things, then you need to use the iproute2 package and use ip route command to specify certain routing rules. is a good place to see the nitty gritty.

This is also called "source based routing". This used with "tc" command (traffic shaping) will accomplish what you want...It can be done, but it's very difficult for the novice administrator on a linux server with hundreds of ips.

However, some programs like wget etc, will allow you to specify the network interface to use, so you can specify -i eth0:0 for instance.

Good luck!

share|improve this answer
cd /etc/sysconfig/network-scripts/

Your interface config scripts will be named "ifcfg-eth0", "ifcfg-eth1", etc. Edit the one for the appropriate interface, changing the "GATEWAY" setting. For example, on my box "ifcfg-eth0" looks like this:


In your case, remove the "GATEWAY" line from your "ifcfg-eth0" file and move it to "ifcfg-eth0:1" (changing the gateway address to whatever is correct for that NIC). Then restart your networking:

/etc/init.d/network restart
share|improve this answer
there are no files for ifcfg-eth0:1, only ifcfg-eth0 should i create this file? – james Feb 16 '10 at 18:27

I would expect changing the default route on your CentOS to the aliased interface 'eth0:1' should make it work as you want.

The reason for correct incoming resolution has nothing to do with your CentOS configuration;
it is controlled by the external name lookup resolution for your '' domain name.
It resolves to '' so you get incoming connections there.

Update: Section 13.2.4: Alias and Clone Files, in Interface Configuration Files page of CentOS deployment guide refers this Network Configuration page for Device Aliases.

share|improve this answer
thanks, any idea where i would make this change? – james Feb 16 '10 at 0:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.