# Strange networking problem {solved}

## johntramp

Hi, I have just reinstalled gentoo on this pc after a harddrive crash and now I am having problems with setting up the networking.

From /etc/init.d/net.eth0 I can not start the network card, but it works fine when I manually use ifconfig.  I know I could put the required commands into /etc/conf.d/local.start but thats not ideal.

 *Quote:*   

> odysseus john # cat /etc/conf.d/net
> 
> config_eth0=( "10.0.0.4 netmask 255.255.255.0" )
> 
> routes_eth0=( "default gw 10.0.0.1" )
> ...

 Is there something I am missing?  I feel like an idiot for not being able to get something so simple to work.

I also tried the older format in /etc/conf.d/net of iface_eth0="10.0.0.4 broadcast 10.0.0.255 netmask 255.255.255.0" but got the same results.

Thanks for any help you may be able to give me  :Smile: Last edited by johntramp on Mon Oct 24, 2005 2:59 am; edited 1 time in total

----------

## Exil

If you can use dhcp install dhcpcd. It should run correctly.

----------

## Decibels

I'm not a networking expert. But look at the broadcast & netmask when you have it working in the manually.

IP 10.0.0.4 should have a netmask of 255.0.0.0 and bcast of 10.255.255.255 

So why don't you config /etc/conf.d/net this way:

config_eth0=( "10.0.0.4 netmask 255.0.0.0 broadcast 10.255.255.255" )

routes_eth0=( "default gw 10.0.0.1" ) 

I think the broadcast can be something else too, depending on your network, but looking at your working ifconfig I would leave it at what works.

Try that and let me know.

----------

## johntramp

 *Decibels wrote:*   

> I'm not a networking expert. But look at the broadcast & netmask when you have it working in the manually.
> 
> IP 10.0.0.4 should have a netmask of 255.0.0.0 and bcast of 10.255.255.255 
> 
> So why don't you config /etc/conf.d/net this way:
> ...

 Hey, thanks for the response.  I tried this but it did not seem to make a difference.

```
odysseus john # ifconfig 

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:50 errors:0 dropped:0 overruns:0 frame:0

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

          collisions:0 txqueuelen:0 

          RX bytes:2500 (2.4 Kb)  TX bytes:2500 (2.4 Kb)

odysseus john # /etc/init.d/net.eth0 start

 * WARNING:  "net.eth0" has already been started.

odysseus john # /etc/init.d/net.eth0 stop

 * Unmounting network filesystems ...                                                                                                                                           [ ok ]

 * Stopping ntpd ...

No /usr/sbin/ntpd found running; none killed.

 * Failed to stop ntpd                                                                                                                                                          [ !! ]

 * ERROR:  problems stopping dependent services.

 *         "net.eth0" is still up.

odysseus john # /etc/init.d/ntpd stop

 * Stopping ntpd ...

No /usr/sbin/ntpd found running; none killed.

 * Failed to stop ntpd                                                                                                                                                          [ !! ]

odysseus john # /etc/init.d/ntpd zap 

 * Manually resetting ntpd to stopped state.

odysseus john # /etc/init.d/net.eth0 stop

 * Stopping sshd ...                                                                                                                                                            [ ok ]

 * Bringing eth0 down ...                                                                                                                                                       [ ok ]

odysseus john # ifconfig 

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:50 errors:0 dropped:0 overruns:0 frame:0

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

          collisions:0 txqueuelen:0 

          RX bytes:2500 (2.4 Kb)  TX bytes:2500 (2.4 Kb)

odysseus john # /etc/init.d/net.eth0 start

 * Bringing eth0 up ...                                                                                                                                                         [ ok ]

odysseus john # ifconfig 

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:50 errors:0 dropped:0 overruns:0 frame:0

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

          collisions:0 txqueuelen:0 

          RX bytes:2500 (2.4 Kb)  TX bytes:2500 (2.4 Kb)

odysseus john # ifconfig -a

eth0      Link encap:Ethernet  HWaddr 00:11:2F:62:08:A6  

          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)

          Interrupt:16 Memory:ec000000-0 

eth1      Link encap:Ethernet  HWaddr 00:30:B4: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)

          Interrupt:17 Base address:0x4000 

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:50 errors:0 dropped:0 overruns:0 frame:0

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

          collisions:0 txqueuelen:0 

          RX bytes:2500 (2.4 Kb)  TX bytes:2500 (2.4 Kb)

odysseus john # ifconfig eth0 10.0.0.4

odysseus john # route add default gw 10.0.0.1

odysseus john # ifconfig -a

eth0      Link encap:Ethernet  HWaddr 00:11:2F:62:08:A6  

          inet addr:10.0.0.4  Bcast:10.255.255.255  Mask:255.0.0.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:9 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:968 (968.0 b)  TX bytes:1035 (1.0 Kb)

          Interrupt:16 Memory:ec000000-0 

eth1      Link encap:Ethernet  HWaddr 00:30:B4: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)

          Interrupt:17 Base address:0x4000 

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:50 errors:0 dropped:0 overruns:0 frame:0

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

          collisions:0 txqueuelen:0 

          RX bytes:2500 (2.4 Kb)  TX bytes:2500 (2.4 Kb)
```

There is definately something strange happening tho.

----------

## Decibels

Yes, there is!!  I am out of time, have to go to work and they shut the internet off pretty much. Only at night, notice says to protect us from viruses and such. I guess during the day viruses don't attack.   :Evil or Very Mad: 

Anyway, for my two cents, I would say see if you can look into what ifconfig is doing manually that isn't happening from the net script. Is /etc/conf.d/net relying on something that it isn't with manual ifconfig? Like resolv.conf, or net.eth0 being a symlink to net.lo, fqdn not correct? Just throwing stuff out there. Good Luck!

----------

## johntramp

Hey,  I found the problem was the /etc/init.d/net.eth0 script.  I linked from /etc/init.d/net.lo and it worked fine.

Here is the origional /etc/init.d/net.eth0 script,  I have no idea what it was doing as net.eth0 tho

```
#!/sbin/runscript

# Copyright 1999-2004 Gentoo Technologies, Inc.

# Distributed under the terms of the GNU General Public License v2

# $Header: /home/cvsroot/gentoo-src/rc-scripts/init.d/net.lo,v 1.10 2004/04/21 17:09:18 vapier Exp $

start() {

   ebegin "Bringing ${IFACE} up"

   /sbin/ifconfig lo 127.0.0.1 up 2>/dev/null

   /sbin/route add -net 127.0.0.0 netmask 255.0.0.0 \

      gw 127.0.0.1 dev lo 2> /dev/null

   eend 0

}

stop() {

   ebegin "Bringing ${IFACE} down"

   /sbin/ifconfig ${IFACE} down &>/dev/null

   eend 0

}

```

Thanks for the help Decibels  :Smile: 

----------

## Decibels

I just had a feeling when got home in the morning you would have it solved!

Glad to hear it.   :Very Happy: 

----------

## allaboutmike

I had the same problem after doing an emerge -u world. I suspect that the older baselayout (thats where the rc scripts come from isn't it?) had net.eth0 as a script instead of a symlink. The new baselayout uses a different syntax and obviously net.ethx are all symlinks back to net.lo now. having removed the original script and replaced with a symlink to net.lo all is right in the world again.

--

Have a Nice Day!

Mike

----------

## johntramp

so would that mean it is a bug somewhere in the baselayout upgrade?

----------

## Decibels

I'm not sure! Mine worked fine from what I remember. Saw someone mention that it was a symlink now while back.

Went and looked and sure enough it was. It's been awhile, think at least several months since this happened.

Maybe look in the bug reports, changelog,... for the baselayout you have and see what's up. If it is the baselayout

that you just upgraded to. You could remerge it and look thru the build process and ebuild script and see what it is/was doing. Then decide if a bug report is necessary.

Idea: Was just thinking. If you have all the stuff still in your /usr/portage/distfiles from the upgrade, if not --fetchonly them.  Then rename the /etc/init.d/net.eth0 to something else. Then 'touch /etc/init.d/net.eth0' so that it isn't a symlink. Then remerge the baselayout and see what happens. Just a thought.

----------

## anggarda

Hiello, fellow gentoo users. 

I've experience the same problem, net.eth0 was created by rc-update. 

I've seen deleted/removed net.eth0 from /etc/init.d/ and symlinked it manually. 

The init scripts now loads the network device right. 

Thanks for the head up.

Salut.

----------

