Bonded interface as dhcp client?

on the wan side of my router I have bonded eth3-6 into 'bond-1g'
in the GUI interface, it seems like I cannot build it as both a bond and a dhcp client.
Is this possible?

Could you share your /etc/config/network?
Not quiet sure if this is "just" a bug in LUCI, but in general a bond-interface can use dhcp.

See: SOLVED - Cannot get dcpd/odhcpd to run

Thanks for looking:
The interface I want to be DHCP clients are the bonded eth3 - eth6 on the wan side. The upstream router offers DHCP


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

config globals 'globals'
        option ula_prefix 'fdfd:ec3f:3cf0::/48'

config device
        option name 'eth0'

config device
        option name 'eth1'
        option mtu '9000'
        option mtu6 '9000'

config device
        option name 'eth2'
        option mtu '9000'
        option mtu6 '9000'

config device
        option name 'eth3'

config device
        option name 'eth4'

config device
        option name 'eth5'

config device
        option name 'eth6'

config interface '10g'
        option proto 'bonding'
        option ipaddr '172.16.27.2'
        option netmask '255.255.255.0'
        option all_slaves_active '0'
        option link_monitoring 'mii'
        option miimon '0'
        option downdelay '0'
        option updelay '0'
        option use_carrier '1'
        list dns '172.16.27.1'
        list dns '8.8.8.8'
        list dns '4.2.2.2'
        option bonding_policy 'balance-rr'
        option packets_per_slave '1'
        list slaves 'eth1'
        list slaves 'eth2'
        option force_link '1'

config device
        option name 'bond-10g'
        option mtu '9000'
        option mtu6 '9000'

config route
        option interface '10g'
        option target '0.0.0.0/0'
        option gateway '172.16.27.1'

config interface '1g'
        option bonding_policy 'balance-rr'
        option packets_per_slave '1'
        option all_slaves_active '0'
        option link_monitoring 'off'
        option proto 'bonding'
        option ipaddr '172.16.27.141'
        option netmask '255.255.255.0'
        list slaves 'eth3'
        list slaves 'eth4'
        list slaves 'eth5'
        list slaves 'eth6'

config device
        option name 'bond-1g'

config interface 'eth0'
        option proto 'dhcp'
        option device 'eth0'

(Stupid question) But the upstream router has a LAG configured too?

I would assume you want to have option proto 'dhcp' on config interface '1g', (and not on config interface 'eth0'); but why on earth is there no documentation about bonding on the wiki?! (I use LAG/bonding only on servers and "enterprise gear switches", but not on small openwrt boxes...)

EDIT: Ah nope sorry. I can not have two times option proto on an interface :confused: So this will probably not be working.

The upstream is a lacp switch. The incoming signal from the router is on a 2.5Gb port to that switch

This is because the bonding in OpenWrt was incorrectly implemented as interface protocol and not as device type (like e.g. macvlan or bridge).

To achieve your desired result, create another logical interface with proto dhcp and make it use bond-10g as device or @10g as alias interface.

Either:

config interface '10g'
        option proto 'bonding'
        ...

config interface '10g_dhcp'
        option proto 'dhcp'
        option device 'bond-10g'

or:

config interface '10g'
        option proto 'bonding'
        ...

config interface '10g_dhcp'
        option proto 'dhcp'
        option device '@10g'
1 Like

Thanks very much for your reply.
I have the 10g interface & device (bond) working exactly as desired so far.
This question was about the '1g' bond of eth3-6.


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

config globals 'globals'
        option ula_prefix 'fdfd:ec3f:3cf0::/48'

config device
        option name 'eth0'

config device
        option name 'eth1'
        option mtu '9000'
        option mtu6 '9000'

config device
        option name 'eth2'
        option mtu '9000'
        option mtu6 '9000'

config device
        option name 'eth3'
        option mtu '1500'
        option mtu6 '1500'

config device
        option name 'eth4'
        option mtu '1500'
        option mtu6 '1500'

config device
        option name 'eth5'
        option mtu '1500'
        option mtu6 '1500'

config device
        option name 'eth6'
        option mtu '1500'
        option mtu6 '1500'

config interface '10g'
        option proto 'bonding'
        option ipaddr '172.16.27.2'
        option netmask '255.255.255.0'
        option all_slaves_active '0'
        option link_monitoring 'mii'
        option miimon '0'
        option downdelay '0'
        option updelay '0'
        option use_carrier '1'
        list dns '172.16.27.1'
        list dns '8.8.8.8'
        list dns '4.2.2.2'
        option bonding_policy 'balance-rr'
        option packets_per_slave '1'
        list slaves 'eth1'
        list slaves 'eth2'
        option force_link '1'

config device
        option name 'bond-10g'
        option mtu '9000'
        option mtu6 '9000'

config route
        option interface '10g'
        option target '0.0.0.0/0'
        option gateway '172.16.27.1'

config interface '1g'
        option bonding_policy 'balance-rr'
        option packets_per_slave '1'
        option all_slaves_active '0'
        option link_monitoring 'off'
        option proto 'bonding'
        list slaves 'eth3'
        list slaves 'eth4'
        list slaves 'eth5'
        list slaves 'eth6'

config device
        option name 'bond-1g'
        option mtu '1500'
        option txqueuelen '1000'
        option ipv6 '0'

config interface '1g_dhcp'
        option proto 'dhcp'
        option device 'bond-1g'
        option defaultroute '0'
        option ipv6 '0'

config interface 'eth0'
        option proto 'dhcp'
        option mtu '1500'
        option device 'eth0'
        option ipv6 '0'

installing the 'dhcpd' opkg (misnamed, since it's actually a client package?)

    #### Details for package *dhcpcd*
    
    * **Version:** 7.2.2-1
    * **Size:** ~126.51 KiB installed
    
    ##### Description
    
    DHCPv4, IPv6RS and DHCPv6 client with IPv4LL support dhcpcd is a one stop network management daemon which includes * RFC compliant DHCPv4 and DHCPv6 clients * DHCPv6 Prefix Delegation support * IPv4LL (aka ZeroConf) support * ARP address conflict resolution * Link carrier detection * Wireless SSID profiles * ARP ping profiles
    
    Require approx. 126.51 KiB size for 1 package(s) to install.

immediately upon installing this package, a lot of stuff breaks in strange ways. the biggest one I see is that I get dup address errors for all four interfaces in the 1g bond.

is this the correct package for a dhcp client? The reason to have 1g as a DHCP client is that when it's all configured, the 1g bond will be facing the upstream modem which supplies addresses in the 10.0.0.0 / 24 space using dhcp. udhcpd in busybox apparently is automatic in openwrt, but I don't see in the wiki how to set options/parameters for it.

You don't need to install any packages for DHCP client functionality, that's built into OpenWrt core.

Same.

config interface '1g'
        option bonding_policy 'balance-rr'
        option packets_per_slave '1'
        option all_slaves_active '0'
        option link_monitoring 'off'
        option proto 'bonding'
        option ipaddr '172.16.27.141'
        option netmask '255.255.255.0'
        list slaves 'eth3'
        list slaves 'eth4'
        list slaves 'eth5'
        list slaves 'eth6'

config interface '1g_dhcp'
        option proto 'dhcp'
        option device '@1g'
  • or -
config interface '1g'
        option bonding_policy 'balance-rr'
        option packets_per_slave '1'
        option all_slaves_active '0'
        option link_monitoring 'off'
        option proto 'bonding'
        option ipaddr '172.16.27.141'
        option netmask '255.255.255.0'
        list slaves 'eth3'
        list slaves 'eth4'
        list slaves 'eth5'
        list slaves 'eth6'

config interface '1g_dhcp'
        option proto 'dhcp'
        option device 'bond-1g'