A queueing network with arbitrary topology, state dependent routing and flow control is considered. Customers may enter the network at any queue and they are routed through it until they reach certain queues from which they may leave the system. The routing is based on local state information. The service rate of a server is controlled based on local state information as well. A distributed policy for routing and service rate control is identified that achieves maximum throughput. The policy can be implemented without knowledge of the arrival and service rates. The importance of flow control is demonstrated by showing that, in certain networks, if the servers cannot be forced to idle, then no maximum throughput policy exists when the arrival rates are not known. Also a model for exchange of state information among neighboring nodes is presented and the network is studied when the routing is based on delayed state information. A distributed policy is shown to achieve maximum throughput in the case of delayed state information. Finally, some implications for deterministic flow networks are discussed.