Virtual NICs on a VPS: Adding Interfaces, Bridges, and VLANs

What a Virtual NIC Actually Is on a VPS

Inside a KVM guest, every network interface you see is emulated or paravirtualized by the hypervisor. The most common type is virtio-net, a paravirtual driver that exchanges packets with the host through shared memory rings instead of emulating a physical card register by register. Older and slower interfaces emulate e1000 or rtl8139 hardware, which works with any driver but costs far more CPU per packet.

On a fresh instance you typically get one interface with a DHCP lease and a default route. Everything else, extra interfaces, bridges between them, and VLAN tagging, lives above that layer and is handled entirely inside your guest with ordinary Linux networking tools. The hypervisor has no opinion about how you subdivide the guest’s network namespace. That means the work is standard Linux administration rather than a provider-specific feature.

Adding Secondary Interfaces

Many providers let you attach more virtual NICs to the same instance, often without extra cost, each landing on the same or a different subnet. After attaching one at the control panel, the guest sees a new device such as eth1 or ens4. Confirm the driver with a quick check of the device tree and the kernel messages, then bring the interface up with an address consistent with the provider’s addressing plan.

ip -br link show
ethtool -i ens4 | grep driver
ip addr add 10.0.1.15/24 dev ens4
ip link set ens4 up

Two rules matter here. First, confirm the driver is virtio_net; a guest that falls back to an emulated adapter will burn CPU on every packet. Second, check whether the provider assigns addresses by DHCP reservation. If it does, a static address you pick manually may be reclaimed or may route incorrectly after a host migration, so match the provider’s addressing model rather than assuming one.

Building a Bridge Inside the Guest

A Linux bridge lets several interfaces share an L2 broadcast domain. The common use inside a VPS is hosting virtual machines or containers that need to appear on the same network as the host’s primary interface. Create the bridge, enslave the physical interface, and move the IP configuration from the physical interface onto the bridge.

On a cloud instance this only works if the provider permits multiple MAC addresses on your port. Most do not, and a bridge that tries to forward frames from foreign MAC addresses will be dropped by the upstream switch before anything can respond. Verify it with a test guest before building the whole design around it; if it fails, use a routed bridge or NAT instead of a bridged one.

VLAN Tagging Between Guests

VLANs let one physical link carry multiple isolated broadcast domains using 802.1Q tags. Inside a VPS, VLANs are most useful for segmenting traffic between your own virtual machines and containers: a management VLAN, a database VLAN, and a public-facing VLAN can share a single physical link while staying logically separate. You create a VLAN sub-interface on top of the trunk and assign addresses to each sub-interface.

The catch is the same permission problem as bridging. The upstream switch has to accept and pass tagged frames for the VLAN IDs you use, which a shared cloud network almost never allows. VLANs inside a single guest work reliably; VLANs that expect the provider’s network to carry the tags usually do not. Keep tagging inside the host’s virtual network and rely on routing or firewall rules where you need separation that spans machines.

Choosing Addresses and Avoiding Address Conflicts

When you build internal networks for containers and nested guests, pick address ranges that will never collide with the provider’s network or with anything you might reach over a VPN later. The 192.168.0.0/16 and 10.0.0.0/8 ranges are frequently used by home routers and office VPNs, which makes them a poor choice for a machine you will eventually connect remotely. Document the plan in a comment next to the configuration rather than only in your head.

Also avoid assigning the same address to a bridge and to one of its member interfaces. Address duplication on a bridge causes intermittent failures that are difficult to diagnose because connectivity works until something triggers an ARP refresh. Keep the bridge as the single owner of the address and leave member interfaces unnumbered.

Persisting the Configuration Across Reboots

A configuration that lives only in the running kernel disappears on reboot, and on a VPS a reboot can happen without warning during host maintenance. Write the design into the distribution’s network manager: netplan on Ubuntu, systemd-networkd or NetworkManager connections on modern Debian and RHEL derivatives, or ifcfg files on older systems. For a bridge, declare it as a bridge device and list its members; do not try to layer an address on both.

Test by rebooting deliberately while you have console access. A network configuration bug on a headless VPS is an expensive mistake: the provider’s recovery console becomes your only route back in, and some budget providers charge for console sessions or only expose them through a web terminal that is awkward for editing files.

Debugging Common Failures

When an interface exists but carries no traffic, work through the layers in order. Check the link state and the driver, then confirm the interface is in the correct network namespace, then verify the route table and the neighbor table. A surprising number of “broken” secondary interfaces are simply attached to a namespace that the service you are testing does not run in.

If frames leave but nothing returns, suspect the provider’s anti-spoofing or MAC filtering before suspecting your own configuration. Most cloud platforms drop egress packets whose source address is not one assigned to the instance, which silently breaks bridging and many routing designs. Once the interface is up and the addressing model matches the provider’s, the standard VPS networking configuration applies with no special treatment, and a quick throughput test will confirm that the new interface behaves like the original one. Check the published network benchmark figures before and after adding interfaces to be sure the change did not cost you throughput.

Leave a Reply