# /etc/conf.d/net being ignored?

## adam_aus

Hi all,

I'm new to Gentoo, and have just finished a basic installation. I'm having a problem setting a static IP for my ethernet adapter eth0, and it appears that the contents of my /etc/conf.d/net file are being ignored. The file itself contains:

```
config_eth0=( "192.168.0.100 broadcast 192.168.0.255 netmask 255.255.255.0" )

routes_eth0=( "default gw 192.168.0.1" )

```

Whenever /etc/init.d/net.eth0 start is run (eg on boot, I have it in the default runlevel), I get the following readout:

```
Starting eth0

Bringing up eth0

Configuration not set for eth0 - assuming dhcp

...

```

It then goes off and allocates an address via DHCP, which is not what I want it to do.

Any idea as to why my /etc/conf.d/net file is apparently being ignored?

Cheers! Adam

----------

## NeddySeagoon

adam_aus,

I'm starting to lose the plot with the syntax of /etc/conf.d/net. There are 3 or 4 in circulation and you must use the right one for your install.

Be sure your syntax matches that in /etc/conf.d/net.example

----------

## adam_aus

 *NeddySeagoon wrote:*   

> I'm starting to lose the plot with the syntax of /etc/conf.d/net. There are 3 or 4 in circulation and you must use the right one for your install.
> 
> Be sure your syntax matches that in /etc/conf.d/net.example

 

Yep, thanks for that. I've followed the syntax provided in the example file, to the letter. And I've tried the iface_eth0="", ifconfig=( "" ) and gateway="" formats too, all to no avail.   :Sad: 

----------

## NeddySeagoon

adam_aus,

The file /etc/inid.d.net.eth0 should be a symbolic link to net.lo, is it ?

Has your /etc/conf.d/net file name got mangled somehow, so the scripts don't find it?

----------

## adam_aus

NeddySeagoon,

 *NeddySeagoon wrote:*   

> The file /etc/inid.d.net.eth0 should be a symbolic link to net.lo, is it ?
> 
> Has your /etc/conf.d/net file name got mangled somehow, so the scripts don't find it?

 

/etc/init.d/net.eth0 is a symlink to net.lo, yes (after all, running net.eth0 start does actually start the service, just minus my configuration). I've moved the default /etc/conf.d/net out of the way and created a new one from scratch, with the contents as above, several times, without success.

However, I just now shut down eth0, intentionally added a line of garbage (the string abcxyz) to the net file, and then ran /etc/init.d/net.eth0 start. This produced the warning:

```
/etc/conf.d/net: line 9: abcxyz: command not found
```

...and then promptly continued on its merry way of ignoring my configuration with the usual Configuration not set error. So it's clearly parsing the file, and yet presumably not finding the syntax it's expecting? But not spitting out any warnings about invalid lines?

FYI, I installed the 2005.1 x86 stage3 tarball, if that helps...

Thanks for your help!

Adam

----------

## NeddySeagoon

adam_aus,

Do you have an outstanding 

```
etc-update
```

Its just posible that you allowed an updated /etc/init.d/net.lo to happen (the script)

but stopped the corresponding /etc/conf.d/net because you realised it would wipe your settings. IF there was a syntax change, you would have a script expectioin one thing and a net providing another. That would produce your symptoms.

The following net syntax is the latest I know about 

```
config_eth0=(

       "192.168.100.18/24 broadcast 192.168.100.255"

)

routes_eth0=(

       "default via 192.168.100.1"

       "-net 192.168.0.0/24 via 192.168.100.6"

)
```

The following is next oldest

```
ifconfig_eth0=(

       "192.168.10.10 broadcast 192.168.10.255 netmask 255.255.255.0"

)

routes_eth0=(

       "-net 192.168.0.0/24 gw 192.168.10.1"

       "default gw 192.168.10.1"

)
```

Then I have a sample missing, the oldest I can still reproduce is from version 1.4-rc4, which is about 2 yesrs old now.

Its unlikely you need that.

----------

## adam_aus

 *NeddySeagoon wrote:*   

> Do you have an outstanding etc-update

 

Not that I'm aware of. I ran etc-update anyway to see if it produced any output, but it had nothing to do.

 *NeddySeagoon wrote:*   

> The following net syntax is the latest I know about...

 

I tried both of those, and neither had any effect. I also tried the config that's running just fine on my work Gentoo box, which was a stage3 2005.0 install:

```
ifconfig_eth0="192.168.0.100 broadcast 192.255.255.255 netmask 255.255.255.0"

gateway="eth0/192.168.0.1"
```

Once again, nothing.

I backed up my net.lo and deleted the symlink net.eth0, and replaced those with the equivalents from my work Gentoo box (in that case, net.eth0 is a script and not a symlink to net.lo). net.lo came up fine, but net.eth0 wouldn't start - it complained about $ifconfig_eth0 not being set in /etc/conf.d/net, despite the fact it was in there.

I've pretty much hit the limit of ideas for now. The only thing I can think of at all is that I'm missing a module capable of reading the configs or something, but I don't know how this could have happened, seeing as I followed the Gentoo install handbook to the letter...   :Sad: 

----------

## NeddySeagoon

adam_aus,

Add 

```
modules=( "ifconfig" )
```

to your net file to explictly demand ifconfig support. 

As its the defualt, iit fails silently if its not present.

Does that generate an error ?

See the modules section of

```
less /etc/conf.d/net.example
```

----------

## adam_aus

Hi NeddySeagoon,

 *NeddySeagoon wrote:*   

> Add 
> 
> ```
> modules=( "ifconfig" )
> ```
> ...

 

Unfortunately, no change at all. I'm beginning to sound like a broken record here.   :Sad: 

I re-emerged sys-apps/net-tools, but nothing doing there either. This is bizarre. I wonder if it'll be possible to replace the necessary components with scripts from another installation of Gentoo, and get it working that way? Or is the problem possibly related to environment variables somehow? ifconfig seems to be working fine...

Cheers, AdamLast edited by adam_aus on Wed Sep 28, 2005 2:32 pm; edited 1 time in total

----------

## NeddySeagoon

adam_aus,

Please post the output from 

```
ls -l /etc/init.d/ne*
```

----------

## jamapii

I think this is a possible explanation/solution:

Most of the config files are parsed as shell scripts. If it looks like one, it most likely is. (There are exceptions where the Gentoo scripts parse the files and allow only variable assignments.)

There are several styles for net config files. The current version looks like:

```
config_eth0=( "192.168.0.100/24" )

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

After an opening parenthesis, you can use line breaks, exactly as in the shell.

As far as I know, ifconfig parameters do NOT work. For routes, "gw" does NOT work, it must be "via".

There are older styles like ifconfig_eth0... and iface_... These are more similar to ifconfig parameters, but I don't know the details.

Older styles must be used for old versions of baselayout, but I don't think you have one. If you have 1.11 or newer, the new style should work.

----------

## adam_aus

 *NeddySeagoon wrote:*   

> Please post the output from 
> 
> ```
> ls -l /etc/init.d/ne*
> ```
> ...

 

The output is:

```
root:~> ls -l /etc/init.d/ne*

lrwxrwxrwx  1 root root     6 Sep 26 23:05 /etc/init.d/net.eth0 -> net.lo

-rwxr-xr-x  1 root root 24402 Sep 26 23:02 /etc/init.d/net.lo

-rwxr-xr-x  1 root root  2873 Jul 23 04:34 /etc/init.d/netmount
```

Incidentally, the version of net.lo is 1.38.2.19 (2005/05/16).

 *jamapii wrote:*   

> As far as I know, ifconfig parameters do NOT work. For routes, "gw" does NOT work, it must be "via".
> 
> There are older styles like ifconfig_eth0... and iface_... These are more similar to ifconfig parameters, but I don't know the details.

 

The "gw" parameter for routes is specified in the given examples in both the Gentoo installation handbook, and in the net.example file, so I'm guessing it's the latest supported syntax. Either way, I've tried alternative syntaxes, including via, and the ifconfig_ and iface_ parameters, and all seem to be ignored. Even entering:

```
modules=( "my_non_existent_module" )
```

...doesn't raise an error, although just having a random line of text in the file does raise a warning. Bizarre.

Cheers! Adam

----------

## m_sqrd

adam_aus,

what version  of baselayout are you using ?

emerge -pv baselayout

----------

## jamapii

 *adam_aus wrote:*   

> The "gw" parameter for routes is specified in the given examples in both the Gentoo installation handbook, and in the net.example file, so I'm guessing it's the latest supported syntax.

 

I have "via" in my net.example, so your baselayout must be a little older than mine.

I have this on a baselayout-1.9.4-r6 box ("old style configuration"):

```
iface_eth0="dhcp"

iface_eth1="192.168.10.161 broadcast 192.168.10.191 netmask 255.255.255.224"

gateway="eth0/192.168.10.81"

```

----------

## adam_aus

m_sqrd,

 *m_sqrd wrote:*   

> what version  of baselayout are you using?

 

I was using sys-apps/baselayout-1.11.12-r4. I emerged the latest version, 1.11.13-r1, updated 39 config files, but nothing's changed... it still can't find my config. Sigh!  :Confused: 

Cheers, Adam

----------

## Zakharov

Perhaps somehow the permissions on /etc/conf.d/net are wrong?

----------

## m_sqrd

adam_aus,

edit your /etc/rconf.d/rc file and add this line

```

# Enable Verbose output from rc-scripts

RC_VERBOSE="yes"

```

then mv your /etc/conf.d/net file and copy and past this on in it place.

```

config_eth0=( "192.168.0.100 netmask 255.255.255.0 broadcast 192.168.0.255" )

routes_eth0=( "default via 192.168.0.1" ) 

preup() {

   echo "setting interface to $config_eth0"

    return 0

}

postup() {

    ifconfig eth0

    return 0

}

```

then type /etc/init.d/net.eth0 restart |tee /tmp/net_log  and post the net_log file.

----------

## adam_aus

 *m_sqrd wrote:*   

> ...post the net_log file.

 

Here's the contents of the file:

```
 * Caching service dependencies ...                                       [ ok ]

 * Unmounting network filesystems ...                                     [ ok ]

 * Stopping postfix ...                                                   [ ok ]

 * Stopping proftpd ...                                                   [ ok ]

 * Stopping sshd ...                                                      [ ok ]

 * Stopping eth0

 *   Loading networking modules for eth0

 *     modules: iptunnel ifconfig dhcpcd apipa

 *   Bringing down eth0

 *     Stopping dhcpcd on eth0 ...                                        [ ok ]

 *     Shutting down eth0 ...                                             [ ok ]

 * Starting eth0

 *   Loading networking modules for eth0

 *     modules: iptunnel ifconfig dhcpcd apipa

 *       ifconfig provides interface

 *       dhcpcd provides dhcp

 *   Bringing up eth0

 *     Configuration not set for eth0 - assuming dhcp

 *     dhcp

 *       Running dhcpcd ...                                               [ ok ]

 *       eth0 received address 192.168.0.8

 * Mounting network filesystems ...                                       [ ok ]

 * Starting postfix ...                                                   [ ok ]

 * Starting proftpd ...                                                   [ ok ]

 * Starting sshd ...                                                      [ ok ]
```

Any clues?   :Confused: 

Cheers! Adam

----------

## NeddySeagoon

adam_aus,

This issue only involves two files. /etc/init.d/net.lo  which is the script pointed to by net.eth0 and /etc/conf.d/net which holds the config information. Please post both files and I'll see if I can recreate the problem here.

Your net file is using eth0 and not ethO?

The first one is numeral 0 the latter letter O. Its difficult to be sure from the posts. ethO would be ignored ...

----------

## adam_aus

NeddySeagoon,

 *NeddySeagoon wrote:*   

> This issue only involves two files. /etc/init.d/net.lo  which is the script pointed to by net.eth0 and /etc/conf.d/net which holds the config information. Please post both files and I'll see if I can recreate the problem here.

 

The /etc/conf.d/net file is exactly this (and yes, I'm using a zero and not the letter 'O'):

```
config_eth0=( "192.168.0.100 netmask 255.255.255.0 broadcast 192.168.0.255" )

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

As you know, I've tried many variations of the above.

As you can see from the ls below, I think net.lo is a bit too large to post here in plaintext!   :Wink: 

```
root:/etc/init.d> ls -l net.lo

-rwxr-xr-x  1 root root 24323 Sep 29 23:00 net.lo
```

Does the forum support the attachment of files at all? If not, I'm happy to send the file to you by some other means; however, I haven't modified the file at all from the latest version of baselayout I emerged. I am surprised that it doesn't appear to be CVSd - there is no CVS header in the file, just a $Header$ on line 4, so no version number.

Cheers! Adam

----------

## NeddySeagoon

adam_aus,

PM the file to me please.

I want the exact file you are using so I can exaclty reproduce your issue. 

If something nasty happened to the script you have, it won't fail if I get a good copy from elsewhere.

I will also do a differ on it with my copy - so I can tell if its identical.

----------

## adam_aus

 *NeddySeagoon wrote:*   

> I want the exact file you are using so I can exaclty reproduce your issue. 
> 
> If something nasty happened to the script you have, it won't fail if I get a good copy from elsewhere.
> 
> I will also do a differ on it with my copy - so I can tell if its identical.

 

Good point. I've PM'd the files to you. I hope you can reproduce the problem!

Cheers, Adam

----------

## NeddySeagoon

adam_aus,

I've converted your net setting to eth1, since I have a spare ethernet port and changed the IP subnet so it won;t conflict with my settings. Then I installed your script as /etc/init.d/net.eth1, so everything was consistant.

When I did 

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

it reproduced your symptions exactly.

Running 

```
diff net.eth1 net.lo
```

to compare our scripts giver more differences than you can shake a stick at.

Our combined net file is

```
config_eth0=(

       "192.168.100.18/24 broadcast 192.168.100.255"

)

routes_eth0=(

       "default via 192.168.100.1"

       "-net 192.168.0.0/24 via 192.168.100.6"

)

config_eth1=( "192.168.101.100 netmask 255.255.255.0 broadcast 192.168.101.255" )

routes_eth1=( "default via 192.168.101.1" )
```

Save your net.lo file as say net.lo.broken and put my net.lo file in its place. You can get that at http://62.3.120.141/linux_stuff where its called net.lo NOT net.eth0  It has todays date too.

----------

## adam_aus

NeddySeagoon,

 *NeddySeagoon wrote:*   

> When I did 
> 
> ```
> /etc/init.d/net.eth1 start
> ```
> ...

 

Thanks very much for that. I tried your file, but I get the following error when running /etc/init.d/net.eth0 start:

```
 *   Loading networking modules for eth0

/etc/init.d/net.eth0: line 453: function_wrap: command not found

/etc/init.d/net.eth0: line 453: function_wrap: command not found

/etc/init.d/net.eth0: line 453: function_wrap: command not found

/etc/init.d/net.eth0: line 453: function_wrap: command not found

/etc/init.d/net.eth0: line 453: function_wrap: command not found

 *     modules: iptunnel ifconfig dhcpcd apipa

 *       iptunnel: missing required function interface_exists
```

...and eth0 fails to start. This topic suggested I re-emerge baselayout to correct the function_wrap problem, but I did that recently, and I doubt it'd work because your net.lo is different to the one in the current version of baselayout I've previously emerged.

Perhaps I should roll back to an older version of baselayout, with an unbroken net.lo?

Cheers! Adam

----------

## jamapii

I have this strange idea, the settings in /etc/conf.d/net can be overridden by /etc/conf.d/rc or /etc/rc.conf (I don't know), it would be very unusual to have network settings there, but maybe possible.

net.eth0 is overridden by net, but if your runlevel is called eth0, net.eth0 would be used in place of net.

There's also /etc/conf.d/wireless.

Summary: make sure you don't have any of /etc/conf.d/net.* /etc/conf.d/wireless, and /etc/rc.conf has no network settings that shouldn't be there. You can leave *.example there if your runlevel is not called example  :Wink: 

If an alien init.d/net.lo causes so much trouble, compare the baselayout version numbers.

----------

## NeddySeagoon

adam_aus,

Please post your 

```
emerge --info
```

----------

## adam_aus

Hi NeddySeagoon,

 *NeddySeagoon wrote:*   

> Please post your 
> 
> ```
> emerge --info
> ```
> ...

 

The output is:

```
root:~> emerge --info

Portage 2.0.51.22-r2 (default-linux/x86/2005.1, gcc-3.3.5-20050130, glibc-2.3.4.20041102-r1, 2.6.12-gentoo-r10 i686)

=================================================================

System uname: 2.6.12-gentoo-r10 i686 Pentium II (Deschutes)

Gentoo Base System version 1.6.13

dev-lang/python:     2.3.5

sys-apps/sandbox:    1.2.11

sys-devel/autoconf:  2.13, 2.59-r6

sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.5

sys-devel/binutils:  2.15.92.0.2-r10

sys-devel/libtool:   1.5.18-r1

virtual/os-headers:  2.6.11-r2

ACCEPT_KEYWORDS="x86"

AUTOCLEAN="yes"

CBUILD="i386-pc-linux-gnu"

CFLAGS="-mcpu=pentium2 -O2 -pipe -fomit-frame-pointer"

CHOST="i386-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/qmail/control"

CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"

CXXFLAGS="-O2 -mcpu=i686 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="autoconfig distlocks sandbox sfperms strict"

GENTOO_MIRRORS="ftp://mirror.internode.on.net/pub/gentoo http://planetmirror.com/pub/gentoo http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"

MAKEOPTS="-j2"

PKGDIR="/usr/portage/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

SYNC="rsync://rsync.au.gentoo.org/gentoo-portage"

USE="alsa apache apm arts avi berkdb bitmap-fonts crypt cups eds emboss encode foomaticdb fortran gdbm gif gpm gstreamer gtk gtk2 imlib ipv6 jpeg libg++ libwww mad mikmod mmx motif mp3 mpeg ncurses nls ogg oggvorbis opengl oss pam pdflib perl png postgres python qt quicktime readline samba sdl spell ssl tcpd truetype truetype-fonts type1-fonts vhosts vorbis x86 xml2 xmms xv zlib userland_GNU kernel_linux elibc_glibc"

Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTDIR_OVERLAY
```

Cheers, Adam

----------

## NeddySeagoon

adam_aus,

We should both have baselayout-1.12.0_pre8-r2 provided you have a recent emerge sync.

```
spike NeddySeagoon # emerge baselayout -p

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

Calculating dependencies ...done!

[ebuild   R   ] sys-apps/baselayout-1.12.0_pre8-r2

spike NeddySeagoon # ACCEPT_KEYWORDS="x86" emerge baselayout -p

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

Calculating dependencies ...done!

[ebuild   R   ] sys-apps/baselayout-1.12.0_pre8-r2

```

My system is ~86, hence the two runs.

Running 

```
equery belongs net.lo

Searching for file 'net.lo' in *...

sys-apps/baselayout-1.12.0_pre8-r2 (/etc/init.d/net.lo)
```

Putting all that together suggests that if yo hav some other baselayout, you need to 

```
emerge sync

emerge baselayout 
```

then carefully do 

```
etc-upate
```

 because the net.lo file you have is not current.

----------

## adam_aus

NeddySeagoon,

 *NeddySeagoon wrote:*   

> We should both have baselayout-1.12.0_pre8-r2 provided you have a recent emerge sync.

 

baselayout-1.11.13-r1 is the current stable x86 release. However, I ran:

```
ACCEPT_KEYWORDS="~x86" emerge baselayout
```

...to emerge the latest testing release, 1.12.0_pre8-r2. I needed to merge a few config files (which I always do manually by diffing first to ensure they're okay to replace), including /etc/conf.d/rc and /etc/services, but nothing related to net.lo (other than net.example in /etc/conf.d/).

The copy of net.lo I've now got installed is exactly the same as the copy you sent me - no output from diff.

I then ran the usual /etc/init.d/net.eth0 restart, with the same, usual output... no configuration for eth0.  :Sad: 

Cheers, Adam

----------

