Network troubleshooting for DCC-EX
Why a WiFi command station stops answering after a router reboot, how to find it again, and how to stop it happening a third time.
A DCC-EX command station on WiFi works perfectly for months, then one day nothing can connect to it. Nothing has been touched. The trains worked last weekend.
Almost always, its IP address changed.
Why it happens
The command station asks the router for an address by DHCP. That address is a lease — held for a period, then renewed. Renewal normally returns the same address, so it looks permanent.
Then something interrupts the pattern: the router reboots after a power cut or firmware update, the command station is off for longer than the lease, or enough other devices join that the router reshuffles its pool. A different address comes back.
Everything pointing at the old address — Rocrail’s controller settings, a throttle app, a browser bookmark — now points at nothing. Or, occasionally, at some other device entirely, which is a considerably more confusing morning.
Confirm that’s what it is
Before hunting for the address, establish that the command station is alive:
- Is it powered, and are its LEDs behaving as usual?
- Does it work over USB? Plug into it, open a serial terminal at 115200 baud, and send
<s>. If it reports its status, the command station is fine and this is purely a network problem. - Do other things on the same WiFi still work? If not, the problem is the network, not the railway.
Find it again
The fastest method is mDNS discovery, which asks the local network what is out there rather than scanning for it: Finding your command station with avahi-browse.
Failing that:
- Look at the router. Its DHCP client list shows every device and its current address. Look for something named after the microcontroller, or an unfamiliar manufacturer.
- Ask the command station. Over USB, DCC-EX reports its network details on startup. Reset it with a serial terminal attached and read what it prints.
- Scan the network.
nmap -sn 192.168.1.0/24lists responding hosts. Blunt, but effective when the subtler methods fail.
Stop it happening again
Finding the address is the fix for today. These are the fixes for good.
Reserve a DHCP lease (recommended)
In the router, tie the command station’s MAC address to a fixed IP. It still uses DHCP, so there is nothing to configure on the command station, but it always gets the same address.
This is the right answer for almost everybody: one setting, in one place, and it survives firmware updates on the command station.
Use the mDNS name instead of the address
If the command station advertises itself over mDNS, you can refer to it by a .local name that
follows it across address changes.
Convenient, but less reliable than it sounds — mDNS resolution varies by client, and some Android versions and some Windows configurations handle it poorly. Fine as a convenience, not something to depend on mid-operating-session.
Set a static IP on the device
Configure the address in the command station’s own configuration rather than asking the router.
It works, but it moves the setting to the place you are least likely to remember, and you must pick an address outside the router’s DHCP pool or you will eventually get a conflict. Prefer the reservation.
Every minute spent finding the command station again is a minute you will spend again next time. The reservation takes two minutes once.
Related faults worth ruling out
Connects, then drops. Usually another client holding the connection — DCC-EX supports a limited number of simultaneous network clients. Close every throttle app and try again.
Works close to the layout, not across the house. Signal strength. Microcontroller WiFi aerials are small, and a baseboard is often the far corner of the house from the router.
Works, but sluggish. 2.4GHz congestion. Most microcontrollers cannot use 5GHz, so they are sharing a band with everything else in the neighbourhood.
Where to go next
- Finding your command station with avahi-browse
- Rocrail and DCC-EX — where the address gets configured