how do i change outgoing ip address for server centos
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!
Related videos on Youtube
![Admin](/assets/logo_square_200-5d0d61d6853298bd2a4fe063103715b4daf2819fc21225efa21dfb93e61952ea.png)
Admin
Updated on September 17, 2022Comments
-
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 over 14 yearsthanks, any idea where i would make this change?
-
Admin over 14 yearsthere are no files for ifcfg-eth0:1, only ifcfg-eth0 should i create this file?