BPI-R2 Ethernet MAC address


#21

It actually work in LEDE. Can you try use same MAC in wan and the device under br-lan.


(gary) #22

Hi BoringCat

I don’t think we can use the same MAC address for both wan and br-lan, this may cause switch chip doesn’t work fine.


(Weiqi Chen) #23
$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether ae:fc:de:ad:be:ef brd ff:ff:ff:ff:ff:ff
3: wan@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether ae:fc:de:ad:be:ef brd ff:ff:ff:ff:ff:ff
4: lan0@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether ae:fc:de:ad:be:ef brd ff:ff:ff:ff:ff:ff
5: lan1@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether ae:fc:de:ad:be:ef brd ff:ff:ff:ff:ff:ff
6: lan2@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether ae:fc:de:ad:be:ef brd ff:ff:ff:ff:ff:ff
7: lan3@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether ae:fc:de:ad:be:ef brd ff:ff:ff:ff:ff:ff
$ cat /etc/udev/rules.d/00-static-mac-address.rules
ACTION=="add", SUBSYSTEM=="net", KERNELS=="1b100000.ethernet", RUN+="/sbin/ip link set dev %k address ae:fc:de:ad:be:ef"

I hate this solution, But …

@frank-w


(Frank W.) #24

?? what do you want to say me? :thinking:

that all interfaces are the same mac? it’s because currently only 1 gmac is used between mt7530 (switch) and CPU

see thread about the second GMAC


(Weiqi Chen) #25

I @you because the your solution(BPI-R2 Ethernet MAC address) might not work well for the linux kernel from your github repos.


(Frank W.) #26

currently in debian stretch with my kernel i do it that way:

iface lan0 inet static
  address 192.168.0.10
  netmask 255.255.255.0
  gateway 192.168.0.5
#  pre-up ip link set $IFACE up
  pre-up ip link set $IFACE address 02:01:02:03:04:08 up

but good to know that there is a udev-way to do that


(moore liu) #27

it is ok because lan and wan are different subnet and we only need to make sure the mac address is unique for one subnet.


#28

Yes it is. But just on “Network Layer”. Because all Ethernet port on R2 is actually a mt7530 switch. The switch works on “Data Link Layer”. So If there are two devices have same MAC. It’s chip will not work fine.