1

I have a problem to delete line in next routing table.

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         160.99.37.11    0.0.0.0         UG    202    0        0 eth0
160.99.0.0      *               255.255.0.0     U     202    0        0 eth0

I use command: "sudo route del -net 160.99.0.0/16", this command is ok and is working.

When i reboot RPi there is a problem, the line draws back. How to permanently delete this line?

My version Linux:

PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID_LIKE=debian


pi@raspberrypi:~ $ sudo nano /etc/network/interfaces
GNU nano 2.2.6         File: /etc/network/interfaces

iface eth0 inet manual
allow-hotplug wlan0
iface wlan0 inet manual
   wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
   allow-hotplug wlan1
iface wlan1 inet manual
   wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

/etc/network/interfaces - after changes 15.10.2016

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual
   up route add -net 160.99.40.0 netmask 255.255.255.0 gw 160.99.37.11

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
  • Comments are not for extended discussion; this conversation has been moved to chat. – Ghanima Oct 13 '16 at 13:54
1

Having the following original routing table,

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         160.99.37.11    0.0.0.0         UG    202    0        0 eth0
160.99.0.0      *               255.255.0.0     U     202    0        0 eth0

(Don't need to say that any 160.99.37.XXX or 160.99.40.XXX address is in the 160.99.0.0/16 subnet.)

your raspi (which has 160.99.37.XXX IP address) tries to access any address in the 160.99.0.0/16 subnet by broadcasting, not by using the default routing rule.

your raspi accesses any address not in the 160.99.0.0/16 subnet through the gateway 160.99.37.11 defined in the default routing rule.

When the specified routing rule is deleted, your raspi has the following routing table.

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         160.99.37.11    0.0.0.0         UG    202    0        0 eth0

In this case, your raspi accesses any address (not only 160.99.37.XXX or 160.99.40.XXX) through the gateway 160.99.37.11 which is capable of communicating with destination addresses.

From this picture, what I don't understand is that

  • If you (I mean the IP of your raspi) are permitted to access the 160.99.40.0/24 subnet, why not a routing rule for this purpose is configured in your network.
  • For this case, I think the routing policies of your network are not configured properly.

OR

  • If you are not permitted to access the 160.99.40.0/24 subnet, how you are able to access the 160.99.40.0/24 subnet through the gateway 160.99.37.11.
  • For this case, I think the security policies of your network are not configured properly.

As conclusion,

  1. There is no limitation on your network to access the 160.99.40.0/24 subnet from your raspi
  2. There is no proper routing configuration on your network to access the 160.99.40.0/24 subnet from your raspi

As solution,

  1. Do not delete the specified routing rule on your raspi, because you can break some other things about your raspi's network configuration
  2. Instead, define a new routing rule

UPDATE #1 For Raspbian Jessie, static routes are set by hook files placed under /lib/dhcpcd/dhcpcd-hooks/ directory.

  • by adding up route add -net 160.99.40.0 netmask 255.255.255.0 gw 160.99.37.11
  • after the line iface eth0 inet manual
  • in /etc/network/interfaces file

  • by creating a file /lib/dhcpcd/dhcpcd-hooks/40-WhateverFilenameYouChoose

  • which includes routing rules like ip route add 160.99.40.0/24 via 160.99.37.11

Your final routing table will look like this:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         160.99.37.11    0.0.0.0         UG    202    0        0 eth0
160.99.40.0     160.99.37.11    255.255.255.0   U     202    0        0 eth0
160.99.0.0      *               255.255.0.0     U     202    0        0 eth0
  • Dear sir, thank you so much for very good explanation. I set up command in /etc/network/interfaces, but it still doesn't remember the route when you restart it. I am the only administrator user. What is the problem? – Dimitrije Mita Dimitrijević Oct 14 '16 at 17:00
  • Please post the output of route command with your new configuration. – vaha Oct 14 '16 at 18:38
  • #interfaces(5) file used by ifup(8) and ifdown(8) #Please note that this file is written to be used with dhcpcd #For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf' #Include files from /etc/network/interfaces.d: source-directory /etc/network/interfaces.d auto lo iface lo inet loopback iface eth0 inet manual up route add -net 160.99.40.0 netmask 255.255.255.0 gw 160.99.37.11 allow-hotplug wlan0 iface wlan0 inet manual wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf allow-hotplug wlan1 iface wlan1 inet manual wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf – Dimitrije Mita Dimitrijević Oct 14 '16 at 18:53
  • Link for image: we.tl/dpnIaseoVW – Dimitrije Mita Dimitrijević Oct 14 '16 at 19:05

protected by Community Oct 13 '16 at 15:48

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.