# [SOLVED] Network does not work after boot

## username63n

My setup is following:

Xen hypervisor with gentoo Dom0 and Windows hvm guest.

I tried to set up network bridge to share connection to windows host. However after reboot the situation is that both br0 and eth0 has the same ip address and network does not work. (cannot even ping inside my lan). However if /etc/init.d/net.br0 is manually run after the boot, everything is fine. First there was a problem when my primary/only network adapter kept changing its device name between reboots. Sometimes it was enp6s0 and sometimes enp7s0. I fixed this by setting

```
net.ifnames=0
```

 in xen.cfg (booting via efiboot without a separate bootloader).

There is links in default runlevel to net.eth0 and net.br0 but i tried also removing the former. That has no effect on anything. Here is my /etc/conf.d/net file

```

# Use dhcpcd and ifconfig as default tools

modules="dhcpcd ifconfig"

# Do not configure eth0 yet

config_eth0="null"

# Eth0 does not provide net service.

rc_net_eth0_provide="!net"

# Create bridge br0

bridge_br0="eth0"

# Use dhcp (defined in module section)

config_br0="dhcp"

mac_br0="1c:87:2c:5e:9d:a6"

# setup bridge asap

bridge_forward_delay_br0=0

bridge_hello_time_br0=1000

bridge_stp_state_br0=0

# Add dependency

rc_net_br0_need="net.eth0"

```

I also tried without the options in section  *Quote:*   

> setup bridge asap

  and without specifying the MAC address and without  *Quote:*   

> rc_net_eth0_provide="!net"

 

I tried different combinations of those options and i tried deleting eth0 from default runlevel. With some combinations the interfaces br0 and eth0 has different ip addresses after reboot (still did not even ping in local network).

However the situation should be that eth0 does not have ip at all and br0 does.

I used these references when configuring my network:

https://wiki.gentoo.org/wiki/Network_bridge

https://wiki.gentoo.org/wiki/Handbook:X86/Full/Networking#Bridging_.28802.1d_support.29

https://forums.gentoo.org/viewtopic-t-1066946-start-0.html

The first one tells to remove net.eth0 from boot runlevel. I dont have that but assume it is equivalent with sysinit runlevel. There is no any net.<if> links in that runlevel. It also tells to remove links in init.d/ which I dont understand because the bridge does not start without it. It also says that bridge-utils is deprecated and should not be used, but it is needed by xen-tools so I cant get rid of it. The first two of the references applies for bridging two networks rather than creating virtual one but I assume the same principles applies here as seen in the last reference.

ifconfig output when my bridge is working correctly (after manual start of net.br0) and windows hvm running:

```
br0: flags=4419<UP,BROADCAST,RUNNING,PROMISC,MULTICAST>  mtu 1500

        inet 192.168.1.114  netmask 255.255.255.0  broadcast 192.168.1.255

        inet6 fe80::ebd2:c288:b4f8:6051  prefixlen 64  scopeid 0x20<link>

        ether 1c:87:2c:5e:9d:a6  txqueuelen 1000  (Ethernet)

        RX packets 103442  bytes 85551392 (81.5 MiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 59348  bytes 3609579 (3.4 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet6 fe80::1e87:2cff:fe5e:9da6  prefixlen 64  scopeid 0x20<link>

        ether 1c:87:2c:5e:9d:a6  txqueuelen 1000  (Ethernet)

        RX packets 62398  bytes 81394931 (77.6 MiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 35729  bytes 3759610 (3.5 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10<host>

        loop  txqueuelen 1000  (Local Loopback)

        RX packets 66  bytes 4756 (4.6 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 66  bytes 4756 (4.6 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vif1.0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500

        ether fe:ff:ff:ff:ff:ff  txqueuelen 32  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vif1.0-emu: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 169.254.249.59  netmask 255.255.0.0  broadcast 169.254.255.255

        inet6 fe80::712e:8b91:bee6:499  prefixlen 64  scopeid 0x20<link>

        ether fe:ff:ff:ff:ff:ff  txqueuelen 1000  (Ethernet)

        RX packets 68824  bytes 7139681 (6.8 MiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 121115  bytes 84853912 (80.9 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

```

TL;DR:

I need to start net.br0 manually after reboot or the network does not work at all.

Any suggestions what could be wrong? Any help? Please ask if there is some further information needed. Thank you!Last edited by username63n on Mon Jan 21, 2019 4:14 pm; edited 1 time in total

----------

## bbgermany

Hi,

did you add the bridge and your eth0 to your default runlevel?

```

rc-update add net.br0 default

rc-update add net.eth0 default

```

greets, Stefan

----------

## username63n

 *bbgermany wrote:*   

> Hi,
> 
> did you add the bridge and your eth0 to your default runlevel?
> 
> ```
> ...

 

Yes i did.

 *Quote:*   

> 
> 
> There is links in default runlevel to net.eth0 and net.br0 but i tried also removing the former.
> 
> 

 

And indeed /etc/init.d/net.{eth0, br0} status reports "status: started" right after boot.

----------

## username63n

So I disabled dhcpcd from default runlevel and now it boots fine. I assume there was some kind of conflict in the way that bridge was first set up and then dhcpcd fetches ip addresses for all interfaces (including eth0) regardless of the chonfig_eth0="null" in /etc/conf.d/net

----------

