# net.eth0 only works after manual restart

## Dark_Angel

Hey, got a problem with my net.eth0, on boot, it runs normally, no problems, gets its ip address and seems fine, but wont accress the net untill I restart it manually, does the same thing but this time it will access the internet. Don't really want to have to manually start it everytime i boot so any idea as to how to fix this?

Thanks

----------

## barbar

I am not sure what you mean writing *Quote:*   

> ... but wont access the net

 Is it the local network or the internet?

Try setting the default gateway:

```
config_eth0=("dhcp default via 192.168.0.1")
```

 That assumes your default gateway is 192.168.0.1. If this is not true set the ip address accordingly.

----------

## Dark_Angel

hey, thanks for ur reply,

I mean the internet, I'm not sure what the default gateway is or how to find out,

----------

## Praxxus

The default gateway is the IP address that your computer goes through to get to any traffic not on the local LAN.  Usually this is another computer, some sort of home router/firewall, or a cable/DSL modem.  The configuration line that barbar gave you can be found in /etc/conf.d/net.  If your computer is pulling down an IP address automatically, it is using DHCP to do it.  It should be getting the default gateway information at the same time, but it might not be.  I believe barbar is just telling you a way to tell your computer what the default gateway is without having to rely on the DHCP server.

----------

## Mcihi

i have the same problem...

i can access my local network directly after booting - but the default gw is not added (correctly?)...

on startup the system displays 

```
Adding routes

         default gw 192.168.0.1
```

i can ping the gw but cannot access the internet.

when i manually restart eth0 (/etc/init.d/net.eth0 restart) it works fine...

Here is my /etc/conf.d/net:

```
config_eth0=( "192.168.0.2 netmask 255.255.255.0 brd 192.168.0.255")

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

----------

## Praxxus

Michi and Dark_Angel:  What is the output of running 

```
netstat -rn
```

 when you first boot up (before you restart the interfaces manually)?

----------

## Mcihi

```
Kernel IP Routentabelle

Ziel            Router          Genmask         Flags   MSS Fenster irtt Iface

192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0

127.0.0.0       127.0.0.1       255.0.0.0       UG        0 0          0 lo

```

I guess there's supposed to be a default route, but there is none...

something like 0.0.0.0 192.168.0.1 255.255.255.0 ...

----------

## Praxxus

Yeah. Mine at home looks like:

```
Kernel IP routing table

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface

172.30.0.0      0.0.0.0         255.255.255.240 U         0 0          0 eth0

127.0.0.0       127.0.0.1       255.0.0.0       UG        0 0          0 lo

0.0.0.0         172.30.0.1      0.0.0.0         UG        0 0          0 eth0
```

I'm kind of stumped on this one.   The two things I notice in [color=blue]/etc/conf.d/net.example that are different from your config are:1. You don't have a space between your closing quote and closing parenthesis on each line

2. The example file has "default via 192.168.0.1" instead of "default gw . . ."Those both seem like silly differences, but like I said, I'm stumped.

Is your baselayout up to date?

----------

## Mcihi

hm, now my /etc/conf.d/net looks like

```
config_eth0=( "192.168.0.2 netmask 255.255.255.0 brd 192.168.0.255 " )

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

still doesn't work...

sorry, is my WHAT up-to-date?   :Confused: 

----------

## Mcihi

anybody an idea?

----------

## DoorGunner

hi

This is the set up for DHCPCD and it will set up to look for your ip automatically

I found this site that may help you a bit 

http://www.gentoo.org/doc/en/home-router-howto.xml

Gentoo Linux Documentation -- Home Router Guide 

What i found was you need to set your eth1 connections 

have a look at 

#ifconfig -a 

you will see info for eth.lo eth0 and eth1 

eth1 is what you need to target for internet 

What i hope to do is instruct you how to set up eth1 as default and remove eth0 

******************************************************************* 

you will need to do this 

# ln -s net.lo /etc/init.d/net.eth1 

.....this line creates a net.eth1 

# rc-update add net.eth1 default 

.....this line adds a new daemon 

#rc-update remove net.eth0

..... this removes the unwanted eth0 

this will set u your eth1 

next edit your net configuration 

#gedit /etc/conf.d/net 

config_eth1=( "dhcp") 

That is all the whole config needs to see (so get rid of the rest of it )

save and close 

#/etc/init.d/net.eth1 start 

If in fact you are trying to use a static address you can adapt this to work for it as well...... However why not just let DHCPCD work automatically for you?

Hopefully this helped

----------

## Mcihi

the tutorial you mean is intended for people who want to use their linux as a router.

i do not want to do that.

you think it would work for eth1? what should be the difference between eth0 and eth1 - if not just the name?

i do not want to use dhcp, and anyways - it still works after a manual restart of net.eth0 - so the "default via" command cannot only be supported by a dhcp configuration.

i am loosing my confidence - i just cant think of a solution...   :Crying or Very sad:   :Crying or Very sad:   :Crying or Very sad: 

----------

## DoorGunner

It has parts of that in there. However what you want is basically what is in my thread.....

I just extracted that information from there for you to use. It was an additional source for you if you want it.

----------

## Mcihi

doesn't anybody have any idea?

----------

## DoorGunner

Yes change it from eth 0 to eth 1......it will work....i had the same problem...

----------

## Mcihi

i'm sorry, i don't want to be offensive, but what you say is bullshit! if i would do that i would not have any network-connection at all.

can anybody confirm that?

does anybody have any (other) idea?

----------

## weaner

Hi there, I've been struggling with this problem for a while too. I think the problem is the version of dhcpcd you have been using, I upgraded to version 2.0.3 and now dhcpcd works as it should/did. No need to restart the network connection.

Hope this helps.

----------

## Mcihi

ok, i'll try that... but i'm not using dhcp at all!

----------

## PMcCauley

You could try

```
route add default gw x.x.x.x
```

where x.x.x.x is the correct gateway.  Based on your routing table the gateway is not set but why restarting the service would work is strange.  Maybe something else is changing the gateway.  I'd be tempted to add /etc/init.d/net.eth0 restart to /etc/conf.d/local.start just as a workaround, or if the route command does it add that.  To troubleshoot the issue you either want to create another runlevel for testing or change your current runlevel to start as little as would be required to boot the system and start network.  You may find one service causing the issue.  Use 

```
rc-update show
```

 to get startup list and 

```
rc-update del XXX
```

 to remove where XXX is the service.

Patrick

EDIT: One thing to add DoorGunner may have got his eth1 to work because eth0 was assigned to another nic(or some kernel issue).  But renaming your config file should not change what the nic is assigned to, you should get a message that the interface doesn't exist(unless it does).  Also note the way to activate a second nic on boot is to either create a copy or a system link to the /etc/init.d/net.eth0 file.  eg. 

```
ln -s /etc/init.d/net.eth0 /etc/init.d/net.eth1
```

 -s is optional and will report if filesystem doesn't support symbolic links.

----------

## DoorGunner

This is what i have

 # ifconfig -a

eth0      Link encap:UNSPEC  HWaddr 00-E0-18-00-00-8F-2E-9E-00-00-00-00-00-00-00-00

          BROADCAST MULTICAST  MTU:1500  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:1000

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

eth1      Link encap:Ethernet  HWaddr 00:11:2F:5B:5A:97

          inet addr:192.168.0.4  Bcast:192.168.0.255  Mask:255.255.255.0

          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000

          RX bytes:2609917 (2.4 Mb)  TX bytes:297867 (290.8 Kb)

          Interrupt:20 Base address:0xa000

lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

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

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

          collisions:0 txqueuelen:0

          RX bytes:16226 (15.8 Kb)  TX bytes:16226 (15.8 Kb)

my initial setup was for eth.0 however i noticed that eth.1 was transmiting and recieving 

 *Quote:*   

> RX bytes:2609917 (2.4 Mb)  TX bytes:297867 (290.8 Kb)

 

thats why i went with eth.1 for my set up.

I didnt really need eth.0 so i got rid of the init.d/eth.0 cause it was causing red [!!] on my startup

I made an assumption that you might be having the same problem. Thats why i was trying to convince you of Eth.1 ....however in hindsite that may have been the wrong thing to say.

Does this look similar to what you have Mcihi or do you just have eth.lo and eth.0?

The other thing i notice PMcCauley was that my eth.0 had an abnormally long mac id for eth.0

----------

## PMcCauley

 *DoorGunner wrote:*   

> 
> 
> The other thing i notice PMcCauley was that my eth.0 had an abnormally long mac id for eth.0

 

Does the output of 

```
ifconfig eth0
```

 change after restarting that interface?  One other thing for eth0 is that there is no base address or interrupt so this could be a kernel problem and the interface is not up(it should say UP on this line).    *DoorGunner wrote:*   

> BROADCAST MULTICAST MTU:1500 Metric:1

 

You might as well post you type of card here in case that is helpful and anything else that may clarify exactly how this network is set up, and what kernel options you have enabled for these cards.  It looks like you have two nics with the same ip range, unless you have a good reason to do this(to get the two networks separate) then just use one network card.   Based on your ifconfig you would not be able to use eth0 at all as it has no valid connection information.

Patrick.

EDIT: there has been a lot of different people posting on this thread so I guess DoorGunner you may not have both nics on the same ip range but nontheless just provide some followup information if you would like and maybe one of up will come up with something.

----------

## DoorGunner

Here is the entirety of my #lspci

00:00.0 Host bridge: VIA Technologies, Inc. VT8378 [KM400/A] Chipset Host Bridge

00:01.0 PCI bridge: VIA Technologies, Inc. VT8237 PCI Bridge

00:09.0 Multimedia audio controller: Creative Labs SB Audigy (rev 03)

00:09.1 Input device controller: Creative Labs SB Audigy MIDI/Game port (rev 03)

00:0a.0 Communication controller: Agere Systems V.92 56K WinModem (rev 03)

00:0b.0 FireWire (IEEE 1394): VIA Technologies, Inc. IEEE 1394 Host Controller (rev 80)

00:0f.0 IDE interface: VIA Technologies, Inc. VIA VT6420 SATA RAID Controller (rev 80)

00:0f.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06)

00:10.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)

00:10.1 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)

00:10.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)

00:10.3 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)

00:10.4 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 86)

00:11.0 ISA bridge: VIA Technologies, Inc. VT8237 ISA bridge [KT600/K8T800/K8T890 South]

00:12.0 Ethernet controller: VIA Technologies, Inc. VT6102 [Rhine-II] (rev 7 :Cool: 

01:00.0 VGA compatible controller: nVidia Corporation NV43 [GeForce 6600/GeForce 6600 GT] (rev a2)

Ok PMcCauley...... if there is anything else that i can do to help out let me know....

----------

## Mcihi

 *PMcCauley wrote:*   

> 
> 
> ```
> route add default gw x.x.x.x
> ```
> ...

 

ok, i added this to local.start. now it works fine. thanks a lot.

but one more question:

when are the commands in local.start executed? because other startup programs in the default runlevel require a working network for proper startup...

greets, michi

----------

