Score:0

up directive not working when dhcp is selected in /etc/network/interfaces.d/eth0

in flag

I have to add the multicast route, that is needed when no default gateway is configured. Mono needs this in order to join multicast groups. The configuring is done in /etc/network/interfaces.d/eth0

Now the peculiar thing is:

If eth0 is configured with a static IP it works:

allow-hotplug eth0
iface eth0 inet static
address 192.168.0.200
netmask 255.255.255.0
up ip route add 224.0.0.0/4 dev eth0

If eth0 is configured to dhcp, ip route is not called:

allow-hotplug eth0
iface eth0 inet dhcp
up ip route add 224.0.0.0/4 dev eth0

I tried a shell script writing a timestamp into a file in the up line but that does not get called either. So it seems to be the script not being called rather than the ip route command failing or getting overridden.

The systems in question are debian stretch, buster. This is running on embedded units with a readonly root partition.

Am I missing something here, why does it work with static config but not with dhcp?

To avoid the XY problem, is there a different method maybe to add said route at startup?

A.B avatar
cl flag
A.B
reproducing a setup equivalent to yours in buster (just in a LXC container) shows the route added with a dhcp setting. It can be seen without script with `ifup -v eth0` which will show commands executed. Maybe your embedded environment is different enough to deviate from default behavior?
Holger Böhnke avatar
in flag
Thanks, `-v` helped to understand the issue. In fact there's a `dhcpcd` error, resulting in `ifup` terminating at the `dhcp` command and not executing any `up` command thereafter.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.