ifconfig.eth0/ipv4 or ifcfg-eth0 why the difference

stosss stosss at gmail.com
Tue Feb 9 12:01:27 PST 2010


On Tue, Feb 9, 2010 at 1:42 PM, Bruce Dubbs <bruce.dubbs at gmail.com> wrote:
> stosss wrote:
>>> YES!!! (fist pump in the air) I have connectivity!
>>>
>>
>> A little early to get excited. I have eth0 and it loads and the kernel
>> is happy no errors no warnings. Still no connectivity.
>>
>> my ifconfig.eth0/ipv4 look like this:
>>
>> ONBOOT=yes
>> SERVICE=ipv4-static
>> IP=10.0.2.15
>> GATEWAY=10.0.2.0
>> PREFIX=8
>> BROADCAST=10.0.2.255
>>
>> I did a test by launching the LFS LiveCD iso image in another VM to
>> see how it configured itself.
>>
>> ONBOOT=yes
>> SERVICE=ipv4-static
>> IP=10.0.2.15
>> GATEWAY=10.0.2.0
>> PREFIX=24
>> BROADCAST=10.0.2.255
>
> The prefix shouldn't matter since all the ip addresses start at 10.0.2.
>
>> This is also the same for all my other VMs. VirtualBox sets all VMs to
>> this private network and each one is completely separate from the
>> others. If I set PREFIX=24 in my LFS build the kernel complains with
>> FAIL. On most of my real machines and VMs I can run route -n and see
>> the details for the gateway. I can't do that with my build LFS but I
>> can do that with the LFS LiveCD. Which package needs to be installed
>> so the route command is available?
>
> BLFS: Net-tools
>
> You can use the default LFS program:
>
> /sbin/ip route list
>
> I see what the problem is.  The gateway is OK for /8, but wrong for /24.
>  IN a /24 network, the .0 address is the network address, not a host
> address.  You've set it up incorrectly on the LiveCD.  Either change the
> gateway to .1 or the prefix to 8 on the LiveCD instance.

That LFS LiveCD 6.3 r2160 is setting the config itself.

route -n shows:
Kernel IP routing table
Destination     Gateway         Genmask            Flags  Metric  Ref
  Use Iface
10.0.2.0           0.0.0.0             255.255.255.0   U         0
     0             0 eth0
0.0.0.0             10.0.2.2           0.0.0.0                UG
0          0             0 eth0

All of the VMs that set things automatically work. So, they have to be
right. I just need to figure out what I set wrong and set it right. I
knew eventually I would need to learn this networking stuff better.
Part of the problem I am dealing with here is, I am having to learn
how the network stuff is done in VirtualBox at the same time. Until
now every Linux system I have messed with has set itself up
automatically so I had no real motivation to figure it out. So I am
still learning new stuff.

Deciding to take on learning more about Linux via LFS has been a very
bumpy ride at times, but worth it. At times I find myself neglecting
my money projects (like now) to figure this stuff out.



More information about the lfs-support mailing list