I am presuming you can fire up macOS Disk Utilities in Recovery Mode (cmd-Opt-R) if you can then open up Terminal from the pull down Utilities menu and enter: dscacheutil -flushcache and press return. Reboot back into Recovery Mode and try connecting again "Reinstall macOS" selection. If it asks you to connect to a particular Network select your modem NOT your mac network.
You might find this helpful: How to Fix Mac Recovery Mode not Working on High Sierra?
Cheers and Good Luck
iMac 27" (late 2013), Airport Time Capsule + Airport Express, iPhone7, iPad6, iPad Mini2
Panasonic Blu-ray PVR DMR-BWT835 + Panasonic Viera TH-L50E6Z, Chromecast Ultra, Yamaha AVR RX-V1085
The difficult we can do immediately. The impossible takes a bit longer. But Miracles you will have to wait for.