From the outside, only your public IP address is visible. A DDoS is sent to this public IP, which is your modem. If your modem passes this to the router, your router then has to decide if it sends this to a device in its network, or disregard the package.
In any case, it really depends on the hardware which of all these is going to fail first.
It is possible the modem fails first, then packets don't come in at all, and are stopped at the modem.
Its possible the router is weaker, so the modem relays the packets, and the router fails. It depends on how the router fails if the treshold for the modem is reached or not, but its possible the modem will fail after the router fails.
Its also possible a specific port is targetted, and the device behind it fails.
An attacker has to commit resources to do such attack, so they will likely stop once they see that whatever they're targetting is no longer responding. By that reasoning, if any of the devices in this loop fails, the attacker may stop and the other devices may be kept alive.
How can you prevent an attack like this? Have a modem that is capable of identifying an attack and then discarding it entirely without being affected.
NB: It's possible you have a modem/router device, one device that does both. In that case you would need a modem/router that is capable of stopping a DDoS attack, or add a modem to the signal that can do so.
In addition, keep in mind, that if an attacker wants your network down, you need expensive equipment with fall-over policies to deal with a DDoS. This solution is something you will not want in a home situation. You may want to look into the quickest way to recover from a DDoS attack, which is something that can identify the DDoS, and reset the system.
Final note: It's unlikely for a home user to be attacked like this, and performing a DDoS is illegal. It is likely that you know who will have performed the DDoS attack, so it is a far better idea to take legal actions after it was done, so it happens once and never again. For that, make sure you have sufficient evidence.
Hosting public-facing servers from a home internet connection is usually a bad idea. You'd be better off renting out a server machine elsewhere. – MoonRunestar – 2018-05-11T11:15:15.223
1@Sonickyle27- Why? You can protect your connection, I only want to know if your modem gets effected when your router is being attacked. – R_ Flintstone – 2018-05-11T12:21:23.757