[Lxc-users] Container broadcast address

Trent W. Buck trentbuck at gmail.com
Mon Feb 7 00:32:03 UTC 2011


Daniel Lezcano <daniel.lezcano at free.fr> writes:

> On 02/04/2011 03:43 PM, Andre Nathan wrote:
>> Hello
>>
>> I have the following container network configuration:
>>
>> lxc.network.type = veth
>> lxc.network.link = br0
>> lxc.network.flags = up
>> lxc.network.ipv4 = 192.168.0.2/24
>> lxc.network.name = eth0
>>
>> When the container starts up, this is how its eth0 interface is
>> configured:
>>
>> eth0      Link encap:Ethernet  HWaddr 2e:bd:69:e3:ed:d3
>>            inet addr:192.168.0.2  Bcast:192.168.0.0  Mask:255.255.255.0
>>            inet6 addr: fe80::2cbd:69ff:fee3:edd3/64 Scope:Link
>>            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>>            RX packets:12 errors:0 dropped:0 overruns:0 frame:0
>>            TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
>>            collisions:0 txqueuelen:1000
>>            RX bytes:1124 (1.1 KB)  TX bytes:866 (866.0 B)
>>
>> The broadcast address should be 192.168.0.255. Is there a way I can set
>> this?
>
> lxc.network.ipv4 = 192.168.0.2/24 192.168.0.255

Why doesn't lxc default to

    ip address add 192.168.0.2/24 brd + dev <...>

...i.e. calculate the broadcast address from the CIDR address ("brd +")?

Hm, maybe no broadcast address is set by default, and ifconfig is
misreporting it?

    $ sudo ip address add 10.1.2.3/16 dev eth0
    $ sudo ip address add 10.1.2.4/16 dev eth0 brd +
    $ sudo ip address show dev eth0
    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether 48:5b:39:07:7c:b0 brd ff:ff:ff:ff:ff:ff
        inet 192.168.155.156/24 brd 192.168.155.255 scope global eth0
        inet 10.1.2.3/16 scope global eth0
        inet 10.1.2.4/16 brd 10.1.255.255 scope global secondary eth0
        inet6 fe80::4a5b:39ff:fe07:7cb0/64 scope link
           valid_lft forever preferred_lft forever

    $ ifconfig
    [oops, ifconfig only reports one address, so this was a dumb test]





More information about the lxc-users mailing list