In a network deployment, a cognitive radio will have to perform two fundamental tasks. First, each cognitive radio needs to optimize its internal operation, and second, it needs to derive a configuration that will enable and optimize communication with other nodes in the network. This latter requirement, however, relies on knowledge about the other nodes' current configuration settings, which needs to be incorporated into this decision-making process. Collecting and distributing such global knowledge is, however, a difficult and costly process, which, in the past, has been approached by introducing a centralized control authority, distributed negotiation policies, or a dedicated coordination channel in the network, each resulting in vulnerability and scaling issues. In this paper, we propose an alternative approach to the global configuration of a cognitive radio network that eliminates the need to collect global network state information and, instead, uses local information for its decision making process. This technique is built upon the principles of swarm intelligence, as seen in schools of fish and flocks of birds, and allows for efficient and robust coordination of a cognitive radio network in a variety of tasks. We have implemented a working prototype showing the feasibility of this technique in two simulation environments and in a hardware testbed, and find that a solution based on swarm intelligence is well suited to interoperate in heterogeneous deployment environments with other control algorithms, requires low computational overhead, and scales with the number of nodes and the amount of spectrum, thus making it a versatile control algorithm for many deployment scenarios.