Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Static routes disappear after reboot - Jessie (SOLVED)

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
MTHex
Posts: 3
Joined: 2017-11-28 11:46

Static routes disappear after reboot - Jessie (SOLVED)

#1 Post by MTHex »

Greetings everyone, hope all is fine.

I'm wondering if someone could give me any tips with this problem.

I'm actually running Debian 8 Jessie with the following version:

Code: Select all

migue@Wise:~$ uname -r
3.16.0-4-686-pae

migue@Wise:~$ lsb_release 
No LSB modules are available.

migue@Wise:~$ cat /proc/version 
Linux version 3.16.0-4-686-pae (debian-kernel@lists.debian.org) (gcc version 4.8.4 (Debian 4.8.4-1) ) #1 SMP Debian 3.16.43-2+deb8u5 (2017-09-19)
This OS is running on a VM-Ware ESXI 5.5.0 as a Virtual Machine, my problem is the same problem the user in this thread has:

http://forums.debian.net/viewtopic.php? ... es#p639304

I've tried to add static entries on the /etc/network/interfa
ces as follows with no results:

Code: Select all

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

#source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
auto eth0
iface eth0 inet static
        address 192.168.12.101
        netmask 255.255.255.0
        network 192.168.12.0
        broadcast 192.168.12.255
        gateway 192.168.12.230
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 200.30.40.245 200.40.220.245
        post-up ip route add -inet 150.100.1.0/24 gw 192.168.12.254 dev eth0
        post-up ip route add -inet 180.100.1.0/24 gw 192.168.12.254 dev eth0
        post-up ip route add -inet 192.168.15.0/24 gw 192.168.12.254 dev eth0
Also tried to make an script inside /etc/network/if-up.d$ something I read on the Ubuntu forums as a working process when the interface comes up.

Something like:

Code: Select all


../etc/network/if-up.d$ sudo nano script.sh

#!/bin/bash
# Adding static rules at the beginning

ip route add -inet 150.100.1.0/24 gw 192.168.12.254 dev eth0
ip route add -inet 180.100.1.0/24 gw 192.168.12.254 dev eth0
ip route add -inet 192.168.15.0/24 gw 192.168.12.254 dev eth0

If I add the static rules manually they are forgotten after reboot.

Is there another way to make static rules persistent?

Thank you all in advance.

Regards;

M.
Last edited by MTHex on 2017-12-01 12:37, edited 1 time in total.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Static routes disappear after reboot - Jessie

#2 Post by Head_on_a_Stick »

deadbang

MTHex
Posts: 3
Joined: 2017-11-28 11:46

Re: Static routes disappear after reboot - Jessie

#3 Post by MTHex »

Thank you Head_on_a_Stick for your assistance.

You know, It worked but not at 100%.

I've created a

Code: Select all

10-static.network
->

Code: Select all

/etc/systemctl/network
And the routes are added after ->

Code: Select all

sudo systemctl restart systemd-networkd
But when I reboot, I have to run

Code: Select all

sudo systemctl restart systemd-networkd
everytime.

Is there any chance to put this "restart command" at the beginning of the system as a script or something?

Thanks in advance.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Static routes disappear after reboot - Jessie

#4 Post by Head_on_a_Stick »

Did you try

Code: Select all

# systemctl enable systemd-networkd
The systemctl man page is very thorough, as are the rest of the systemd pages.
deadbang

MTHex
Posts: 3
Joined: 2017-11-28 11:46

Re: Static routes disappear after reboot - Jessie (solved)

#5 Post by MTHex »

Works like a charm..

I missed that part somehow on the man pages.

I really appreciate your help and thanks for sharing the documentation.

Have a great day.

M.

Post Reply