A network is a collection of physical or virtual devices connected via switches or routers in order to transmit and receive data.
Before we delve into the differences between switched and routed networks, I’d like to mention that there is a third type of network known as a packet-switched network. Packet switching is distinct from both routed and switched networks, but it is beyond the scope of this article.
You will learn distinctions between switched and routed networks. Typically, switched network is used to describe private networks. Commonly, the routed network is used to describe public networks.
The switched network involves using a device that filters, forwards, or floods frames based on the destination address of each frame. Switches perform their routing functions at the layers 2 models of the OSI. Some switches process data at the Network Layer (layer 3).
These switches are referred to as layer 3 switches or multilayer switches. Switches form integral parts in networking LANs or WANs. Small office and home office (SOHO) applications normally use a single or an all-purpose switch. The network switch is a very adaptable Layer 2 device; it replaces the hub as the central point of connection for multiple hosts.
In a switched network, all of the devices share a single data link, but they communicate with one another directly, typically over a layer 2 interface like Ethernet. The network interface address of each device connected to the network is the same for all connected devices. As a result, every device will have the same logical address when accessed through the network. For instance, if two devices on a network use the same MAC address, the network won’t be able to tell that they are different from one another. The network could distinguish them thanks to their IP addresses.
In a more complex role, a switch may be connected to one or more additional switches to create, manage, and maintain VLAN connectivity and redundant links. No matter how it is being utilised, a switch will process all forms of traffic in the exact same manner.
Switches move traffic based on MAC addresses. Each switch maintains a MAC address table in high-speed memory, called content addressable memory (CAM). The switch recreates this table every time it is activated, using both the source MAC addresses of incoming frames and the port number through which the frame entered the switch.
As mentioned earlier, switches operate at the data-link layer of the OSI model; their function is to create a different collision domain per switch port. Take an example of four computers: PC 1, PC 2, PC 3, and PC 4, attached to switch ports. PC 1 and PC 2 can transfer data between them, so as PC 3 and PC 4, simultaneously without interfering with each other’s conversations. Unlike the hub, which allows bandwidth sharing by all ports, it runs in half-duplex and is prone to collisions of frames and retransmissions.
With some ISPs and other networking environments where there is a need for much analysis of network performance and security, switches may be connected between WAN routers as places for analytic modules. Some switches provide an in-built firewall, network intrusion detection and performance analysis modules that can plug into switch ports.
On the other hand, a routed network is usually only used when a bridged network is unavailable, either due to hosting provider restrictions or because the libvirt server is connected wirelessly to the LAN. Virtual machines (VMs) have their own IP addresses but do not bind directly to them. Instead, packets destined for those addresses are statically routed to the libvirt server and forwarded to VMs (without using NAT).
The devices that form a routed network do not talk to each other directly but are routed through a device called a router. On the outside of the router, usually towards the internet, there is a device called an address resolution protocol, or in the past a name resolution protocol, or in the more technical past a network host address resolution protocol, or in the more modern past a dynamic host configuration protocol. This device provides the address to which data is sent. An address may be an IP address, an email address or a URL, among other things.
Limitations of the Routed Network
Unfortunately, libvirt’s built-in routed network automatically inserts iptables rules whether you want them or not, in an order that is difficult to control. If you would rather be in full control and prevent libvirt from interfering, create a Custom routed network instead.
A routed network is only possible on a dedicated server when there are enough IP addresses to allocate one per VM. This is not a problem for IPv6, as hosting providers usually provide many free IPv6 addresses. However, extra IPv4 addresses are rarely free. If you only have one public IPv4 address (and need to serve clients over IPv4), either buy more IPv4 addresses or create a NAT-based network.