How to Change the Exit IP Address of a Multi-IP Cloud Server?

25-01-2024 02:23:30

Linux Operating System

1.Check the external network interface card (NIC) device and gateway. Execute the following command. The result shows that the gateway is 211.149.140.1 and the network adapter name is eth0.

# ip route show
default via 211.149.140.1 dev eth0

2.Change the exit IP to 211.149.140.130. Execute the command below, replacing 211.149.140.1 and eth0 with the gateway and network adapter obtained in the previous step.

# ip route change default via 211.149.140.1 dev eth0 src 211.149.140.130

3.Confirm the result of the change.

# ip route show
default via 211.149.140.1 dev eth0 src 211.149.140.130

# curl https://ipv4.icanhazip.com
211.149.140.130