# TCP Connection in initscript on boot

## mastergnome

Hello everybody,

I am relatively new in gentoo and trying to establish an TCP connection to an LDAP Server on boot, using a script which is spawned from /etc/init.d/local. I've placed the path to the script in /etc/conf.d/local.start. But the sctipt can not use the network on boot. Passing the output from ifconfig in a file at this stage, it shows that the interfaces doesn't have an IP Address. After logging in at TTY the script works fine. So what do I have to do for using the networkinterfaces in the init-script?

Thanks ahead

MG

----------

## keyson

Hi,

This may help you.

http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=4#doc_chap4

You need to have

need net

in the depend section and all the other things it depend on to be running.

But I think this page sort it out for you.

----------

## mastergnome

hello keyson,

thanks for your reply. I've tried need net in depend-section, but then the init-script doesn't start at all. In this case I've added it directly using update-rc skript default. The main-code was placed is start() section, the depend-section included need net only. Perhaps there is a much greater problem, because after booting it shows that the hostname is localhost.unknown_domain on TTY. When logging in it shows the correct hostname (from DNS Server). But SSHD is reachable at this stage, so I thought the network must be ok to. Do you have an idea what this problem cames from?

Thanks agian

MG

----------

## keyson

OK.

You have to set hostname in

/etc/conf.d/hostname

Then add the domain in

/etc/hosts

Se the installation docs.

----------

## keyson

Sorry, I did not read properly.

You have to add some more in depend section.

To get a hang of it, you can look at the scripts in /etc/init.d/

Maybe

after dns

should do it.

----------

## cach0rr0

 *mastergnome wrote:*   

> 
> 
> Passing the output from ifconfig in a file at this stage, it shows that the interfaces doesn't have an IP Address.

 

 *mastergnome wrote:*   

> 
> 
> When logging in it shows the correct hostname (from DNS Server). But SSHD is reachable at this stage, so I thought the network must be ok to. 

 

Neither DNS nor SSHD will be reachable without an IP, so the network is definitely not fine  :Smile:  You are for some reason not getting an IP until you login, which begs the question - what does your /etc/conf.d/net look like, and what sort of tools are you using to connect to the network? (e.g. wicd)

Hell it could even be a timing issue. Just as a test, in your local script, add a "sleep 60" up at the top, and see if things are successful. Maybe you have tried to make the connection before you have gotten a dhcp response, but by the time you login dhcp is finished/successful.

----------

