[Rear-users] automatically map ip adresses from bridge interfaces like br0

Kai-Olaf Pieth pieth at dc-systeme.de
Fri Jan 27 19:42:52 CET 2012


Hello Guys,

i had the problem that my eth0 does not have an ip address because br0 holds that ip. That was automatically configured by SLES11SP1 because I have used vm-install to install KVM Guest systems that are using bridging on eth0.

So the rear system doesn't had an ip address because br0 is no physical device.

I edited "rescue/GNU/Linux/31_network_devices.sh" like this:

                # routine for a physical device thats up without having an ip-address
                if test -z $(ip a show dev $dev scope global | grep "inet.*\ " | tr -s " " | cut -d " " -f 3) ; then
                # maybe it is attached to a bridge-device that holds its ip...
                if test -d $sysfspath/brport ; then
                                        # get associated bridge name
                                        bridge=$(basename $(readlink $sysfspath/brport/bridge))
                                        # get ips from bridge and map'em to physical device
                                        for addr in $(ip a show dev $bridge scope global | grep "inet.*\ " | tr -s " " | cut -d " " -f 3) ; do
                                                echo "ip addr add $addr dev $dev" >>$netscript
                                        done
                fi
                else
                # standard-routine for devices with an ip address...
                for addr in $(ip a show dev $dev scope global | grep "inet.*\ " | tr -s " " | cut -d " " -f 3) ; do
                        echo "ip addr add $addr dev $dev" >>$netscript
                done
                echo "ip link set dev $dev up" >>$netscript
                fi

For my simple configuration this is working. How do you like it?

PS: My ip addr is looking like this:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
    inet 127.0.0.2/8 brd 127.255.255.255 scope host secondary lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether b4:99:ba:ad:aa:f6 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether b4:99:ba:ad:aa:f7 brd ff:ff:ff:ff:ff:ff
4: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
    link/ether b4:99:ba:ad:aa:f6 brd ff:ff:ff:ff:ff:ff
    inet 172.16.16.15/24 brd 172.16.16.255 scope global br0

Mit freundlichen Grüßen
Kai-Olaf Pieth

[Beschreibung: C:\Users\kpieth\AppData\Roaming\Microsoft\Signatures\dclogo.JPG]
Informatik GmbH
Kettwiger Str. 26

42579 Heiligenhaus


E-Mail:

pieth at dc-systeme.de<mailto:pieth at dc-systeme.de>

Tel:

+49 2056 261 1

Fax:

+49 2056 261 260

Internet:

www.dc-systeme.de

HRB Wuppertal 17704
Geschäftsführer: W. Otterbein, T. Tenhaft
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://pikachu.3ti.be/pipermail/rear-users/attachments/20120127/a1f9ab4e/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 4175 bytes
Desc: image001.jpg
Url : http://pikachu.3ti.be/pipermail/rear-users/attachments/20120127/a1f9ab4e/attachment.jpg 


More information about the rear-users mailing list