A switch, like a hub, is a device which can connect multiple computers together to share information. In this way, the router acts not only as the connecting point for the computers in your network, but also as the gateway out of your network.
Some routers, it should be mentioned, do not incorporate a switch (the 'single-port' type of router), and these will need to be connected to an external switch along with the rest of your computers if they are to act as a gateway.
Once out of the box, not much needs to be done to set up a router as your gateway. Here's the step-by-step done using an SMC Barricade 4port wired/wireless home router. Depending on the brand, the interface will vary, but all routers should have the same essential configuration options.
Attach your router's power cable Connect your computers to the router's switch ports (the numbered ports) using straight through Enthernet cables. Connect your DSL or cable modem to the 'WAN' port on your router using straight through Ethernet cable. Now that the basic configuration is out of the way, and assuming you set up your clients correctly as explained above, you should be able to connect with the router.
From a web browser, type the default IP address of your router (see your instruction manual for this information) to bring up the configuration screen.

First, change the default password. This is always a good idea, in case your router allows remote administrative connections by default. Now go to the WAN options.

