Skip to content

Commit 6f0296d

Browse files
committed
Use u-boot.txt method of changing MAC addresses instead of dhcpcd enter hooks.
1 parent ffd3e4b commit 6f0296d

File tree

1 file changed

+16
-47
lines changed

1 file changed

+16
-47
lines changed

docs/advanced/network.md

Lines changed: 16 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,10 @@ It allows network switches to learn where traffic should be routed to.
155155
It can be thought of like an IP address but statically assigned to hardware and only relevant within your local network.
156156

157157
Much like IP addresses, MAC addresses have to be unique for the network to function properly,
158-
but unlike IP addresses, they cannot be dynamically assigned by a DHCP server, MAC addresses are static by design.
159-
Most vendors work around this problem by shipping their products with a random MAC address from the factory.
160-
The idea being the sheer number of MAC addresses being randomly assigned
161-
means the chance of the same MAC address being used in the same local network and causing a conflict is very low.
158+
but unlike IP addresses, they cannot be dynamically assigned by a DHCP server, MAC addresses are static by design.
162159

163-
Some operating systems like [Mr Fusion](../setup/software.md#flash-mr-fusion-to-your-microsd)
164-
will randomize the MiSTers MAC address during setup while other installers will use the same MAC address everytime.
160+
Some installers like [Mr Fusion](../setup/software.md#flash-mr-fusion-to-your-microsd)
161+
will randomize the MiSTers MAC address during setup, but others will use the same MAC address everytime.
165162
Therefore, it is common that two or more MiSTers will have the exact same MAC address on their onboard ethernet port.
166163

167164
If two MiSTers with the same MAC address are on the same network at the same time,
@@ -172,52 +169,24 @@ Fortunately, if this is the case, it's possible to override the default MAC addr
172169
From the MiSTers startup menu, press ++F9++ to get a Linux terminal then
173170
login as root (see [Network Access](#network-access) for the default credentials).
174171

175-
#### Check MAC address
176-
Remove the cord from your MiSTers built-in ethernet if there is one attached
177-
then run the command `ip link` by typing it and pressing ++Enter++.
178-
You should get a result somewhat like this:
172+
#### Change MAC address
173+
Open u-boot.txt file for editing by running the command `nano /media/fat/linux/u-boot.txt`
174+
by typing it and pressing ++Enter++.
175+
The file should contain a line that looks somewhat like this:
179176
```
180-
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
181-
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
182-
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
183-
link/ether 02:03:04:05:06:07 brd ff:ff:ff:ff:ff:ff permaddr 02:03:04:05:06:07
177+
ethaddr=EA:C8:21:56:E3:43
184178
```
185-
`eth0` should be the built-in ethernet on the DE-10 nano while `link/ether` is the currently assigned MAC address
186-
and `permaddr` is the hardware default MAC address if no other is given.
187179

188-
Repeat these first two steps on all you MiSTers and continue on each one that has the same `link/ether` as another.
189-
190-
#### Override MAC address
191-
> Let's assume you want the network interface named `eth0` to be assigned a MAC address of `01:02:03:04:05:06`.
192-
Replace these values with the conflicting network interface name you saw in the previous step
193-
and the MAC address you want to set it to.
194-
You can choose any MAC address you like, so long as it is **not** used by **any** other device.
195-
>
196-
> A valid MAC address is six sets of two digits between `01` and `fe` each seperated by a `:` character.
197-
198-
Run the command `nano /etc/dhcpcd.enter-hook` to edit or create the file then write the following
199-
```
200-
if [ "$interface" = "eth0" ]; then
201-
ip link set dev "$interface" address 01:02:03:04:05:06
202-
fi
203-
```
180+
Edit the MAC address so that no MiSTers on your network share the same address.
181+
MAC addresses are made up of six sets of two characters that range between `00`-`FF` and are seperated by `:`.
182+
When changing the MAC address, avoid these addresses that have special meaning:
204183

205-
Once done, press ++Ctrl+o++ to make `nano` save `dhcpcd.enter-hook` then ++Ctrl+x++ to exit `nano`.
206-
Run the command `reboot` to restart the MiSTer back to the startup menu with the new network settings applied.
184+
* Any address that start's with `00`, `01`, `02`, `03`, `06` or `0A`
185+
* Broadcast (`FF:FF:FF:FF:FF:FF`)
186+
* All zeros (`00:00:00:00:00:00`)
207187

208-
#### Verify the new MAC address applied
209-
Login to root on the Linux terminal the same way you did before and run the command `ip link` again.
210-
You should get a result somewhat like this:
211-
```
212-
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
213-
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
214-
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
215-
link/ether 01:02:03:04:05:06 brd ff:ff:ff:ff:ff:ff permaddr 02:03:04:05:06:07
216-
```
217-
`link/ether` should be the same MAC address you set in `/etc/dhcpcd.enter-hook`.
218-
If it is, you can now reattach the cord to this MiSTers built-in ethernet.
219-
In the unlikely event that the new MAC address you chose conflicts with another device on your network
220-
then replace that MAC address in `dhcpcd.enter-hook` with another random MAC address and `reboot` again.
188+
Once done, press ++Ctrl+o++ to make `nano` save `u-boot.txt` then ++Ctrl+x++ to exit `nano` then
189+
run the command `reboot` to restart the MiSTer back to the startup menu with the new MAC address applied.
221190

222191
### Hostname configuration
223192
`dhcpcd` can be configured so that MiSTer offers its preferred name to your DHCP server, but it's disabled by default.

0 commit comments

Comments
 (0)