Using Static ifcfg- files on Centos 7 for bridging

Issues related to configuring your network
Post Reply
stevef943
Posts: 2
Joined: 2014/08/11 18:51:31

Using Static ifcfg- files on Centos 7 for bridging

Post by stevef943 » 2014/08/11 19:32:41

Hi -

After Mucking around with Centos7, I finally got a fully Static Br0
Configuration working.

It Should not be this damn much of a problem, Bet here is what is working for me.

Do a "yum install NetworkManager-config-server" and verify that
/etc/NetworkManager/conf.d/
contains a file 00-server.conf
It forces NetworkManager to Mostly leave your configuration alone.

Now go to /etc/sysconfig/network-scripts/ -

I have created Two files
ifcfg-br0 -

Code: Select all

DEVICE=br0
NM_CONTROLLED="no"
TYPE=Bridge
IPADDR=192.168.101.4                           <<<< -----------------    Set the IP Stuff as needed.
NETMASK=255.255.255.0
GATEWAY=192.168.101.254
DNS1=192.168.101.5
DNS2=8.8.2.2
DOMAIN="localdomain"
BOOTPROTO=none
ONBOOT=yes
DELAY=0
ifcfg-enp3s0 - Remember that this name needs to match the name of you ethernet port - use ifconfig to look

Code: Select all

DEVICE=enp3s0
NM_CONTROLLED="no"
HWADDR=AC:AE:C5:DE:E4:1C   <<--- Replace with your Mac Addr
TYPE=Ethernet
BRIDGE=br0
BOOTPROTO=none
ONBOOT=yes
DELAY=10
Now I modified two files that existed -

ifcfg-lo -

Code: Select all

DEVICE=lo
nm_controlled="no"  <<<-----  Turnoff   !@(@(##    NetworkManager
IPADDR=127.0.0.1
NETMASK=255.0.0.0
NETWORK=127.0.0.0
# If you're having problems with gated making 127.0.0.0/8 a martian,
# you can change this to something else (255.255.255.255, for example)
BROADCAST=127.255.255.255
ONBOOT=yes
NAME="loopback
ifcfg-Auto_Ethernet - If it was created.

Code: Select all

NM_CONTROLLED="no"                   <<<<-----------------------  Turn off Network Mangler
HWADDR=AC:AE:C5:DE:E4:1C          <<<<----------------------   Should be you current Mac Addr
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME="Auto Ethernet"
UUID=f43f1bdc-c7a3-43ce-b56e-4b50ebfa0354
ONBOOT=no                     <<<<<<<<<<<<<<<<<<<----------------------------------- Don't let this device start.
Now if you reboot , You will have a working Static Bridge for KVM machines and such.


One Last Problem - NetworkManger says we are off line !! @!#$@!$#$#@$#@%$

After much Grumping, and googling, I did this -

cd to /etc/NetworkManager/conf.d/

cp 00-server.conf 99-connect.conf

Now edit 99-connect.conf to look like this -

99-connect.conf

Code: Select all

# This configuration file, when placed into into
# /etc/NetworkManager/conf.d changes NetworkManager's behavior to
# what's expected on "traditional UNIX server" type deployments.
#
# See "man NetworkManager.conf" for more information about these
# and other keys.
#
# Do not edit this file; it will be overwritten on upgrades. If you
# want to override the values here, or set additional values, you can
# do so by adding another file (eg, "99-local.conf") to this directory
# and setting keys there.

[connectivity]
uri=http://start.ubuntu.com/connectivity-check.html
response=Lorem ipsum
interval=0
It turns out that you can do a connectvity check in Network Mangler
and by setting the interval to 0, MAGIC, it turns off the "Not Connected Status" in Gnome.

Of course ether restart NetworkManager or Reboot.

Centos 7 Now works Again.... Like a Static Server

teeps
Posts: 1
Joined: 2014/08/29 18:33:18

Re: Using Static ifcfg- files on Centos 7 for bridging

Post by teeps » 2014/08/29 19:35:50

I registered just to say thanks. This helped a lot.

wchao
Posts: 7
Joined: 2014/07/19 20:37:00

Re: Using Static ifcfg- files on Centos 7 for bridging

Post by wchao » 2014/09/02 00:56:04

Bridging actually does work in NetworkManager, although it's kind of a pain to figure out the first time around. Here is what I use:

# prepare enp1s0 physical device for bridging
nmcli connection modify enp1s0 ipv4.method disabled ipv6.method ignore connection.autoconnect yes
nmcli connection modify enp1s0 connection.interface-name enp1s0
# create bridge br0 and link to enp1s0
nmcli connection add type bridge ifname br0 con-name br0
nmcli connection modify enp1s0 connection.master br0 connection.slave-type bridge
# configure IPv4 networking on br0
cd /etc/sysconfig/network-scripts/
nmcli connection modify br0 bridge.stp no ipv4.method manual ipv4.dns 192.168.1.1 ipv4.dns-search mydomain.com ipv4.addresses "192.168.1.232/24 192.168.1.1"
nmcli connection up enp1s0

Replace enp1s0 with the physical device name, the first 192.168.1.1 with the DNS server IP, 192.168.1.232/24 with the IP address you want to use and IPv4 prefix, and the second 192.168.1.1 with the gateway IP.

You can even get NetworkManager to work with bridging and VLAN interfaces. It's slightly more complicated, but I have it working fine.

mikejmcfarlane
Posts: 1
Joined: 2015/01/12 18:35:33

Re: Using Static ifcfg- files on Centos 7 for bridging

Post by mikejmcfarlane » 2015/01/12 18:37:36

Have spent the afternoon trying to get the bridge setup on CentOS 7, wish I had found your post sooner. Thanks for sharing your hard work:-)

Bunionhead
Posts: 7
Joined: 2014/03/09 19:02:58

Re: Using Static ifcfg- files on Centos 7 for bridging

Post by Bunionhead » 2015/02/13 00:52:49

Between CentOS 6.5 and CentOS 7, over the last year or more, I've probably spent at least 50 hours trying to get this to work. Thank you very much for your great documentation! I really appreciate how you took the time to indicate where your examples needed to be edited to match other systems. Every other guide that I have followed has failed to help. I now have a host and a VM that can each reach the Internet and be pinged via their own addresses. Thank you. Thank you.

s1gny
Posts: 1
Joined: 2015/04/02 07:51:54

Re: Using Static ifcfg- files on Centos 7 for bridging

Post by s1gny » 2015/04/02 08:01:10

I'm the next guy, who tried for days now, to get this working. No success. But since i had your How to it works like a charm. I'm so thankful that i found this post here. The only thing i'd like to add: you should mention, that also ip_forwarding should be configured active.
I did this with editing /etc/sysctl.conf and add (or modify) this line in the file:

pv4.ip_forward = 1

Then load the new settings with "sysctl -p /etc/sysctl.conf"

The only thing which is left is to get DNS queries working...because currently they dont...

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Using Static ifcfg- files on Centos 7 for bridging

Post by jlehtone » 2015/04/08 22:18:49

s1gny wrote:The only thing i'd like to add: you should mention, that also ip_forwarding should be configured active.
Why? Forwarding means routing and there is no routing in plain bridge.

Post Reply