I'm working with a nanopi r5c which doesn't have static MACs.
No problem, I make my own up and set them using UCI.
# uci set network.@device[0].macaddr="11:22:33:44:55:61"
# uci set network.@device[2].macaddr="11:22:33:44:55:62"
# uci commit network
I look at the /etc/config/network file and it has my MAC addresses, great.
I look at ifconfig and the MAC addresses are the random ones generated by the os on boot.
I use /etc/init.d/network restart and a new set of MAC addresses are shown in ifconfig, even though mine are set in the network file.
What am I doing wrong?
mk24
February 17, 2024, 8:23pm
2
It should be noted that the second digit of a MAC can't be 1-- it needs to be even, and if it is a locally created MAC it should be 2, 6, A, or E.
Do these device sections refer to the correct devices?
1 Like
Hi,
I just made those up for the post :).
Here is how things look;
# uci set network.@device[0].macaddr="93:4e:d9:cd:be:5c"
# uci set network.@device[2].macaddr="93:4e:d9:cd:be:5d"
# uci commit network
# cat /etc/config/network
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 'fd00:ab:cd::/48'
config device
option name 'eth0'
option macaddr '93:4e:d9:cd:be:5c'
config interface 'wan'
option device 'eth0'
option proto 'dhcp'
config interface 'wan6'
option device 'eth0'
option proto 'dhcpv6'
config device
option name 'br-lan'
option type 'bridge'
list ports 'eth1'
config device
option name 'eth1'
option macaddr '93:4e:d9:cd:be:5d'
config interface 'lan'
option device 'br-lan'
option proto 'dhcp'
# ifconfig
br-lan Link encap:Ethernet HWaddr 96:ED:C9:9C:4C:7B
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
eth0 Link encap:Ethernet HWaddr 1E:FB:5C:C2:E8:CF
inet addr:192.168.192.129 Bcast:192.168.192.255 Mask:255.255.255.0
inet6 addr: fe80::1cfb:5cff:fec2:e8cf/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:46896 errors:0 dropped:0 overruns:0 frame:0
TX packets:55837 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9829080 (9.3 MiB) TX bytes:4721425 (4.5 MiB)
eth1 Link encap:Ethernet HWaddr 96:ED:C9:9C:4C:7B
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:23461 errors:0 dropped:0 overruns:0 frame:0
TX packets:23461 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1851584 (1.7 MiB) TX bytes:1851584 (1.7 MiB)
If I restart the network, I get new random MAC's each time.
mk24
February 17, 2024, 9:21pm
4
LarryPowel:
macaddr="93:
Three is an odd number. That 3 has to be replaced with a not odd number as I said in the post above. You can choose all the other numbers in a MAC at random any number from 0-F except the second digit where you have a 3.
mk24:
It should be noted that the second digit of a MAC can't be 1-- it needs to be even, and if it is a locally created MAC it should be 2, 6, A, or E.
Yes, I took that into account but was showing you the current output. I'll update that now and see what happens.
That's interesting. I never knew that about MAC addresses.
Looks like that's where I was going wrong as now it seems it's working.
Thanks so much for your input! I was really getting confused over this one.
# cat /etc/config/network
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 'fd00:ab:cd::/48'
config device
option name 'eth0'
option macaddr '92:4e:d9:cd:be:5c'
config interface 'wan'
option device 'eth0'
option proto 'dhcp'
config interface 'wan6'
option device 'eth0'
option proto 'dhcpv6'
config device
option name 'br-lan'
option type 'bridge'
list ports 'eth1'
config device
option name 'eth1'
option macaddr '92:4e:d9:cd:be:5d'
config interface 'lan'
option device 'br-lan'
option proto 'dhcp'
# ifconfig
br-lan Link encap:Ethernet HWaddr 92:4E:D9:CD:BE:5D
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
eth0 Link encap:Ethernet HWaddr 92:4E:D9:CD:BE:5C
inet addr:192.168.192.126 Bcast:192.168.192.255 Mask:255.255.255.0
inet6 addr: fe80::904e:d9ff:fecd:be5c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1294 errors:0 dropped:0 overruns:0 frame:0
TX packets:1269 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:493661 (482.0 KiB) TX bytes:121610 (118.7 KiB)
eth1 Link encap:Ethernet HWaddr 92:4E:D9:CD:BE:5D
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:380 errors:0 dropped:0 overruns:0 frame:0
TX packets:380 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:41916 (40.9 KiB) TX bytes:41916 (40.9 KiB)
system
Closed
February 27, 2024, 9:55pm
7
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.