1

On my CentOS server I have configured 7 ip addresses.

The default IP address is 87.233.82.98 en this address should be used for outbound connections. However the 87.233.82.99 address is used for outbound connections.

The .99 address is also mentioned in the ip route table.

[root@db01 network-scripts]# ip route show
87.233.82.98 dev eth0  scope link
87.233.82.0/24 dev eth0  proto kernel  scope link  src 87.233.82.99
169.254.0.0/16 dev eth0  scope link  metric 1002
default via 87.233.82.97 dev eth0

How can I change my IP address for outbound connections to 87.233.82.98?

Jochem Gruter
  • 113
  • 1
  • 5

1 Answers1

4

You can change the source IP address used by default for outgoing connections using a command like the following:

ip route replace default via 87.233.82.97 dev eth0 src 87.233.82.98

Similarly, you can do the same to change source IP when contacting IPs within the same subnet using a command like:

ip route replace 87.233.82.0/24 dev eth0 src 87.233.82.98

You can see man ip-route for available options.

Khaled
  • 36,533
  • 8
  • 72
  • 99