# starting eth0 in 10mbit mode, but how?

## Poedel

hellasn,

I got an internal network adapt0r on my motherboard (intel). It works fine and is recognized by gent00.

I use dhcp to get IP from my Router (SMC). Though it is able to use 100/10 mbit, it does only work correctly and really fast in 10mbit mode.

I don know why my network earliers was faster, but now it does only work fast, when I start it manually by doing this:

kill the dhcp pid file in /var/run

ifconfig eth0 down # eth0 abschalten

ethtool -s eth0 speed 10 autoneg off # switch to 10mbit mode .. ifconfig eth0 media 10baseT does not work for this device  :Sad: 

dhcpcd eth0

now it works and is really fast in internet!

okay, my first Idea was to use ethtool  in /etc/init.d/net.eth0

where the start command lies like "start()" I put it into the brackets. This did not work. Unfortunately he does not use it, or on another position he tells that it does not work by boot  :Sad: 

The next idea was to build an initscript myself. I tried to set eth0 to 10mbit before net.eth0 was launched.

BUT in net.eth0 eth0 primary is configured. Thus he was not able to find eth0 in my script before  :Sad: 

Who knows a solution for me starting my eth0 in 10mbit mode with dhcp??

----------

## sp7xfq

Hi,

I think that it is possible by defining function called `preup` in your /etc/conf.d/net file.  Something like this

```

#/etc/conf.d/net

#common config

config_eth0=( "dhcp" )

#adv functions

preup() {

  if [ ${IFACE} == 'eth0' ] ; then

    einfo "switch to 10mbit mode ..."

    ethtool -s eth0 speed 10 autoneg off

  fi  

  return 0

}

```

More about this you can find in /etc/conf.d/net.example file.

br.

----------

## Poedel

this leads to the following output at startup:

```
 * Starting lo

 *   Bringing up lo ...                                                                                                                                                                           

[ ok ]Cannot set new settings: Invalid argument

  not setting speed

  not setting autoneg

 * Initializing random number generator ...                                                                                                                                                       

[ ok ]INIT: Entering runlevel: 3                                                                                                                                                                        

[ ok ] * Starting syslog-ng ...                                                                                                                                                                         

[ ok ] * Starting eth0

 *   Running preup function

 *     switch to 10mbit mode ...

Cannot set new settings: Invalid argument

  not setting speed

  not setting autoneg

 *   Bringing up eth0

 *     dhcp

 *       Running dhcpcd ...                                                                                                                                                                       

[ ok ] *       eth0 received address 192.168.123.163

```

but it does not work ..

& like you see, even lo is beeing tried to ethtooled

another Idea?

----------

## sp7xfq

It's a bit weird, this is my network config:

```

config_eth0=( "192.168.1.2 netmask 255.255.255.0" )

routes_eth0=( "default gw 192.168.1.1" )

preup() {

   if [ ${IFACE} == 'eth0' ] ; then

     echo "switch to 10mbit mode ..."

     /sbin/mii-tool --force=10baseT-FD eth0

   fi

   return 0

}

```

and when my system starting i can see:

```

* Service net.eth0 starting

switch to 10mbit mode ...

 * Service net.eth0 started

```

and then

```

#mii-tool

eth0: 10 Mbit, full duplex, link ok

```

It seems that in my box this working, coz my autonegotiated speed is different:

```

#mii-tool -r

restarting autonegotiation...

# mii-tool

eth0: negotiated 100baseTx-HD, link ok

```

Unfortunately I haven't at the momnet emerged ethtool, maybe command `ethtool -s eth0 speed 10 autoneg off` is wrong?

----------

## Poedel

but whenn it works at you with MII-Tool, why doesn't it with me!?

look what he tells me on boot:

 *Quote:*   

>  *   Bringing up lo ...                                                                                                                                                                           
> 
> [ ok ]Cannot set new settings: Invalid argument
> 
>   not setting speed
> ...

 

----------

## Poedel

but whenn it works at you with MII-Tool, why doesn't it with me!?

look what he tells me on boot:

```

bringing up lo ...                                                                                                                                                                           

[ ok ]Cannot set new settings: Invalid argument

  not setting speed

  not setting autoneg

 * Initializing random number generator ...                                                                                                                                                       

[ ok ]INIT: Entering runlevel: 3                                                                                                                                                                        

[ ok ] * Starting syslog-ng ...                                                                                                                                                                         

[ ok ] * Starting eth0

 *   Running preup function

switch to 10mbit mode ...

SIOCGMIIPHY on 'eth0' failed: No such device

 *   Bringing up eth0

 *     dhcp

 *       Running dhcpcd ...                                                                                                                                                                       

[ ok ] *       eth0 received address 192.168.123.163

```

again it tries to get it run with lo too

again it even does not work on eth0

Why does he tell me, that it does not exist!?

On your gentoo it does work.

I don't understand that   :Evil or Very Mad:  [/code][/quote]

----------

## Poedel

uoah

looking at /usr/src/linux/Documentation/network/vortex.txt I found out something about starting in 10mbit mode.

But it still doesn't.

And after emerge -uND world it does even not tell anymore about bringing up eth0, though it is and even dhcpcd'ed, but still

in 100mbit and with murder loss

 * Starting lo

 *   Running preup function                                                                                                                                                                       

[ ok ] *   Bringing up lo

 *     127.0.0.1/8                                                                                                                                                                                

[ ok ] *   Adding routes

 *     127.0.0.0/8 ...                                                                                                                                                                            

[ ok ] * Initializing random number generator ...                                                                                                                                                       

[ ok ]INIT: Entering runlevel: 3                                                                                                                                                                        

[ ok ] * Starting syslog-ng ...                                                                                                                                                                         

[ ok ] * Starting cupsd ...                                                                                                                                                                             

[ ok ] * Starting gpm ...                                                                                                                                                                               

[ ok ] * ERROR:  cannot start netmount as net.eth0 could not start

 * Enabling numlock on ttys ...                                                                                                                                                                   

[ ok ] * Starting vixie-cron ...                                                                                                                                                                        

[ ok ] * Starting local ...

----------

## CrankyPenguin

So mii-tool and ethtool, theoretically do the same thing.  However I have some systems where mii-tool alone works and some where ethtool alone works.  It appears that the support is not isomorphic between the two.

----------

## coutts99

If you are fixing the speed, fix the speed on both ends of the link or you will likely run into trouble. This may be the problem you are having with it when it's at 100mb? Is the switch/router you are connecting to set to auto negotiate?

----------

