Ubuntu tutorial-create a virtual network card in Ubuntu

Source: Internet
Author: User

This tutorial is intended for users who want to use Ubuntu for small experiments. This does not apply to all users, especially those who use production machines in the official environment.

If you know something about network operations and IP networks, you should know that in most cases, each NIC will only assign one IP address. We are used to think that this is a one-to-one thing.

A network adapter corresponds to an IP address. A network adapter on a machine and its IP address can only be bound to or run a single network service/port. For example, if you want to run a web server on port 80, and an IP address and port number can only be monitored by one web server. This is designed in this way.

Therefore, the relationship between the network adapter and the IP address is not one-to-one. You can create a virtual network adapter that can assign an IP address separately. Therefore, a single physical Nic can cluster unlimited sub-nics or virtual NICs. Each user can assign its own IP address to the corresponding port.

This short tutorial will show you how to do this on Ubuntu. This is a good way to run and test multiple network services on a computer with a physical Nic and a single port number.

Run the following command to open the network interface file.

Sudo gedit/etc/network/interfaces

Then, add any number of virtual NICs you want as per the steps in. By default, Linux assigns the eth0 name to the first Nic, so if your host has only one Nic, it will be named eth0.

Add a virtual network card, create multiple static network cards and name them eth0: 1, eth0: 2, eth0: 3, and so on (eth0 followed by a colon and number ).

Make sure that the network is a different subnet for each network adapter you create. This is a common knowledge of networks)

After that, save the file and run the following command to restart the network service.

Sudo service networking restart

That's it!

Have fun!

Compile a Linux virtual network card to implement NVI-like

Linux driver development: Virtual Network Card for network devices

Implement Virtual Nic in Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.