If you have ever plugged a network cable into a computer, you are familiar with what a physical network interface is like.
Sometimes, it's useful to create "virtual" network interfaces. For example, if you are running multiple virtual servers on a single computer, each virtual server will need a virtual network interface in order to communicate with the network.
You can see a list of all your existing network interfaces with the ip link command:
ip link
Depending on how your computer is configured, you will usually see:
- lo: this is the "loopback" adaptor - it's a virtual network interface that is automatically enabled on all computers.
- eth0: this adaptor typically refers to your ethernet card - that you plug a network cable into for network access.
- wlan0: this adaptor typically refers to your wireless access card
To add a new virtual network interface, type (replace "jamie" with your username):
sudo ip tuntap add dev tap0 mode tap user jamie
Now, re-run:
ip link
And you should see your device.
Before you can use it, you will need to set the state to UP.
sudo ip link set tap0 up
After re-running ip link, you may notice that it still says: "state DOWN"
That's because it's not yet in use.