# dhcpcd and domain issue

## sted

hey

i'm using dhcp on my home network to assign dynamic ip addresses to computers. i also use my laptop at school, where network is also using dhcp.

both dhcp servers are assigning a domain to their clients.

i'd like my gentoo laptop to always welcome me with:

```
This is (myhostname).(current_domain) (Linux ... ) date
```

i configured my /etc/conf.d/net like this:

```
dhcpcd_eth0="-D -N -h ${HOSTNAME}"

config_eth0=( "dhcp" )
```

/etc/conf.d/domainname (added to default runlevel):

```
OVERRIDE=0
```

/etc/conf.d/hostname:

```
HOSTNAME="lap"
```

/etc/hosts:

```
127.0.0.1 localhost lap
```

/etc/resolv.conf is generated by dhcpcd (nameservers, and domain statements).

with all set like this my prompt is:

```
This is lap.(none) (Linux ...) .. 
```

but when i login and type "domainname" i get reply with proper domain (set by my home DHCP server).

what is wrong?

----------

## wally.hall

Where's the welcome message? KDM's greeting or a terminal or what?

It might just be that a .profile is wrong somewhere.  Post back and I'll have a look.

----------

## acfreeman

Hi all,

I would need a similar issue, but I'd need the hostname from DHCP server.

This is my /etc/conf.d/net file

```
dhcpcd_eth0="-HD -t 3" 

config_eth0=( "dhcp" )
```

At this settings, my greeting message is:

```
This is myhostname.mydomain.org.unknown_domain Linux ...  (date)
```

Thanks a lot for any assistance.  :Wink: 

acfreeman

PS: wally.hall: The output in sted`s reply is generated by agetty. (console login)

----------

## sted

yes, agetty.

i also found another strange behaviour of my freshly installed 2005.1

when i type wrong login/pass and the prompt is repeated i get sth like:

```
This is \n.\O (\s \m \r) \t

login:
```

on my old 2004.2 only the "login:" prompt was repeated.

what's up with that?

----------

## geraldr70

Hello Sted,

I think, I had a similar problem.

I think, you have

```
This is lap.(none) (Linux ...) .. 
```

 on a terminal login-session.

My solution is for a nice appearence:

```
OVERRIDE=1

#DNSDOMAIN=""
```

and in /etc/nsswitch.conf:

```
hosts:       dns files

networks:    dns files

```

dns and files in this order.

At last, I start the hostname script at boot to get my right hostname.

----------

## sted

thanks for reply, geraldr70.

but your solution doesn't help in my case, i don't know why.

i changed all confs as you stated, and now i get:

```
This is lap.unknown_domain (Linux ...) ..
```

and still the domainname command shows what DHCP server sent me and what i would like to see at login prompt..

----------

## UberLord

Whack it into /etc/hosts like so

```
127.0.0.1     uberlaptop.ubernet uberlaptop localhost
```

----------

## sted

 *UberLord wrote:*   

> Whack it into /etc/hosts like so
> 
> ```
> 127.0.0.1     uberlaptop.ubernet uberlaptop localhost
> ```
> ...

 

if i do that my prompt looks like this (despite the domainname sent by my DHCP server):

```
This is lap.ubernet (Linux ...) ..
```

and i want it to change dynamically to always show the actual domain (like the domainname command does) sent by dhcp server.

----------

## braindead0

I found a couple of interesting things.  The /etc/issue file (default) has \n.\O which is hostname.DNS domainname

Problem is, if you check man dnsdomainname, you'll find that it returns the domain name portion from calling hostname --fqdn.  At least on my system that returns 'unknown_domain' unless I put a FQDN in /etc/conf.d/hostname which would then cause the issue to spit out fqdn.domainname (not what we want I think).

My fix for the eyesore was simply to change \n.\O in /etc/issue to \n.\o

I think there's some confusion among these programs about what hostname is vs. FQDN..  or something.

----------

