# Sometimes-connected laptop

## Guest

Hi

Using Gentoo, love it. Have it installed on a laptop, which is sometimes connected to a network but other times (hotel rooms, airports) it isn't. When it IS connected to a network it gets a DHCP address, and that works fine. When is ISN'T connected, eth0 times out trying to get a DHCP address (of course), but then eth0 fails to start, which means squid, postifx, mysql, etc etc don't start.

The only workaround I have found so far is to assign a static address to the Ethernet port, but that means I have to re-edit files when I want a DHCP address.

What I actually want to do is try to get a DCHP address, and if successful carry on. If not successful, then assign a static address and carry on, so that services dependent upon a network are able to start.

Thanks for any help

Andy

----------

## mb

hi...

i have exactly the same problem... my solution (or better work-around) is to assign a static ip and call dhcp if needed...

the other way around is of course the best solution, but requires some scripting....  => maybe we should bring this up in gentoo suggestions..

#mb

----------

## DataShark

emerge quickswitch, read the docs and be happy   :Very Happy: 

----------

## fghellar

I'd suggest you simply do

```
rc-update del net.eth0 default
```

and then manually run

```
/etc/inid.d/net.eth0 start|stop
```

when needed.

----------

