-1

i have a server (linux/centos) and my default ip is: 111.111.111.111 so i bought another ip (ip failover) 222.222.222.222

if i visit in browser 111.111.111.111 or 222.222.222.222 its opening same page

so i have eth0:

UUID="2f99a6-6566-sb24-bd0e-bf5a8d4a1765"
IPADDR="111.111.111.111"
GATEWAY="111.111.111.1"
NETMASK="255.255.255.0"
BOOTPROTO="static"
DEVICE="eth0"
ONBOOT="yes"

also i created eth0:0

same as above just changed

DEVICE="eth0:0"
IPADDR="222.222.222.222"
#GATEWAY="111.111.111.1"(commented it)

when i run
curl --interface eth0 ifconfig.co the response is 111.111.111.111

curl --interface eth0:0 ifconfig.co the response is 222.222.222.222

but when i use wget or ffmpeg(i just want to find solution for ffmpeg ) then ip is 111.111.111.111

so how i can make default outbound IP to be 222.222.222.222 (its my second ip/ i bought as failover ip)

Ba Ta
  • 1

1 Answers1

0

Depending on your exact requirements, but the methods you can use are:

  • Standard Routing Tables (Destination Based)
  • Policy based routing (allows various routing criterias)
  • Network Namespaces

I think in your use case Network Namespaces in combination with aliases could be an effective choice. For details on that solution path, consider:

https://unix.stackexchange.com/questions/210982/bind-unix-program-to-specific-network-interface

hargut
  • 3,908
  • 7
  • 10