LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 07-24-2015, 07:30 PM   #1
Altiris
Member
 
Registered: Mar 2013
Posts: 556

Rep: Reputation: Disabled
How to create a bridge interface for eth0?


Ive been testing around Slackware 14.1 in a VM as preparing to move my server from CentOS to Slackware (thank god CentOS/RHEL don't touch upstream configuration...unlike other distros such as debian...transitioning is very easy because of this). Anyway, I am not entirely sure I can properly test a bridged interface in Virtualbox so I am looking for someone to provide me an example of briding the eth0 interface. The way I do it in CentOS 6.6 is as such (maybe it is similar?)

/etc/sysconfig/network-scripts/ifcfg-eth0

Code:
DEVICE="eth0"
BOOTPROTO=none
BRIDGE="br0"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
UUID="UUIDHERE"
# Do not assign IP here when br0 is active
#IPADDR=192.168.1.10
PREFIX=24
GATEWAY=192.168.1.12
DNS1=104.237.144.172
DNS2=107.170.95.180
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME="eth0"
LAST_CONNECT=1419879599
I don't use IPV6, I don't know what most of the non-obvious parameters are either.

/etc/sysconfig/network-scripts/ifcfg-br0 (this is my bridged interface)

Code:
DEVICE="br0"
TYPE="Bridge"
BOOTPROTO="none"
ONBOOT="yes"
DELAY=0
DNS1=104.237.144.172
DNS2=107.170.95.180
IPADDR=192.168.1.10
GATEWAY=192.168.1.12
Obviously network configuration is different in Slackware, its in /etc/rc.d/rc.inet1 for Slackware I believe. I am just giving an example of how I do it in CentOS 6
 
Old 07-24-2015, 07:54 PM   #2
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750
If you want the bridge to be set up at boot, then use/etc/rc.d/rc.inet1.conf. http://www.linuxquestions.org/questi...9/#post4803979
If you want to manually start the bridge before you start the VM, then you can use a little script. http://www.linuxquestions.org/questi...9/#post4804396

Last edited by allend; 07-24-2015 at 08:35 PM.
 
Old 07-24-2015, 07:58 PM   #3
mralk3
Slackware Contributor
 
Registered: May 2015
Distribution: Slackware
Posts: 1,900

Rep: Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050
I believe you would want to edit /etc/rc.d/rc.local and create the bridge there at boot using the bridge-utils package. You use brctl command for this.

Here is some documentation from the Arch wiki:

https://wiki.archlinux.org/index.php...h_bridge-utils


EDIT: I think allend's way is better.

Last edited by mralk3; 07-24-2015 at 07:59 PM.
 
Old 07-27-2015, 02:48 AM   #4
wildwizard
Member
 
Registered: Apr 2009
Location: Oz
Distribution: slackware64-14.0
Posts: 875

Rep: Reputation: 282Reputation: 282Reputation: 282
Just out of curiosity when you talk about a bridged interface are you talking about the option for your VM in the Virtualbox settings?

Because if that is all your doing then you don't need to set anything up it just works.
 
Old 04-06-2016, 04:22 AM   #5
franzen
Member
 
Registered: Nov 2012
Distribution: slackware
Posts: 535

Rep: Reputation: 379Reputation: 379Reputation: 379Reputation: 379
Quote:
Originally Posted by allend View Post
If you want the bridge to be set up at boot, then use/etc/rc.d/rc.inet1.conf. http://www.linuxquestions.org/questi...9/#post4803979
I would like to set following in /etc/rc.d/rc.inet1.conf

Code:
IFNAME[0]="eth0"
IPADDR[0]="PUBLICADDRESS"
NETMASK[0]="255.255.255.0"
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""

# Config information for br0:
IFNAME[1]="br0"
BRNICS[1]="none"
IPADDR[1]="192.168.1.1"
NETMASK[1]="255.255.255.0"

GATEWAY="GATEWAY"
BRNICS[1]="none" is not supportet, but i want a bridge with seperate subnet, as i have a(only one) public ip-address on eth0.
Another solution could be to add a second address to br0, like
ip addr add 192.168.1.1/24 dev br0
But this also seems not to be supportet by /etc/rc.d/rc.inet1.conf
 
Old 04-06-2016, 04:45 AM   #6
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
It works a bit differently than you think.

Perhaps the first thing you need to to is draw your network topology, because I do not believe you have both a public IP on eth0 and an internal network segment attached at the same time. What is it that you want to bridge? You need two network devices for a working bridge.
 
Old 04-06-2016, 05:21 AM   #7
kikinovak
MLED Founder
 
Registered: Jun 2011
Location: Montpezat (South France)
Distribution: CentOS, OpenSUSE
Posts: 3,453

Rep: Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154
Quote:
Originally Posted by Altiris View Post
Ive been testing around Slackware 14.1 in a VM as preparing to move my server from CentOS to Slackware (thank god CentOS/RHEL don't touch upstream configuration...unlike other distros such as debian...transitioning is very easy because of this). Anyway, I am not entirely sure I can properly test a bridged interface in Virtualbox so I am looking for someone to provide me an example of briding the eth0 interface. The way I do it in CentOS 6.6 is as such (maybe it is similar?)
Bridging works fine in VirtualBox. Just configure your VM with Networking > Bridged and use your guest as any real host in the LAN.

On the other hand, if you use KVM, you'll have to define a bridge on your host system. Here's how I do it in rc.inet1.conf:

Code:
# Config information for br0::
IFNAME[0]="br0"
BRNICS[0]="eth0"
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]="yes"
DHCP_HOSTNAME[0]=""

# Config information for eth0:
#IPADDR[0]=""
#NETMASK[0]=""
#USE_DHCP[0]="yes"
#DHCP_HOSTNAME[0]=""
Cheers,

Niki
 
1 members found this post helpful.
Old 04-06-2016, 06:09 AM   #8
franzen
Member
 
Registered: Nov 2012
Distribution: slackware
Posts: 535

Rep: Reputation: 379Reputation: 379Reputation: 379Reputation: 379
Quote:
Originally Posted by Alien Bob View Post
It works a bit differently than you think.

Perhaps the first thing you need to to is draw your network topology, because I do not believe you have both a public IP on eth0 and an internal network segment attached at the same time. What is it that you want to bridge? You need two network devices for a working bridge.
Here is my current setup.

network topology:
Code:
eth0 public-ip     br0 192.168.1.1    lxc1 192.168.1.2
                                      lxc2 192.168.1.3
                                      ...
rc.firewall
Code:
/usr/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
rc.inet1.conf
Code:
IPADDR[0]="PUBLICADDRESS"
NETMASK[0]="255.255.255.0"
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""

# Config information for br0:
IFNAME[1]="br0"
BRNICS[1]="br0"
IPADDR[1]="192.168.1.1"
NETMASK[1]="255.255.255.0"

GATEWAY="GATEWAY_FROM_PROVIDER"
BRNICS=br0 is surly not ok, but this way my lxc-containers have access to the internet.
the lxc-containers use 192.168.1.1 as gateway.

Code:
brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.xxxxxxxxxxxxx      no              lxc1
                                                        lxc2
                                                        ...
This setup works, i'm posting because it seems it's not the way configured it should be.
 
Old 04-06-2016, 06:30 AM   #9
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Quote:
Originally Posted by kikinovak View Post
Bridging works fine in VirtualBox.
You are responding to the wrong post... Altiris was the OP but the thread has been hijacked by franzen.
 
Old 04-06-2016, 06:34 AM   #10
franzen
Member
 
Registered: Nov 2012
Distribution: slackware
Posts: 535

Rep: Reputation: 379Reputation: 379Reputation: 379Reputation: 379
Quote:
Originally Posted by kikinovak View Post
Code:
# Config information for br0::
IFNAME[0]="br0"
BRNICS[0]="eth0"
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]="yes"
DHCP_HOSTNAME[0]=""
This is fine if your in a lan, and the vm's are all in the same lan/subnet.
But i have to deal with *one* public ip-address, and have to create the lan within my host for the lxc-containers.
 
Old 04-06-2016, 06:35 AM   #11
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Quote:
Originally Posted by franzen View Post
Here is my current setup.

network topology:
Code:
eth0 public-ip     br0 192.168.1.1    lxc1 192.168.1.2
                                      lxc2 192.168.1.3
                                      ...
...

This setup works, i'm posting because it seems it's not the way configured it should be.
Have a look at ponce's old article on Linux Containers, it has good information on connecting your containers using bridging. The way you do it, is not correct, and I think it works by sheer luck.
 
Old 04-06-2016, 06:45 AM   #12
franzen
Member
 
Registered: Nov 2012
Distribution: slackware
Posts: 535

Rep: Reputation: 379Reputation: 379Reputation: 379Reputation: 379
Quote:
Originally Posted by Alien Bob View Post
Have a look at ponce's old article on Linux Containers, it has good information on connecting your containers using bridging. The way you do it, is not correct, and I think it works by sheer luck.
I did follow Ponce's advices:
Quote:
containers on a natted private network

In this case the script to bring up the private network is this

/sbin/brctl addbr br0
/sbin/brctl setfd br0 0
/sbin/ifconfig br0 192.168.2.1 netmask 255.255.255.0 promisc up
I have the same setup, there is no eth0 assigned to br0, it's all working fine.
But, i can't find a way to accomplish this with rc.inet1.conf(in a correct way).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a dummy network interface (and/or bridge) PatrickBaer Linux - Networking 0 01-09-2014 12:44 PM
create a bridge, eth0 does not exists sanaz Linux - Virtualization and Cloud 3 04-04-2013 02:50 PM
Creating a bridge interface eth0 to wlan0 edmundojr Linux - Networking 3 11-30-2012 06:09 PM
Interface eth0 missing after messing around with bridge ariel106 Mandriva 3 12-01-2007 06:45 AM
How do I create a eth0 interface? DodoTux Linux - Networking 5 08-28-2006 01:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration