# [Solved] Network is unreachable

## Luc484

Hi. Today I think I made a mess. Network as always worked great, but now it seems it isn't starting automatically at boot. I mean, if I give the command:

```

ifconfig eth0 ip broadcast ip etc...

```

the network start to work, but otherwise it won't start. It doesn't even ping and it says:

```

Connect: network is unreachable

```

I checked the /etc/conf.d/net and it seems to be ok: configured as it was before. Then I checked that the init script was started up: I gave rc-status and net.eth0 was started. Anyway, network is not reachable unless I give that command. What could there be wrong?

Thanks.Last edited by Luc484 on Sun Sep 04, 2005 3:09 pm; edited 1 time in total

----------

## darkphader

Did you change anything?

A baselayout upgrade without updating the config files (plus editing the ones needed so they are configured correctly and so modules get loaded, etc.) can cause issues.

Follow the trail of changes made.

Chris

----------

## Luc484

Yes, I made a dispatch-conf to solve another problem. That's why I checked those files. What could dispatch-conf have done to cause all this? Do you have any idea?

Thanks.

----------

## darkphader

Check the dispath-conf archive directory.

Chris

----------

## m_sqrd

Check your /etc/conf.d/net and the /etc/conf.d/net.example and see if there are syntax changes.

----------

## Luc484

Well, it seems that everything is like before:

```

iface_eth0="192.168.0.4 broadcast 192.168.0.255 netmask 255.255.255.0"

gateway="eth0/192.168.0.1"

```

It seems it is the same of another one I have on another pc. It has always been working. Any idea?

Thanks for your answers.

----------

## darkphader

Did you look at /etc/conf.d/net.example ? Seems the format has changed a bit.

```
config_eth0=( "192.168.0.4/24 brd 192.168.0.255" )

routes_eth0=( "default via 192.168.0.1" )
```

Also if you're comparing your dispatch-conf archive files with the new ones, you don't want to miss your /etc/modules.autoload.d/kernel-2.x file. If you had it loading your network module previously and it's no longer listed, the module may not be getting loaded in time.

----------

## m_sqrd

what's emerge -pv baselayout

----------

## Luc484

 *darkphader wrote:*   

> Did you look at /etc/conf.d/net.example ? Seems the format has changed a bit.
> 
> ```
> config_eth0=( "192.168.0.4/24 brd 192.168.0.255" )
> 
> ...

 

Yes, that's what I have now in my /etc/conf.d/net. I only used the other syntax:

```

config_eth0=( "192.168.0.4/24 netmask 255.255.255.0 broadcast 192.168.0.255" )

```

I have the driver built-in. Is it necessary anyway? If I give /etc/init.d/net.eth0 restart I get:

```

Bringing eth0 down... [OK]

Bringing eth0 up... [OK]

```

but pinging is still impossible.

Any other idea?

----------

## Luc484

 *m_sqrd wrote:*   

> what's emerge -pv baselayout

 

This is what I get:

```

These are the packages that I would merge, in order:

Calculating dependencies ...done!

[ebuild   R   ] sys-apps/baselayout-1.11.13-r1  -bootstrap -build -static -unicode 0 kB

Total size of downloads: 0 kB

```

Anything strange?

Thanks.

----------

## darkphader

 *Luc484 wrote:*   

> I have the driver built-in. Is it necessary anyway? If I give /etc/init.d/net.eth0 restart I get:
> 
> ```
> 
> Bringing eth0 down... [OK]
> ...

 

No. If the driver is built in there is no module to load.

Maybe there's a typo somewhere.

Two things:

After "/etc/init.d/net.eth0 restart" what does "ifconfig" tell you?

And after manually configuring the interface and then verifying it works what does "ifconfig" then tell you and how is it different, if at all?

Chris

----------

## m_sqrd

if this is what your using

 *Quote:*   

> 
> 
> config_eth0=( "192.168.0.4/24 netmask 255.255.255.0 broadcast 192.168.0.255" ) 
> 
> 

 

you have netmask twice /24 and netmask 255.

----------

## Luc484

 *darkphader wrote:*   

> 
> 
> No. If the driver is built in there is no module to load.
> 
> Maybe there's a typo somewhere.
> ...

 

After /etc/init.d/net.eth0 restart:

```

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

```

After manually configuring I get this:

```

eth0      Link encap:Ethernet  HWaddr 00:A0:D1:B7:FB:83  

          inet addr:192.168.0.4  Bcast:192.168.0.255  Mask:255.255.255.0

          inet6 addr: fe80::2a0:d1ff:feb7:fb83/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:5 errors:0 dropped:0 overruns:0 frame:0

          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:414 (414.0 b)  TX bytes:792 (792.0 b)

          Interrupt:18 Base address:0x6000 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

```

and it works correctly.

What do you think?

----------

## Luc484

 *m_sqrd wrote:*   

> if this is what your using
> 
>  *Quote:*   
> 
> config_eth0=( "192.168.0.4/24 netmask 255.255.255.0 broadcast 192.168.0.255" ) 
> ...

 

Yes, you are right. I removed the /24, is it ok? Anyway, it doesn't work in either cases.

Thanks.

----------

## m_sqrd

show us the output of 

```

ls -l /etc/init.d/net.*

```

----------

## Luc484

 *m_sqrd wrote:*   

> show us the output of 
> 
> ```
> 
> ls -l /etc/init.d/net.*
> ...

 

Here you are:

```

-rwxr-xr-x  1 root root 512 Aug 31 21:24 /etc/init.d/net.eth0

lrwxrwxrwx  1 root root   8 Sep  1 11:22 /etc/init.d/net.eth1 -> net.eth0

-rwxr-xr-x  1 root root 512 Aug 25 09:40 /etc/init.d/net.lo

```

I think net.eth1 is an error I made myself. I have only a network card on this pc, so there is no eth1.

Thanks again for your help.

----------

## m_sqrd

the files look like the old (baselayout rc-scripts) or something happend to them 

I'd re-emerge baselayout. then run etc-update again.

should look something like 

 *Quote:*   

> 
> 
> ls -l /etc/init.d/net.*
> 
> lrwxrwxrwx  1 root root     6 Aug 24 07:20 /etc/init.d/net.eth0 -> net.lo
> ...

 

----------

## Luc484

Ok, I re-emerged baselayout and ran tec-update. Now the output of the command is like yours. Unfortunately, the problem remains   :Confused:  .

Any other idea? Sorry for these many questions.

----------

## m_sqrd

edit your /etc/conf.d/rc and add the line

```

 RC_VERBOSE="yes"

```

then edit your /etc/conf.d/net and add this below your config_eth0=( ".....")

```

preup() {

      echo  $config_eth0

       return 0

}

postup() {

   ifconfig eth0

       return 0

}

```

then do

/etc/init.d/net.eth0 restart |tee >/tmp/if.log

and post the if.log

----------

## Luc484

Ok, then this is if.log:

```

[32;01mGentoo Linux RC-Scripts; [34;01mhttp://www.gentoo.org/[0m

 Copyright 1999-2004 Gentoo Foundation; Distributed under the GPL

Usage: [36;01mnet.lo[0m < [32;01mflags[0m > [ [32;01moptions[0m ]

[36;01mOptions:[0m

    [32;01mstart[0m

      Start service, as well as the services it depends on (if not already

      started).

    [32;01mstop[0m

      Stop service, as well as the services that depend on it (if not already

      stopped).

    [32;01mrestart[0m

      Restart service, as well as the services that depend on it.

      Note to developers:  If this function is replaced with a custom one,

      'svc_start' and 'svc_stop' should be used instead of 'start' and

      'stop' to restart the service.  This is so that the dependencies

      can be handled correctly.  Refer to the portmap rc-script for an

      example.

    [32;01mpause[0m

      Same as 'stop', but the services that depends on it, will not be

      stopped.  This is useful for stopping a network interface without

      stopping all the network services that depend on 'net'.

    [32;01mzap[0m

      Reset a service that is currently stopped, but still marked as started,

      to the stopped state.  Basically for killing zombie services.

    [32;01mstatus[0m

      Prints "status:  started" if the service is running, else it

      prints "status:  stopped".

      Note that if the '--quiet' flag is given, it will return true if the

      service is running, else false.

    [32;01mineed|iuse[0m

      List the services this one depends on.  Consult the section about

      dependencies for more info on the different types of dependencies.

    [32;01mneedsme|usesme[0m

      List the services that depend on this one.  Consult the section about

      dependencies for more info on the different types of dependencies.

    [32;01mbroken[0m

      List the missing or broken dependencies of type 'need' this service

      depends on.

[36;01mFlags:[0m

    [32;01m--quiet[0m

      Suppress output to stdout, except if:

      1) It is a warning, then output to stdout

      2) It is an error, then output to stderr

    [32;01m--nocolor[0m

      Suppress the use of colors.

[36;01mDependencies:[0m

    This is the heart of the Gentoo RC-Scripts, as it determines the order

    in which services gets started, and also to some extend what services

    get started in the first place.

    The following example demonstrates how to use dependencies in

    rc-scripts:

    depend() {

        need foo bar

        use ray

    }

    Here we have foo and bar as dependencies of type 'need', and ray of

    type 'use'.  You can have as many dependencies of each type as needed, as

    long as there is only one entry for each type, listing all its dependencies

    on one line only.

    [32;01mneed[0m

      These are all the services needed for this service to start.  If any service

      in the 'need' line is not started, it will be started even if it is not

      in the current, or 'boot' runlevel, and then this service will be started.

      If any services in the 'need' line fails to start or is missing, this

      service will never be started.

    [32;01muse[0m

      This can be seen as representing optional services this service depends on

      that are not critical for it to start.  For any service in the 'use' line,

      it must be added to the 'boot' or current runlevel to be considered a valid

      'use' dependency.  It can also be used to determine startup order.

    [32;01mbefore[0m

      This, together with the 'after' dependency type, can be used to control

      startup order.  In core, 'before' and 'after' do not denote a dependency,

      but should be used for order changes that will only be honoured during

      a change of runlevel.  All services listed will get started *after* the

      current service.  In other words, this service will get started *before*

      all listed services.

    [32;01mafter[0m

      All services listed will be started *before* the current service.  Have a

      look at 'before' for more info.

    [32;01mprovide[0m

      This is not really a dependency type, rather it will enable you to create

      virtual services.  This is useful if there is more than one version of

      a specific service type, system loggers or crons for instance.  Just

      have each system logger provide 'logger', and make all services in need

      of a system logger depend on 'logger'.  This should make things much more

      generic.

    [32;01mparallel[0m

      This is not really a dependency type, but enable you to specify if a

      service can start in parallel or not.  It takes one of two arguments,

      either 'yes' or 'no', and if it is not specified, it is presumed that

      it is set to 'yes'.

    Note that the 'need', 'use', 'before' and 'after' dependeny types can have '*'

    as argument.  Having:

    depend() {

       before *

    }

    will make the service start first in the current runlevel, and:

    depend() {

       after *

    }

    will make the service the last to start.

    You should however be careful how you use this, as I really will not

    recommend using it with the 'need' or 'use' dependency type ... you have

    been warned!

[36;01m'net' Dependency and 'net.*' Services:[0m

    Example:

    depend() {

        need net

    }

    This is a special dependency of type 'need'.  It represents a state where

    a network interface or interfaces besides lo is up and active.  Any service

    starting with 'net.' will be treated as a part of the 'net' dependency,

    if:

    1.  It is part of the 'boot' runlevel

    2.  It is part of the current runlevel

    A few examples are the /etc/init.d/net.eth0 and /etc/init.d/net.lo services.

[36;01mConfiguration files:[0m

    There are two files which will be sourced for possible configuration by

    the rc-scripts.  They are (sourced from top to bottom):

    /etc/conf.d/net.lo

    /etc/rc.conf

[36;01mManagement:[0m

    Services are added and removed via the 'rc-update' tool.  Running it without

    arguments should give sufficient help.

```

I don't even know what this is. Is this what you wanted?

----------

## m_sqrd

The only thing I can think of is that (emerge baselayout or etc-update) did not work.

because the output you show is the output of /sbin/runscript like

/sbin/runscript net.lo 

if you are sure you made the above changes and did  

```

/etc/init.d/net.eth0 restart |tee  /tmp/if.log

```

then I'd PM  UberLord  and see if he would be kind-enuff  to take a look at this. 

I'll try to looking at it some more but can't think of what it could be off the top of my head.

----------

## Luc484

No, wait... which one was the command I was supposed to run: the first one you gave me, or the last one?

This is the first you gave me:

```

/etc/init.d/net.eth0 restart |tee >/tmp/if.log

```

and this is the last one:

```

/etc/init.d/net.eth0 restart |tee  /tmp/if.log 

```

The shell output is different. But it seems the if.log is the same.

I forgot to tell you that when I ran emerge baselayout and then etc-update the response was that something was modified (net.eth0). But pinging after reboot still gives me the same result.

----------

## m_sqrd

Well the two are basicly the same the with ">" dose not let you see the output.  where as the other one dose. I was just doing to many things at one time again.   :Cool: 

PS doing the things I said above "the edit(s) and /etc/init.d/net.eth0 restart |tee /tmp/if.log"  dose not requier a reboot.

----------

## Luc484

Do you mean that the output I had with the second command should have been the same as that I have in my /tmp/if.log?

----------

## Luc484

I've been making a mess here, I don't know what has changed, but this is the output I'm getting now following the steps again:

```

 [32;01m*[0m Unmounting network filesystems ...

[A[73G  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m Stopping sshd ...

[A[73G  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m Bringing eth0 down ...

[A[73G  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m Bringing eth0 up ...

[A[73G  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m Mounting network filesystems ...

[A[73G  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m Starting sshd ...

[A[73G  [34;01m[ [32;01mok[34;01m ][0m

```

Does this mean anything to you?

This is something strange. When I ran your first command, I got the first output I gave you. The second command you gave me (without the >), gave me something like this as shell output. Now this is what I find in if.log too.

Thanks for the help.

----------

## m_sqrd

Look like its still running the old rc-script do a 

```

ls -l /etc/runlevels/default/

```

and the output of

```

ls -l /etc/init.d/net.*

```

and let me see that.

----------

## Luc484

 *m_sqrd wrote:*   

> Look like its still running the old rc-script do a 
> 
> ```
> 
> ls -l /etc/runlevels/default/
> ...

 

The output of the first is:

```

total 0

lrwxrwxrwx  1 root root 17 Jul  1 18:07 acpid -> /etc/init.d/acpid

lrwxrwxrwx  1 root root 21 Jul 13 01:32 bluetooth -> /etc/init.d/bluetooth

lrwxrwxrwx  1 root root 20 Jul  1 18:07 coldplug -> /etc/init.d/coldplug

lrwxrwxrwx  1 root root 19 Jul  1 18:07 hotplug -> /etc/init.d/hotplug

lrwxrwxrwx  1 root root 17 Jun 30 10:27 local -> /etc/init.d/local

lrwxrwxrwx  1 root root 20 Jul  1 18:06 net.eth0 -> /etc/init.d/net.eth0

lrwxrwxrwx  1 root root 20 Jun 30 10:27 netmount -> /etc/init.d/netmount

lrwxrwxrwx  1 root root 19 Aug 21 05:31 portmap -> /etc/init.d/portmap

lrwxrwxrwx  1 root root 16 Jul  1 18:07 sshd -> /etc/init.d/sshd

lrwxrwxrwx  1 root root 21 Jul  1 18:06 syslog-ng -> /etc/init.d/syslog-ng

lrwxrwxrwx  1 root root 22 Jul  1 18:06 vixie-cron -> /etc/init.d/vixie-cron

lrwxrwxrwx  1 root root 18 Jul  1 18:06 xinetd -> /etc/init.d/xinetd

```

and the output of the second is:

```

lrwxrwxrwx  1 root root   6 Sep  3 01:44 /etc/init.d/net.eth0 -> net.lo

-rwxr-xr-x  1 root root 512 Sep  3 01:44 /etc/init.d/net.lo

```

Thanks again.

----------

## m_sqrd

There the problem or at least part of it.

 *Quote:*   

> 
> 
> lrwxrwxrwx  1 root root   6 Sep  3 01:44 /etc/init.d/net.eth0 -> net.lo
> 
> -rwxr-xr-x  1 root root 512 Sep  3 01:44 /etc/init.d/net.lo 
> ...

 

you still have the old /etc/init.d/net (scripts) "see the file size 512" it should be like 24K 

mv /etc/init.d/net.lo  /etc/init.d/net.lo_old

re-emerge baselayout, re-run etc-update 

(hopefully as you have moved the old file it will write the new /etc/init.d/net.lo with out asking in the etc-update part but if it dose select the over write ) 

then check your files with ls -l /etc/init.d/net.* and see if that look more like this.

 *Quote:*   

> 
> 
> ls -l /etc/init.d/net.*
> 
> lrwxrwxrwx  1 root root     6 Aug 24 07:20 /etc/init.d/net.eth0 -> net.lo
> ...

 

if that all look good then try /etc/init.d/net.eth0 restart again

if every thing gose ok then you can remove the RC_VERBOSE="yes" or set it to RC_VERBOSE="no" in the /etc/conf.d/rc file and remove or comment out  the 2 functions from the /etc/conf.d/net file

----------

## Luc484

You great man. Everything's ok now. Thanks you so much. I'm adding the [Solved] tag.

Hi and thanks again.

----------

## m_sqrd

H2H 

<happy to Help>

----------

