# can't connect to the network. dhcpcd say it got a ip.

## wj6202

dhcpcd says that I got 192.168.1.5/24 at boot, but the eth0 did not get a IPv4 address.  

And I can't use the network, any body knows what's happening?

----------

## eccerr0r

Are you using networkmanager and conf.d/net at the same time?

Do you have more than one ethernet card and have the other card configured strangely?

----------

## Fitzcarraldo

If your answers to both eccerr0r's questions are "no", but you are using NetworkManager, I had a similar problem today for wireless (but not wired) networking with x86 Stable, and it turned out that NetworkManager built with USE="dhcpcd -dhclient" could not obtain an IP4 address whereas NetworkManager built with USE="dhclient -dhcpcd" could. This only happened to me for wireless, mind you, not wired, but it might be worth trying if you have exhausted all other possibilities.

----------

## wj6202

thanks for your reply, I still not yet install any window system so no network manager,and only one ethX.

just a base system installed.

with same configuration, under an other network same using dhcp, it worked and can get a ip address. 

I can get a network use a ubuntu-liveusb boot up.

so this is really a strange problem.

----------

## wj6202

#/etc/init.d/net.eth0 start

 * Bringing up interface eth0

 *   dhcp ...

 *     Running dhcpcd ...

dhcpcd[4255]: version 5.2.12 starting

dhcpcd[4255]: eth0: waiting for carrier

dhcpcd[4255]: eth0: carrier acquired

dhcpcd[4255]: eth0: rebinding lease of 192.168.1.3

dhcpcd[4255]: eth0: acknowledged 192.168.1.3 from 192.168.1.1 `�'

dhcpcd[4255]: eth0: checking for 192.168.1.3

dhcpcd[4255]: eth0: leased 192.168.1.3 for 7200 seconds

dhcpcd[4271]: eth0: eth0: MTU set to 576

dhcpcd[4255]: forked to background, child pid 4287                                                                                             [ ok ]

 *     received address 192.168.1.3/24

----------

## Arkhelion

And after that "net.eth0 star"t, what's ifconfig output?

----------

## wj6202

# ifconfig -a

eth0      Link encap:Ethernet  HWaddr b4:99:ba:e6:0a:ab  

          inet6 addr: fe80::b699:baff:fee6:aab/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:27 errors:0 dropped:0 overruns:0 frame:0

          TX packets:98 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:8618 (8.4 KiB)  TX bytes:11230 (10.9 KiB)

          Interrupt:20 Memory:d7400000-d7420000 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:172 errors:0 dropped:0 overruns:0 frame:0

          TX packets:172 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:12944 (12.6 KiB)  TX bytes:12944 (12.6 KiB)

sit0      Link encap:IPv6-in-IPv4  

          NOARP  MTU:1480  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

----------

## wj6202

after searching on the internet, I got a temp. solution. and as follows.

#dhcpcd -S ip_address=192.168.1.3/24 -S routers=192.168.1.1 -S domain_name_servers=8.8.8.8 eth0

then I can get a network, and finally can use my browser to reply this thread.

but why not dhcpcd set the ip automatically?

----------

## eccerr0r

Just throwing out off the wall guesses: do you happen to have -T somewhere in the dhcpcd config?

I'm not sure where this could have been set either but this would make it look like it got the address but never set...

----------

## wj6202

 *eccerr0r wrote:*   

> Just throwing out off the wall guesses: do you happen to have -T somewhere in the dhcpcd config?
> 
> I'm not sure where this could have been set either but this would make it look like it got the address but never set...

 

with an other network, It can get proper IP automatically, so it makes me confused.

----------

## BillWho

wj6202,

What's the contents of /etc/conf.d/net   :Question:  and /etc/dhcpcd.conf   :Question: 

Is it possible you have config_eth0="" in /etc/conf.d/net    :Question: 

Just a guess for lack of any brilliant ideas   :Sad: 

----------

## wj6202

 *BillWho wrote:*   

> wj6202,
> 
> What's the contents of /etc/conf.d/net   and /etc/dhcpcd.conf  
> 
> Is it possible you have config_eth0="" in /etc/conf.d/net   
> ...

 

Dear BillWho, bellow is the content of those files:

$cat /etc/conf.d/net

# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /usr/share/doc/openrc*/net.example* and save your configuration

# in /etc/conf.d/net (this file :]!).

config_eth0="dhcp"

$ cat /etc/dhcpcd.conf 

# A sample configuration for dhcpcd.

# See dhcpcd.conf(5) for details.

# Inform the DHCP server of our hostname for DDNS.

hostname

# To share the DHCP lease across OSX and Windows a ClientID is needed.

# Enabling this may get a different lease than the kernel DHCP client.

# Some upstream DHCP servers may also require a ClientID, such as FRITZ!Box.

#clientid

# A list of options to request from the DHCP server.

option domain_name_servers, domain_name, domain_search, host_name

option classless_static_routes

# Most distributions have NTP support.

option ntp_servers

# Respect the network MTU.

option interface_mtu

# A ServerID is required by RFC2131.

require dhcp_server_identifier

# A hook script is provided to lookup the hostname if not set by the DHCP

# server, but it should not be run by default.

nohook lookup-hostname

----------

## BillWho

wj6202,

Everything looks good with the files. I have no answer   :Sad:   except that your workaround of:

```
dhcpcd -S ip_address=192.168.1.3/24 -S routers=192.168.1.1 -S domain_name_servers=8.8.8.8 eth0 
```

can be implemented in /etc/conf.d/net if you want to do that. All it means is you'll assign a static IP instead of leasing one.

If you decide to go this route then remove or comment config_eth0="dhcp" and enter this in your /etc/conf.d/net file:

```
config_eth0="192.168.1.3/24 brd 192.168.1.255"

routes_eth0="default via 192.168.1.1"

dns_servers_eth0="8.8.8.8 8.8.4.4"

```

This is the only suggestion I have to eliminate having to start the network post boot   :Confused: 

Hopefully, someone much smarter than me can help you figure this out   :Smile: 

----------

## publiosulpicio

I think I have the same problem, see https://forums.gentoo.org/viewtopic-p-7012220.html#7012220

----------

