[lfs-dev] Scripts modified to add IPv[46] dual-stack support

jpbion at westvi.com jpbion at westvi.com
Mon Feb 6 05:06:35 PST 2017


I made the following modifications to my LFS system to provide for 
having the inclusive or of (IPv4-static or IPv6-static) to exist on an 
interface, while allowing a single ifdown <dev> and ifup <dev> command.

The changes are:

1) In ifconfig.dev file, I allow for the following new options: IP6, 
PREFIX6, GATEWAY6. (although most IPv6 situations have you nicely 
learning the default gateway from the router, I allow it to still be 
set). I created a new service called "ip46-static"

2) In the new ip46-static service, I added ability to read the IP6, 
PREFIX6, and GATEWAY6 variables from the ifconfig.dev file, and set the 
appropriate addresses on the interface.

3) In the same service, I disabled the removing of the IPv4 gateway from 
the routing table altogether. The reason being that removing the address 
from the interface removes all routes pointing out from the interface - 
so it won't appear in the table anyway. The existing code looked like it 
had a logic error, so wouldn't be executed anyway. I just commented it 
out - but if someone believes it should be there, easy enough to leave 
in.

4) In /sbin/ifup, I added the ability to set the IPv6 default gateway 
(again, this really should be learned from the router in IPv6, but the 
support is there, if desired).

5) I installed the BLFS traceroute program. I believe if static IPv6 is 
added to LFS vs. BLFS, that this package, installed after inetutils, 
should be part of LFS as well, as the lack of a v6-capable traceroute on 
an IPv6-enabled system is not good.

6) Here's an area that leaves me unhappy: In /sbin/ifdown, I removed the 
check for all addresses being removed from an interface before bringing 
it down. I just bring it down. If calling 'ifdown' - you kind of want to 
bring the interface down.

7) Another reason I am unhappy: It doesn't support the use of dynamic 
IPv6 addressing - but then again, neither does LFS (BLFS does).

Rationale for changes the way they are:

a) Most of the time, if someone has both IPv4 and IPv6 addresses on an 
interface, they want them both up simultaneously. They want "ifdown 
<dev>" and "ifup <dev>" to do that for them, without thinking of issuing 
multiple commands. They also want the same logic to work if they just 
have one of v4 or v6.

b) Supporting this is simple for the user - just add the IPV6, PREFIXV6, 
and perhaps a GATEWAY6 parameter to the same files they already edit.

c) IPv6 is becoming more common. LFS 'standard' should support it.

In summary:

The changes work for me. I am not happy with (6) all that much at all, 
even though it works for me, it may not work for all (I didn't try the 
sub-interface (secondary address) case - that's where it may break.) I 
am not sure how many LFS users are creating secondary interfaces.

If they are viewed as useful, I will ship the changed files off to 
someone. They really weren't much work - perhaps a total of an hour was 
spent on this; largely it is copy/paste of other code.

-Joel


More information about the lfs-dev mailing list