LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-18-2007, 12:08 PM   #1
Mithrilhall
Member
 
Registered: Feb 2002
Location: Adamstown, Pitcairn Islands
Distribution: Neon
Posts: 291

Rep: Reputation: 30
Question Bridging interfaces (eth0 + eth1 = br0)


I'm trying to bridge my two NICs (eth0 & eth1) and set a static IP address on br0 with no IP addresses on eth0 and eth1.

I've created the br0 interface and added eth0 & eth1:
Quote:
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
ifconfig br0 up

To set the static IP address on br0 I edited '/etc/network/interfaces' and added the following:
Quote:
#allow-hotplug eth0
#iface eth0 inet dhcp

auto br0
iface br0 inet static
address 10.2.162.100
netmask 255.255.255.0
network 10.2.162.0
broadcast 10.2.162.255
gateway 10.2.162.1
dns-nameservers 4.2.2.2
bridge_ports eth0 eth1
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off

The problem I'm running into is when I reboot the computer I cannot ping outside of my network. If I do a '/etc/inet.d/networking restart' and wait a bit I can eventually ping out of the local network.

Did I set this up correctly or am I missing something?
 
Old 10-27-2007, 05:35 AM   #2
PelliX
Member
 
Registered: Apr 2006
Location: Enschede
Distribution: Debian, Red Hat/Fedora, Solaris, DD-WRT, NetBSD, Mac OS8/9, Mac OSX, UMP/OS, ESX
Posts: 42

Rep: Reputation: 15
Hello Mithrilhall,

Well, basically you forgot to do something, but then again, there is not really a definitive guide to bridging as virtually every setup has crucial differences...

I have used the the linux-bridge a bit, and it would appear that (real) interfaces get 'knocked out of sync' when the bridge module is loaded for the first time in some setups.

I'm not going to go into examples and details, but I would consider putting the following (or equivalent) in you rc.network (or what you have for that):

Code:
#!/bin/bash
#
# simple up and down
#
# I use 'ifconfig up $interface' in this example, cause 
# I don't know whether ifup works on your box.
#

ifconfig eth0 up
ifconfig eth1 up
modprobe bridge
ifconfig br0 up

# load bridge module (if it loads otherwise, then leave this commented out)
; modprobe bridge

ifconfig eth0 down; ifconfig eth0 up
ifconfig eth1 down; ifconfig eth1 up

# showing whether module is loaded
echo '#'
echo '# Bridge modules loaded:`lsmod | grep bridge`'
echo '#'

# just giving you time to read...
sleep 2 

# and see whether it worked!
echo '# ping from eth0'
ping -c 3 -I eth0 www.google.com
sleep 1
echo '# ping from eth1'
ping -c 3 -I eth1 www.google.com
sleep 1
echo '# ping from br0'
ping -c 3 -I br0 www.google.com
sleep 1
Note: this is assuming that the bridge is persistant, otherwise add
Code:
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
to the beginning of the script.

PelliX

Last edited by PelliX; 10-31-2007 at 02:59 AM.
 
  


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
System determining which hardware interfaces eth0, eth1 by itself; how to change? HowDoIProgramIt Debian 3 06-07-2007 10:48 PM
br0 with ath0 and eth0 not working on ixp vinodl Debian 0 09-16-2006 06:37 AM
Mandrake is switching the eth1 and eth0 interfaces... how can I switch them back? LaptopLinux Mandriva 3 03-28-2005 09:23 PM
eth0 and eth1 with 2 network interfaces codegomer Linux - Networking 12 04-20-2004 10:04 PM
Bridging interfaces + ip address Soma Linux - Networking 2 10-27-2003 07:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:59 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