# Having trouble connecting to network with OpenRC 0.5.2-r2

## Kingoftherings

My machine is running ~amd64 with openrc-0.5.2-r2, and I've been having trouble connecting to the internet at bootup.

Here is my /etc/conf.d/net

```

config_eth0=( "192.168.1.186 netmask 255.255.255.0" )

routes_eth0=( "default via 192.168.1.254" )

```

And I have net.eth0 set to the default runlevel.

But when I boot up, I can't connect to the internet, so I run dhcpcd on eth0 and this is my output:

```

dhcpcd: version 5.1.3 starting

dhcpcd: eth0: rebinding lease of 192.168.1.91

dhcpcd: eth0: acknowledged 192.168.1.91 from 192.168.1.254

dhcpcd: eth0: checking for 192.168.1.91

dhcpcd: eth0: leased 192.168.1.91 for 86400 seconds

dhcpcd: forking to background

```

And then everything works.  But one strange thing that happens is that I can connect to this machine through SSH with the IP 192.168.1.186 (/etc/conf.d/net setting) and 192.168.1.91 (dhcpcd)

I don't know how it's possible to have two IP addresses.    :Laughing: 

So does anyone know how I can get net.eth0 to work on boot, so I don't have to constantly run dhcpcd by hand?  I'd prefer a static address rather than dhcp, but I have noticed that dhcpcd has been giving me the same IP for a long time.

Actually, does the static address really matter?  I really only use it for SSH, but on my laptop I don't have this machine in my /etc/hosts file and I can connect by using the hostname and it figures out the IP.  So maybe I could settle for dhcp.

----------

## soth

Openrc demands no bash type parens, so your conf should look like

```

config_eth0="192.168.1.186 netmask 255.255.255.0"

routes_eth0="default via 192.168.1.254

```

Code listing 2.11:

http://www.gentoo.org/doc/en/openrc-migration.xml

----------

## Kingoftherings

 *soth wrote:*   

> Openrc demands no bash type parens, so your conf should look like
> 
> ```
> 
> config_eth0="192.168.1.186 netmask 255.255.255.0"
> ...

 

I think I tried that, but I don't think it worked.  I'll try it again.

It's kind of confusing because initially it had to use /etc/conf.d/network, and then the whole oldnet thing came in.

----------

## Kingoftherings

Nope, that didn't solve it.

This is the output of ifconfig before running dhcpcd:

```

eth0      Link encap:Ethernet  HWaddr 00:24:1d:dd:a9:d1

          inet addr:192.168.1.186  Bcast:192.168.1.255  Mask:255.255.255.0

          inet6 addr: fe80::224:1dff:fedd:a9d1/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000

          RX bytes:14100 (13.7 KiB)  TX bytes:510 (510.0 B)

          Interrupt:27 Base address:0x8000

```

And this is after:

```

eth0      Link encap:Ethernet  HWaddr 00:24:1d:dd:a9:d1

          inet addr:192.168.1.186  Bcast:192.168.1.255  Mask:255.255.255.0

          inet6 addr: fe80::224:1dff:fedd:a9d1/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000

          RX bytes:16667 (16.2 KiB)  TX bytes:1062 (1.0 KiB)

          Interrupt:27 Base address:0x8000

```

As you can see, the IP is still the same even though dhcpcd gave me .91

----------

## soth

You changed 

```
/etc/conf.d/net
```

 right?

Does your 

```
/etc/init.d/net.eth0
```

 point to 

```
/etc/init.d/net.lo
```

 ?

What's the output of 

```
/etc/init.d/net.eth0 restart
```

----------

## Kingoftherings

 *soth wrote:*   

> You changed 
> 
> ```
> /etc/conf.d/net
> ```
> ...

 

Right.

```
Does your [code]/etc/init.d/net.eth0[/code] point to [code]/etc/init.d/net.lo[/code] ?
```

Yep

```

casey@gentoobox /etc/init.d $ ls -l | grep net

lrwxrwxrwx  1 root root     6 Oct 22 03:43 net.eth0 -> net.lo

```

 *Quote:*   

> What's the output of 
> 
> ```
> /etc/init.d/net.eth0 restart
> ```
> ...

 

```

gentoobox init.d # /etc/init.d/net.eth0 restart

* Stopping sshd...                                                                  [ ok ]

* Unmounting network filesystems...                                                 [ ok ]

* Bringing down interface eth0

*   Stopping dhcpcd on eth0...                                                      [ ok ]

*   Removing addresses

*     192.168.1.186/24

* Bringing up interface eth0

*   192.168.1.186...                                                                [ ok ]

*   Adding routes

*     default via 192.168.1.254...                                                  [ ok ]

* Starting sshd...

* Mounting network filesystems...                                                   [ ok ]

```

Doing that takes down dhcpcd, so I was back to not being able to access the network until I ran dhcpcd again.

----------

## potatoface

i can confirm that openrc 0.5.2-r1 works fine but 0.5.2-r2 doesnt.

after emerging 0.5.2-r2 no nameservers could be found.

i will try again tomorrow because its too late today.

[EDIT]

i am not sure if it is openrc's fault, maybe there are problems with my isp's nameservers...   :Rolling Eyes: 

[/EDIT]

regards,

potatoface

----------

## Kingoftherings

Since you mentioned that, I went back and tested -r1 again, and it's it's not working either.

----------

## potatoface

you have to use dispatch-conf after the downgrade and look carefully at the changes in the config files of course.

regards,

potatoface

----------

## Kingoftherings

I used etc-update, but it's basically the same thing.

----------

## soth

Hm. That looks like you don't have a static configuration. Either your  *Quote:*   

> /etc/conf.d/net

  has

```
config_eth0="dhcp"
```

or there is not entry at all for eth0?

Btw, for accessing your machine remotely when using you can do something like the following: 

* get a dyndns account

* install ddclient

* add a dyndns nameserver in your  *Quote:*   

> /etc/resolv.conf

 

Only reason I can think of where there's a must with static IP is when you are running named   :Cool: 

----------

## Kingoftherings

 *soth wrote:*   

> 
> 
> Btw, for accessing your machine remotely when using you can do something like the following: 
> 
> * get a dyndns account
> ...

 

Since you mentioned resolv.conf I looked at mine and found that it was being auto-generated by dhcpcd.  So when I was booting up, resolv.conf was empty, and dhcpcd would put the correct stuff in it.  But rebooting made that go away.  So I put the correct stuff in resolv.conf and it all works now.

Thanks.    :Cool: 

----------

