I'm porting OpenWRT to a custom device with custom partitions and currently I'm struggling with getting Ethernet and Wireless working. The problem is that I don't fully understand the underlying concepts of all that and experience the absence of at least mid-level complexity documentation.
/etc/board.d/02_network
:
case $board in
<my-board>)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan1 wan2"
;;
/etc/board.json
:
{
"model": {
"id": "<my-board>",
"name": "<model-name>"
},
"network": {
"lan": {
"ports": [
"lan1",
"lan2",
"lan3",
"lan4"
],
"protocol": "static"
},
"wan": {
"ports": [
"wan1",
"wan2"
],
"protocol": "dhcp"
}
},
"system": {
"compat_version": "1.1"
}
}
Generated /etc/config/network
file:
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 'fd46:d76f:1b01::/48'
option packet_steering '1'
config device
option name 'br-lan'
option type 'bridge'
list ports 'lan1'
list ports 'lan2'
list ports 'lan3'
list ports 'lan4'
config interface 'lan'
option device 'br-lan'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign '60'
config device
option name 'br-wan'
option type 'bridge'
list ports 'wan1'
list ports 'wan2'
config interface 'wan'
option device 'br-wan'
option proto 'dhcp'
config interface 'wan6'
option device 'br-wan'
option proto 'dhcpv6'
The output of ip link list
(phy0-ap0
and phy1-ap0
are PCIe wireless devices):
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
5: br-lan: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000
link/ether 72:2d:68:c4:37:6f brd ff:ff:ff:ff:ff:ff
6: phy0-ap0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 00:00:00:00:00:49 brd ff:ff:ff:ff:ff:ff
7: phy1-ap0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether f8:5e:3c:1e:57:e3 brd ff:ff:ff:ff:ff:ff
When I remove /etc/board.json
and invoke board_detect
, I get
Cannot parse config file '/etc/fw_env.config': No such file or directory
Failed to find NVMEM device
So what is the problem? How to get network working?