Nathan Coulson wrote:
> On Sun, Mar 18, 2012 at 2:28 PM, Bruce Dubbs <[email protected]> wrote:
>> Nathan Coulson wrote:
>>> Looks like a balance between simplicity, and useful.  I noted that
>>> there is nothing to call ip link set br0 up after the interface is
>>> created though, so it fails to add the gateway.
>> The bridge is set up explicitly in the bridge service:
>>
>> ip link set ${1} up
>>
>> Where ${1} is typically br0.
> 
>    up)
>       log_info_msg "Creating the ${1} interface..."
>       brctl addbr ${1}
>       evaluate_retval
>       for I in ${INTERFACES}; do
>          log_info_msg "Adding ${I} to ${1}..."
>          ip link set ${I} up &&
>          brctl addif ${1} ${I}
>          evaluate_retval
>       done
>    ;;
> 
> I see the ip link set ${l} up, for each interface...  but not the br0
> interface.  Basically,
> 
> lfs-bootscripts-20120229.tar.xz
> 
>>> What about making 2 variables for service scripts?  one for pre device
>>> generation, (like bridge, perhaps tunnels) when br0 does not exist,
>>> and one for post device generation that handles addressing
>>> (ipv4-static, or ipv6) .  We can use check link again to ensure the
>>> device is operational or not
>> I'm not sure I follow, but once the bridge is up, other operations are
>> made to the component eth interfaces.
> #ipconfig.br0
> SERVICEIF="bridge"
> SERVICEPROTO="ipv4-static"
> 
> #ifup
> for S in ${SERVICEIF}; do
>   IFCONFIG=${file} /lib/services/${S} ${IFACE} up
> done
> 
> #check link here
> 
> for S in ${SERVICEPROTO}; do
>   IFCONFIG=${file} /lib/services/${S} ${IFACE} up
> done
> 
> [btw, I don't like the example variable names, but they sufficed for
> the example]
> 
>>> The  other option, would be adding ip link set br0 up into bridge, but
>>> I would consider that a layer violation.
>>>
>>> Either way, would be nice if the scripts were made so CHECK_LINK
>>> should not need to exist on all scripts that have to create their own
>>> device (preferrably without bringing knowledge of bridges/tunnels into
>>> ifup/ifdown)
>> I'm not sure I follow you.  To me, the bridge is only useful for
>> establishing networking in a VM.  Do you have other uses in mind?
> 
> probably shown better in code above.
> 
> My use case for bridge, was to have br0 a static IP of 192.168.2.50,
> as well as 192.168.1.50.  It brings in eth0 for the interface, and
> gives qemu the ability to bridge into br0 on the fly.
> 
> Basically what started this, is I have the following config file
> ONBOOT=yes
> IFACE=br0
> SERVICE="bridge ipv4-static"
> IP=192.168.2.50
> GATEWAY=192.168.2.254
> PREFIX=24
> BROADCAST=192.168.2.255
> CHECK_LINK=no
> STP=no
> INTERFACES="eth0"
> IP_FORWARD=true
> 
> and when I booted up, it failed to add 192.168.2.254 as the default
> gateway because no route exists.  Looking into it further, ip link br0
> shown that the interface was down (but had the IP Address), and ip
> route was blank.
> 
> ip link set br0 up
> ip route add default via 192.168.2.254 dev br0
> 
> allowed my network to work again.

The problem is trying to get the different options working together 
properly.  Right now the CHECK_LINK is done in ifup.  Perhaps it should 
be moved to the various service scripts and removed from ifup.

CHECK_LINK is a legacy issue.  I can't really see why an interface 
should be initialized without setting it up.  The current script tries 
to bring up the interface before the service script is run.  For the br0 
interface, that is before it is created and doesn't work.

The code could also be simplified quite a bit.  Does running

  ip link set ${IFACE} up

unconditionally when it is already up really affect anything?

Alternatively, the ifup script could just test for the device name 
starting with "br" and defer the step setting the bridge up to the 
bridge service script.

I do think that if the bridge is up, the gateway will be set properly 
when the eth device is initialized.

Thoughts?

   -- Bruce

-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to