Bridge works after cable unplugged & plugged back in

Issues related to configuring your network
Post Reply
MrChimp
Posts: 5
Joined: 2015/12/30 17:45:55

Bridge works after cable unplugged & plugged back in

Post by MrChimp » 2015/12/30 18:11:53

Hi, I have set up my CentOS7 install with a network bridge as per instructions here https://access.redhat.com/documentation ... ork_Bridge and it works great until I reboot and then the network doesn't work and is unavailable.

My bridge interface br0 config is

Code: Select all

DEVICE=br0
TYPE=Bridge
IPADDR=192.168.1.1
PREFIX=24
BOOTPROTO=none
ONBOOT=yes
DELAY=0
My network interface (enp0s25) config is:

Code: Select all

DEVICE=ethX
TYPE=Ethernet
HWADDR=d0:50:**:**:**:**
BOOTPROTO=none
ONBOOT=yes
BRIDGE=br0
Physically unplugging and plugging the cable back in causes it to start working however this is not a real solution.

Here is my messages log http://pastebin.centos.org/37546/, it contains everything from a reboot right up to the point where I unplugged the cable and plugged it back in again.

Here is the response of the getinfo.sh network command http://pastebin.centos.org/37551/ I ran this after I had re-plugged the cable and the network was working again
Here is the getinfo.sh network response before I unpluged the cable and things did NOT work http://pastebin.centos.org/37556/

I wandered if something hasn't fully loaded during boot which causes the enp0s25 interface to fail but I wouldn't know what it could be. Any help greatly appreciated, thanks

tuxman47203
Posts: 7
Joined: 2015/05/03 16:57:41

Re: Bridge works after cable unplugged & plugged back in

Post by tuxman47203 » 2015/12/30 18:49:55

I have had this same problem in the past. I never did find a solution. I know that their is a new method of joining cards called teaming.
Perhaps give that a try. Sorry I couldent be of more help.

MrChimp
Posts: 5
Joined: 2015/12/30 17:45:55

Re: Bridge works after cable unplugged & plugged back in

Post by MrChimp » 2015/12/31 08:55:58

Thanks for the response I don't think teaming will work in my case as I understand it. Sorry should have mentioned this in my original post but I am setting up a bridge so that I can use it with some virtual machines (CentOS 7 is the host). I am using an on board network card at the moment but I am going to try using a spare PCI network card to see if that makes a difference.

MrChimp
Posts: 5
Joined: 2015/12/30 17:45:55

Re: Bridge works after cable unplugged & plugged back in

Post by MrChimp » 2016/01/02 13:47:11

Recently I had some more issues with the network dropping out during file copying (rsync, scp, cp over ssh) and so I tested the memory with MemTest and found that the memory does have errors. As this is a new computer build I am going to get some replacement memory and will see if this issue still occurs or if it was the dodgy memory causing the problem. I will update the post when I know more.

MrChimp
Posts: 5
Joined: 2015/12/30 17:45:55

Re: Bridge works after cable unplugged & plugged back in

Post by MrChimp » 2016/01/28 20:33:02

So after what seems like an age I get to play around with this bridge again, I got new memory in the computer and re-installed CentOS 7 but still no joy and am getting the same problem and messages again. The computer is plugged into a switch if that changes anything and I did see somewhere on the net about trying with STP=no as a config option but that didn't achieve anything. I have no idea where to start trying to debug this so any help will be greatly appreciated. Thanks

MrChimp
Posts: 5
Joined: 2015/12/30 17:45:55

Re: Bridge works after cable unplugged & plugged back in

Post by MrChimp » 2016/01/30 08:50:31

After playing with this for a bit I have a working workaround, not ideal but it does work. Basically after playing about with what commands I could run once booted I could get it to work without physically removing the cable by bringing the main interface down and then up again worked a treat. After I did this I would get the message

Code: Select all

br0: port(enp0s25) entered forwarding state
and then everything would be working correctly.

I have created a bash script that quite simply brings the interface down, waits a few seconds then brings it back up again. I then created a systemd service and timer to run this script 45 seconds after the system boots. I needed to use a timer to delay the execution of the script otherwise it wouldn't take affect. I picked 45 seconds as it seemed good on my system, I reckon I could easily go to 25 but it would require testing. About 15 seconds after boot the network card comes up automatically and I want this to have completed before my script is run.

Below is my script, something I did find but never really looked into is that the ifup and ifdown commands are now deprecated in favour of ip based commands which would be something to keep in mind

Code: Select all

#!/bin/bash
ifdown enp0s25
sleep 3
ifup enp0s25
Here is my Service, an important thing in here is the minus (-) before the bash path in ExecStart, basically it tells systemd to ignore any returned fail state and to think it succeeded, without it systemd thinks the service fails.

Code: Select all

[Unit]
Description=Actually enable the Network Interfaces
Wants=network-online.target
After=network-online.target

[Service]
Type=oneshot
User=root
ExecStart=-/bin/bash /media/data1/MyScripts/network.sh

[Install]
WantedBy=multi-user.target
And here is my timer

Code: Select all

                              
[Unit]
Description=Runs the script on boot

[Timer]
#Time to wait after boot before activating
OnBootSec=45
Unit=internet.service

[Install]
WantedBy=multi-user.target
Obviously I would rather I could actually solve the problem, looking at the messages I get it seems that it is related to the main network interface not forwarding correctly to the bridge but I don't know where to start when solving this. I hope someone else finds this useful.

poky
Posts: 108
Joined: 2013/03/27 12:18:03

Re: Bridge works after cable unplugged & plugged back in

Post by poky » 2016/01/30 14:18:07

DELAY=2
NM_CONTROLLED="no"
# Yes, I know, static is old
BOOTPROTO="static"

Post Reply