It will work, just be aware that some cable or DSL modems require you to power cycle the modem every time you change the device which is plugged into its LAN port.
If you wish to plug multiple devices into the modem, you need a router plugged into the modem. A switch will not work.