What is the use of a router and how is it different from a gateway?