Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 152094 - init.d/net bombs when DHCP gateway is on different subnet to the IP
Summary: init.d/net bombs when DHCP gateway is on different subnet to the IP
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-20 05:02 UTC by Adam Nielsen
Modified: 2006-10-21 05:08 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to allow a gateway in a different subnet to the IP in a DHCP response (allow-offnet-gateway.patch,1013 bytes, patch)
2006-10-20 18:21 UTC, Adam Nielsen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Nielsen 2006-10-20 05:02:00 UTC
For Internet access, I configure my ethernet interface via DHCP, and the DHCP response comes from the DSL modem plugged into that NIC.  Unfortunately the DSL modem must be configured as a gateway, but its IP (10.1.1.1) is always on a different subnet to the IP address in the DHCP response, e.g.

My Internet IP: 1.2.3.4
Interface Subnet: 1.2.3.0/24
Default gateway: 10.1.1.1

I get an error because the default gateway is on an unknown subnet:

$ /etc/init.d/net.inet0 restart
 * Stopping inet0
 *   Bringing down inet0
 *     Stopping dhclient on inet0 ...    [ ok ]
 *     Shutting down inet0 ...           [ ok ]
 * Starting inet0
 *   Bringing up inet0
 *     dhcp
 *       Running dhclient ...
PREINIT
deconfig
REBOOT
bound
SIOCADDRT: Network is unreachable

If I add dhcp_inet0="nogateway" to /etc/conf.d/net then the problem goes away - but of course then I don't have a default subnet so no Internet access.

This is the behaviour with at least two different DSL modems supplied by a large Australian ISP.

The scripts really need to check the gateway's subnet, and if it's different to the main IP address, do something like this first:

$ route add -net 10.1.1.0/24 dev inet0

Then later on when the script tries to add the default route the kernel can find the subnet and allows the route to be added.
Comment 1 Adam Nielsen 2006-10-20 18:21:19 UTC
Created attachment 100114 [details, diff]
Patch to allow a gateway in a different subnet to the IP in a DHCP response

This patch (hopefully) applies to /lib/rcscripts/net.modules.d/helpers.d/udhcpc-ifconfig and if a DHCP response is received with a gateway on an unknown subnet, it adds a host route telling the kernel that the gateway is available on the same interface that DHCP is being performed on.

This fixes the bug for me, and should not otherwise affect the behaviour of the script.
Comment 2 Roy Marples (RETIRED) gentoo-dev 2006-10-21 05:08:35 UTC
We let the dhcp clients use their own scripts starting with baselayout-1.12 which is now stable. Basically we punted the entire helpers.d directory from baselayout.

If /sbin/dhclient-script still has your issue then please re-open this bug - hopefully with a patch for it :)