IP replace default outbound [closed]

In the debian you should use the /etc/network/interfaces configuration file to make the network settings persistent.

The simplest way to achieve what you want is usage of post-up statements under interface configuration.

In your case you should write something like this:

auto eth0
iface eth0 inet static
  address ...
  post-up /sbin/ip route replace 0/0 via 172.31.1.1 dev eth0 src 49.12.112.180 || true

iface eth0 inet6 static
  address ...
  post-up /sbin/ip -6 route replace 0/0 via fe80::1 dev eth0 src 2a01:04f8:1c17:8010::1 || true

The || true part is required to avoid errors if something goes wrong in the post-up commands.

After edit of the file check the correctness with the ifquery -v eth0 command.