# Need help setting static ip on eth0 after emerge -uDpv world

## CarlUman

I've looked at a number threads here and wasn't able to get this fixed yet.  After updating my machine I could no longer access the internet (anything outside my machine).  What I found and what I have done...

First I got the message that I should no longer use the /etc/dsndomainname and /etc/hostname (Not real sure of the file names but they were both in /etc)

So my setup files are as follows

```
# /etc/resolv.conf

# no changes were made here

nameserver 167.142.199.161

domain unternahrer.com

```

```
# /etc/hosts

# some changes made here in attempt to get things working

192.168.1.4   gopher.unternahrer.com  gopher

192.168.1.1   christopher.100woods    christopher

127.0.0.1       localhost.localdomain   localhost

```

```
# /etc/conf.d/hostname

# New file

HOSTNAME="gopher"

```

```
# /etc/conf.d/domainname

# New file

# When setting up resolv.conf, what should take precedence?

# If you wish to always override DHCP/whatever, set this to 1.

OVERRIDE=1

DNSDOMAIN="unternahrer.com"

NISDOMAIN="gopher.unternahrer.com"

```

```

# /etc/conf.d/net

# No changes

# This is basically the ifconfig argument without the ifconfig $iface

iface_eth0="192.168.1.4 broadcast 192.168.1.255 netmask 255.255.255.0"

gateway="eth0/192.168.1.254"

```

The result of the above files give me this for eth0 when I do ifconfig -a

no inet line at all

BROADCAST MULTICAST

If I do...

ifconfig eth0 192.168.1.4 broadcast 192.168.1.255 netmask 255.255.255.0 up

I get this from ifconfig -a...

inet addr 192.168.1.4 bcast 192.168.1.255 mask 255.255.255.0

UP BROADCAST RUNNING MULTICAST

Thanks in advance  :Smile: 

Carl

----------

## fourhead

Simply rename /etc/conf.d/net to /etc/conf.d/net.eth0 - that should do the trick!

Tom

----------

## nixnut

Did you start the network? /etc/init.d/net.eth0 start

For autostarting after booting: rc-update add net.eth0 default

----------

## CarlUman

Changed /etc/conf.d/net to /etc/conf.d/net.eth0 and it does the same thing

net.lo is boot

net.eth0 is default

/etc/init.d/net.eth0 start

Tells me that it is already started

Thanks

This is very strange.  It has to be something simple... right?

----------

## CarlUman

Just checking for more ideas  :Smile: 

----------

## CarlUman

Anyone?

----------

## m_sqrd

Did you run etc-update after the upgrade?

next I'd check the /etc/conf.d/net.example and see if there be a syntax change in the /etc/conf.d/net file

----------

## CarlUman

Checked the example and it looks like there was a change.  I made the changes but still no go. Is the file suppose to be net or net.eth0 ?

While looking at /etc/init.d/net.eth0 I can't see that /etc/conf.d/net or net.eth0 are referenced.  Where is this reference made?  I'd post my files again but I'm at work and ssh isn't work due to an ip change.

Thanks

Carl

----------

## m_sqrd

it should still be /etc/conf.d/net

but you can look at you're /etc/init.d/net.lo file see if the line 

#NB: Config is in /etc/conf.d/net

is there.

----------

## CarlUman

Oh, BTW I did dispatch-conf instead of etc-update (forgot to answer that).

```
#!/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

}

```

current after looking at net.example

```
# /etc/conf.d/net:

# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/net,v 1.7 2002/11/18 19:39:22 azarah Exp $

# Global config file for net.* rc-scripts

# This is basically the ifconfig argument without the ifconfig $iface

#

config_eth0=( "192.168.1.4 broadcast 192.168.1.255 netmask 255.255.255.0" )

# For setting the default gateway

#

routes_eth0=( "default via 192.168.1.254" )

```

old way

```
# /etc/conf.d/net:

# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/net,v 1.7 2002/11/18 19:39:22 azarah Exp $

# Global config file for net.* rc-scripts

# This is basically the ifconfig argument without the ifconfig $iface

#

iface_eth0="192.168.1.4 broadcast 192.168.1.255 netmask 255.255.255.0"

# For setting the default gateway

#

gateway="eth0/192.168.1.254"
```

EDIT:

/etc/init.d/net.lo

```
#!/sbin/runscript

# Copyright (c) 2004-2005 Gentoo Foundation

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

# $Header$

# Contributed by Roy Marples (uberlord@gentoo.org)

# Many thanks to Aron Griffis (agriffis@gentoo.org)

# for help, ideas and patches

#NB: Config is in /etc/conf.d/net

```

----------

## m_sqrd

Ok so I'm guessing your working ok now (?) if not post what is still not working.

----------

## CarlUman

 *m_sqrd wrote:*   

> Ok so I'm guessing your working ok now (?) if not post what is still not working.

 

Sorry, I was thinking it but forgot to post it...  Still having same problem.  Was hoping the files last posted would help  :Smile: 

----------

## m_sqrd

try  "my new net.example shows netmake then broadcast."

config_eth0=( "192.168.1.4  netmask 255.255.255.0  broadcast 192.168.1.255" ) 

```

# We can also specify a broadcast

#config_eth0=( "192.168.0.2/24 brd 192.168.0.255" )

#config_eth0=( "192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255" )

```

----------

## cassiusa

oops

----------

## Angryguy

I just updated my system, and I'm getting the exact same issue.

The driver for the network card is loaded and the system claims that eth0 is already started.  However ifconfig lists only lo, as does the Gnome network-monitor tool.  I've tried a few of the suggestions in this thread (in all cases, my files/config seem to be identical , but I seem to be getting the same as those posted by CarlUMan) without luck.

Have you found a solution to our mutual problem?  If so, please share.

Thanks.

----------

## CarlUman

No I have not yet found an ansewr.  I was thinking maybe I was doing something wrong along way.  Sorry to hear you having the same problem but company is nice when you are stranded  :Smile: 

----------

## Angryguy

I've made some progress, but haven't gotten there just yet.  Unfortunately, I start classes in the morning tommorow, so I don't have time to keep experimenting tonight.  Before I forget what I did (since I won't be able to read my own handwriting 10 minutes from now), I better write it up.

The network card apparently is detected, but simply not configured.  Manual configuration however does seem to bring the network up, (even though I'm almost positive I tried this the other day and it didn't work. . .)  either using the ifconfig/route commands, or "dhcpcd eth0"  See Manual Network Configuration in the Gentoo Handbook for details: http://www.gentoo.org/doc/en/handbook/2005.0/handbook-x86.xml?part=1&chap=3#doc_chap4

It seems that the problem is definetly related to the change in the configuration files.  The boot-screen goes by to quickly however, so I don't know what all of the changes are supposed to be.

I've modified the following files so far:

 /etc/dnsdomainname => /etc/conf.d/domainname

 /etc/hostname => /etc/conf.d/hostname

In the hostname file, change the value of the file to: HOSTNAME="value"

The dnsdomainname file apparently needs a similar change, but I'm not sure what to change it to.

Remaining: /etc/rc.conf

  This file apparently gets split into more than one conf file, exactly how though I'm not sure - that's for another days work.

On my last attempt, most of the warnings seem to have dissapeared, but in its place I got a domain login error on boot (which I fixed), and then later the system stopped responding when I tried shutting down.  I think I made an error in modifying the dnsdomainname file, but I'm not positive.

----------

## Angryguy

Does anyone have any ideas how to fix this problem?

The network deos work and eth0 is started without errors on startup. ifconfig however does not list eth0, and I cannot access the network until I manually configure the network, either through ifconfig/route or dhcpcd.  

I've updated the /etc/conf.d/net file to be configured for static IP, to use default dhcp, and to explicitly request dhcp, and the result in all cases is the same - nothing.

I've even added an echo statement to the top of the config file to make sure that it is actually being processed, which it is (the test line prints out both during startup and shutdown).

rc-update add net.eth0 start gives a message that eth0 has already started.

/etc/init.d/net.eth0 does exist.  If I open it in nano however, it is a very short file (a lot shorter than .lo for example), .  It contains a start and end functions, both of which are short and do not seem to references the config file directly.  The begin function looks like it brings up the lo interface, but mentions nothing about eth0.  I don't think I've ever modified this file, and I don't know anything about what these scripts are supposed to contain, but could this be part of the problem?  And if so, why would the init script have changed . . . or was there another config that overrode this file thats missing?

Thxs.

less /etc/init.d/net.eth0

 *Quote:*   

> 
> 
> #!/sbin/runscript
> 
> # Copyright 1999-2004 Gentoo Technologies, Inc.
> ...

 

Currently my /etc/conf.d/net file contains:

 *Quote:*   

> 
> 
> config_eth0=( "192.168.1.12 netmask 255.255.255.0" )
> 
> routes_eth0=( "default gw 192.168.1.1" )
> ...

 

On boot, ifconfig lists only lo.  If I do ifconfig eth0 I get the following:

 *Quote:*   

> 
> 
> david # ifconfig eth0
> 
> eth0      Link encap:Ethernet  HWaddr 00:0C:76:E9:89:E1
> ...

 

ifconfig after bringing network up:

 *Quote:*   

> 
> 
> LinuxGuy david # ifconfig
> 
> eth0      Link encap:Ethernet  HWaddr 00:0C:76:E9:89:E1
> ...

 

After I do "dhcpcd eth0", ifconfig for eth0 gives:

 *Quote:*   

> 
> 
> eth0      Link encap:Ethernet  HWaddr 00:0C:76:E9:89:E1
> 
>           inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
> ...

 

----------

## m_sqrd

 *Quote:*   

> 
> 
> rc-update add net.eth0 start
> 
> 

 

try this 

rc-update add net.eth0 default

/etc/init.d/net.eth0  should be a softlink to /etc/init.d/net.lo

IE:

ln -s /etc/init.d/net.lo  /etc/init.d/net.eth0 

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

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

-rwxr-xr-x  1 root root 24385 Aug 24 07:20 /etc/init.d/net.lo

try this in your /etc/conf.d/net 

config_eth0=( "192.168.1.12 netmask 255.255.255.0" )

routes_eth0=( "default gw 192.168.1.1" ) 

postup() {

        echo "File etc-conf.d-net has been processed ********" 

       return 0

}

----------

## Angryguy

rc-update gave a message that its already in the default runlevel.

It seems that for some reason /etc/init.d/net.eth0 had its own file, and there was no softlink present:

 *Quote:*   

> 
> 
> LinuxGuy david # rc-update add net.eth0 default
> 
>  * net.eth0 already installed in runlevel default; skipping
> ...

 

Now to see if it works . . . . 

Edit

Works perfectly, thanks.  I don't understand why that file/link would have been replaced during an update world (assuming it had to have been set originally for my network to be working)   . . . 

Now that the main issue is out of the way, time to move on to my remaining problems . .  . and then I can update world again and see what new issues arise.

My Other Issues: https://forums.gentoo.org/viewtopic-t-376394-start-0-postdays-0-postorder-asc-highlight-.html

----------

## CarlUman

I agree.  I'm surprised that lots of others haven't had this same problem.  Isn't anyone doing updates or do most just know Gentoo well enough that they avoided the problem?

----------

