OpenWrt Forum Archive

Topic: network configuration

The content of this topic has been archived on 14 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I want to bridge 2 NICs and have 3 aliases on them.
first one is dhcp, next 2 are static.

Here is my /etc/config/network file

config 'interface' 'loopback'
        option 'ifname' 'lo'
        option 'proto' 'static'
        option 'ipaddr' '127.0.0.1'
        option 'netmask' '255.0.0.0'

config 'interface' 'lan'
        option 'ifname' 'eth0 eth1'
        option 'type' 'bridge'
        option 'proto' 'dhcp'

config 'interface' 'lan_1'
        option 'ifname' 'br-lan:1'
        option 'proto' 'static'
        option 'netmask' '255.0.0.0'
        option 'ipaddr' '2.215.236.88'

config 'interface' 'lan_2'
        option 'ifname' 'br-lan:2'
        option 'proto' 'static'
        option 'netmask' '255.0.0.0'
        option 'ipaddr' '2.215.236.89'

However this worked fine for long time, it now does not create the ip aliases anymore, but only the dhcp address.
Can someone check how it responds on your side (this is on a x86 board, if this matters, using latest trunk)

When I set the "dhcp" to "none" I do get my static aliases and not the dhcp one.

Is my config wrong for setting up such bridge?

Kind regards
Bart

Try this:

config 'interface' 'loopback'
        option 'ifname' 'lo'
        option 'proto' 'static'
        option 'ipaddr' '127.0.0.1'
        option 'netmask' '255.0.0.0'

config 'interface' 'lan'
        option 'ifname' 'eth0 eth1'
        option 'type' 'bridge'
        option 'proto' 'dhcp'

config 'alias'
        option 'interface' lan'
        option 'proto' 'static'
        option 'netmask' '255.0.0.0'
        option 'ipaddr' '2.215.236.88'

config 'alias'
        option 'interface' 'lan'
        option 'proto' 'static'
        option 'netmask' '255.0.0.0'
        option 'ipaddr' '2.215.236.89'

~ JoW

not working. Doesn't give any aliases at all. And how would I know what the alias interface name would be (if it worked)? As I have to bind to those specific aliases.

I now made a separate interface for dhcp. Than it works but I get ifconfig errors when running the network start script.

config 'interface' 'loopback'
        option 'ifname' 'lo'
        option 'proto' 'static'
        option 'ipaddr' '127.0.0.1'
        option 'netmask' '255.0.0.0'

config 'interface' 'lan'
        option 'ifname' 'eth0 eth1'
        option 'type' 'bridge'
        option 'proto' 'none'

config 'interface' 'lan_1'
        option 'ifname' 'br-lan:1'
        option 'proto' 'static'
        option 'netmask' '255.0.0.0'
        option 'ipaddr' '2.215.236.88'

config 'interface' 'lan_2'
        option 'ifname' 'br-lan:2'
        option 'proto' 'static'
        option 'netmask' '255.0.0.0'
        option 'ipaddr' '2.215.236.89'

config 'interface' 'lan_3'
        option 'ifname' 'br-lan:3'
        option 'proto' 'dhcp'

Grtzzzzz
Bart

Hi Jow

Your config did work but there was an unclosed ' on line 13 before lan'
Am I always sure that br-lan:1 will be the first in the config file? Or is there a way to force this? For example by adding ifname?

Thank you very much.

Grtzzzz
Bart

Hi.

The naming scheme is: ifname of referenced interface section + :n where n is the number of the alias for this interface.
Aliases will be created in the order they have in the config file.

~ JoW

Hi.

Applied your config. everything works fine.
Many thanks for explaining this.

Bart

Hi,

Facing another problem now with these aliases...

How can I configure all my aliases so they receive dhcp IP address.
This may sound crazy but I have a service running for which the protocol limits its functionality. So I have 2 or 3 times this same service running but bound to different IP alias. Instead of defining these IP addresses static, I now need them configured by dhcp.

How can I have multiple DHCP client addresses (aliases)?

Kind regards

Bart

The discussion might have continued from here.