Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Why is eth0 in my routing table as well as bridge br0?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Fog_Watch
Apprentice
Apprentice


Joined: 24 Jul 2006
Posts: 267
Location: Utility Muffin Research Kitchen

PostPosted: Wed Feb 13, 2013 5:44 am    Post subject: Why is eth0 in my routing table as well as bridge br0? Reply with quote

I would like to bridge eth0 and wlan0. /etc/conf.d/net is as follows:
Code:
modules_wlan0="!wpa_supplicant"
config_wlan0="null"
config_eth0="null"
bridge_br0="eth0"
config_br0="dhcp"
brctl_br0="setfd 0
   sethello 10
   stp off"


This is works OK, however I can't ping out of my machine.

The routing table is as follows:
Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.1.1     0.0.0.0         UG    204    0        0 br0
loopback        localhost       255.0.0.0       UG    0      0        0 lo
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     204    0        0 br0


That is, destination "192.168.1.0" is listed twice, once under eth0 and
once under br0. I don't know why eth0 should be there, and when
removed routing works fine, both into and from the box. When the
machine is booting and net.br0 starts under runlevel default, how do I prevent
the eth0 route from being created?

Regards

Fog_Watch.

(Don't worry about the absence of wlan0, I know how to fix that)
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1555
Location: Montréal

PostPosted: Wed Feb 13, 2013 5:54 am    Post subject: Reply with quote

Do you have net.eth0 in /etc/init.d? What is the output of
Code:
brctl show

after boot is finish?
_________________
Paul
Back to top
View user's profile Send private message
Fog_Watch
Apprentice
Apprentice


Joined: 24 Jul 2006
Posts: 267
Location: Utility Muffin Research Kitchen

PostPosted: Wed Feb 13, 2013 6:26 am    Post subject: Reply with quote

Logicien wrote:
Do you have net.eth0 in /etc/init.d? What is the output of
Code:
brctl show

after boot is finish?
Code:
# ls -la /etc/init.d/net*     
lrwxrwxrwx 1 root root     6 Feb 11 19:08 /etc/init.d/net.br0 -> net.lo
lrwxrwxrwx 1 root root     6 Feb 11 19:08 /etc/init.d/net.eth0 -> net.lo
-rwxr-xr-x 1 root root 16919 Feb  1 23:06 /etc/init.d/net.lo
lrwxrwxrwx 1 root root     6 Feb 11 19:08 /etc/init.d/net.wlan0 -> net.lo
-rwxr-xr-x 1 root root  1578 Feb  1 23:06 /etc/init.d/netmount

With or without net.eth0 in /etc/init.d the confounding eth0 route still appears. However, hostapd needs both net.eth0 and net.br0 in /etc/init.d.
Code:

# brctl show
bridge name   bridge id      STP enabled   interfaces
br0      8000.001676d0bfe6   no      eth0
Back to top
View user's profile Send private message
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1969

PostPosted: Wed Feb 13, 2013 1:27 pm    Post subject: Reply with quote

Have you set up hostapd.conf to tell hostapd that it's using a bridge?

Will
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1555
Location: Montréal

PostPosted: Wed Feb 13, 2013 2:58 pm    Post subject: Reply with quote

If you want wlan0 to be in the same bridge than eth0, you have to add it in the bridge br0. Both are dependancies of br0 and have to be started by net.br0. They should not be started independently.
_________________
Paul
Back to top
View user's profile Send private message
Fog_Watch
Apprentice
Apprentice


Joined: 24 Jul 2006
Posts: 267
Location: Utility Muffin Research Kitchen

PostPosted: Thu Feb 14, 2013 2:07 am    Post subject: Reply with quote

I don't believe that wlan0 or hostapd to be the problem:

I can plop wlan0 into my bridge easy peasy:
Code:
# brctl show
bridge name   bridge id      STP enabled   interfaces
br0      8000.001676d0bfe6   no      eth0
                     wlan0

Having started hostapd I can then use the wifi access point.

My problem is the routing table that is established by booting. The following is what is currently booted:
Code:
# rc-update show | grep net
              net.br0 |      default                 
               net.lo | boot                         
             netmount |      default

Code:
# ls -la /etc/init.d/net*
lrwxrwxrwx 1 root root     6 Feb 13 19:19 /etc/init.d/net.br0 -> net.lo
-rwxr-xr-x 1 root root 16919 Feb  1 23:06 /etc/init.d/net.lo
-rwxr-xr-x 1 root root  1578 Feb  1 23:06 /etc/init.d/netmount

Code:
# egrep -v '^#|^$' /etc/conf.d/net
modules_wlan0="!wpa_supplicant"
config_wlan0="null"
brctl_br0="setfd 0
   sethello 10
   stp off"
config_eth0="null"
bridge_br0="eth0"
config_br0="dhcp"

And the following is the infernal routing table that boot comes up with, unless I route del eth0.
Code:
route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.1.1     0.0.0.0         UG    4      0        0 br0
loopback        localhost       255.0.0.0       UG    0      0        0 lo
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     4      0        0 br0
Ah.

Why is eth0 in my routing table as well as bridge br0?

Moreover, thank you Paul and Will.
Back to top
View user's profile Send private message
Aiken
Apprentice
Apprentice


Joined: 22 Jan 2003
Posts: 239
Location: Toowoomba/Australia

PostPosted: Thu Feb 14, 2013 2:56 am    Post subject: Reply with quote

I am using a bridge consisting of eth0 + eth1 + wlan0 with hostapd and not seeing either of the eth devices in the routing table.

Code:

config_eth0="null"
config_eth1="null"
bridge_br0="eth0 eth1"
config_br0="172.16.31.1/24"
routes_br0="default via 172.16.31.254"

depend_br0() {
   need net.eth0 net.eth1
}


Code:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.16.31.254   0.0.0.0         UG    6      0        0 br0
127.0.0.0       127.0.0.1       255.0.0.0       UG    0      0        0 lo
172.16.31.0     0.0.0.0         255.255.255.0   U     0      0        0 br0


Code:

              net.br0 |      default                 
             net.eth0 |      default                 
             net.eth1 |      default                 
               net.lo | boot


One difference I am seeing is I have net.eth0 and net.eth1 in default where you do not have your net.eth0 in default. Don't see what that should make a difference as the eth device(s) should be started anyway as dependencies of br0. The other difference is I am using static and you are using dhcp. At the moment I am wondering if you have something else adding a route via eth0. Could that something else be the dhcp client?

Logicien wrote:
If you want wlan0 to be in the same bridge than eth0, you have to add it in the bridge br0. Both are dependancies of
br0 and have to be started by net.br0. They should not be started independently.


Hostapd adds wlan0 to the bridge as needed. Wlan0 does not need to be part of the original bridge definition. The bridge can be started independently of wlan0. In this situation hostapd needs the bridge started 1st.
_________________
Beware the grue.
Back to top
View user's profile Send private message
Fog_Watch
Apprentice
Apprentice


Joined: 24 Jul 2006
Posts: 267
Location: Utility Muffin Research Kitchen

PostPosted: Thu Feb 14, 2013 4:38 am    Post subject: Reply with quote

Aiken wrote:
The other difference is I am using static and you are using dhcp.

dhcp or not, my routing table ends up the same: borked.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum