1

The following command at the terminal gives me the networking changes I need:

ip route change default via 10.255.255.1 dev eth0 src 82.82.82.82

To persist this on reboot I add the following to /etc/network/interfaces

post-up ip route change default via 10.255.255.1 dev eth0 src 82.82.82.82

After reboot the change is not applied - or is applied and subsequently overwritten - or something similar. How do I track down / debug why this is not working, as I am certain it should?

Alternatively, is there an other way I can apply the ip route change that will be effective?

Thiago Figueiro
  • 830
  • 1
  • 6
  • 18
Peter S
  • 9
  • 1
  • 3
  • Which distro are you using? Edit: forget it, couldn't read the title correctly. You could add a tag to Ubuntu, though. – Lenniey Feb 04 '16 at 09:39
  • Try with only `up` in /etc/network/interfaces, or write a script and save it in /etc/network/if-up.d/. Maybe this helps. – Lenniey Feb 04 '16 at 09:45
  • Really keen on a way to debug/see what is happening as my interfaces file works fine on my local network/VM, just not on this production server. – Peter S Feb 08 '16 at 11:31
  • You could also try the "ugly" approach of using `/etc/rc.local` to add your route – Lenniey Feb 16 '16 at 16:17

2 Answers2

2

Try to add this line in /etc/network/interfaces

pre-down ip route change default via 10.255.255.1 dev eth0 src 82.82.82.82
  • Thanks Carlos, can you share why you'd expect this to help? I'm afraid my knowledge is very thin in this area. – Peter S Feb 08 '16 at 11:29
  • Based on the configuration of some of my virtual machines. I always have a pre-down and post-up and I have never had problems . I thought if I do not throw down the interface before restarting you may have problems because that interface stays caught. But... this don't solve your problem, right? – Carlos Sánchez Feb 09 '16 at 11:50
  • I'm afraid this didn't solve the problem. The Route Change is still either not being applied, or overwritten after it has been applied. Are there any logs to be checked? – Peter S Feb 11 '16 at 10:47
  • Follow this link to turn over the logs and paste the result. http://askubuntu.com/questions/230307/how-to-log-the-activity-of-a-network-interface-in-a-file – Carlos Sánchez Feb 12 '16 at 13:23
-1

The best answer I found was to add the command to a crontab. Clearly that's not a great solution. Would love to reliably be able to apply the change on boot.

Peter S
  • 9
  • 1
  • 3