3

I just set up a second IP adress on my Ubuntu server and now I'm trying to change the default outgoing IP adress to the new one with ip route replace default via <old-ip> src <new-ip>.

But whenever I restart the networking service, it gets changed to the old IP adress.

kevdotcom
  • 31
  • 2

2 Answers2

4

Yes, that is because Ubuntu sets the default route dynamically on every startup of the networking service. You can open /etc/network/interfaces and append your command under the interface like this:

post-up ip route replace default via <old-ip> src <new-ip>
Broco
  • 1,999
  • 13
  • 21
0

Do you mean you are trying to change your ip address?

https://help.ubuntu.com/lts/serverguide/network-configuration.html

change the settings in /etc/network/interfaces to set the ip address you would like. Just change eth0 to eth1 or whatever interface is.

auto eth0
iface eth0 inet static
address 10.0.0.100
netmask 255.255.255.0
gateway 10.0.0.1
slinkz
  • 1