how do i change outgoing ip address for server centos

6,351

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. http://linux-ip.net/html/tools-ip-route.html 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:
6,351

Related videos on Youtube

Admin
Author by

Admin

Updated on September 17, 2022

Comments

  • Admin
    Admin almost 2 years

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

    For example,

    site123.com has an ip of 123.123.123.2(eth0:1) (resolves fine when incoming)

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

    How can I go about changing this?

    I am using centOS on the dedicated server.

  • Admin
    Admin over 14 years
    thanks, any idea where i would make this change?
  • Admin
    Admin over 14 years
    there are no files for ifcfg-eth0:1, only ifcfg-eth0 should i create this file?