Ubuntu 14.10 Creating a virtual network card for bridging networks

Source: Internet
Author: User

Target requirement: Create a virtual network card on Ubuntu host, so that other hosts built in VirtualBox can communicate with each other through the LAN built by the virtual network card.

Step one: Prepare the toolkit

Installing Uml-utilities and Bridge-utils

sudo apt-get install uml-utilities bridge-utils

Step Two: Modify the network configuration file/etc/network/interfaces

sudo cp/etc/network/interfaces/etc/network/interfaces.back #留个备份以备恢复所用

sudo vi/etc/network/interfaces #在后面添加如下内容

Auto Vnet0 #新建网卡vnet0
Iface vnet0 inet Static #设置为静态地址模式
Address 192.168.100.1 #设定 (in a virtual network segment) Native IP
netmask 255.255.255.0 #设置掩码
Bridge_ports None #设置桥接口 (? )
Bridge_maxwait 0 #设置桥接最大等待数 (? )
BRIDGE_FD 1 #?
Up iptables-t nat-i postrouting-s 192.168.100.0/24-j Masquerade #设置 (? )
Down iptables-t nat-d postrouting-s 192.168.100.0/24-j Masquerade #设置 (? )

PS: Belt? Don't know what it means.

Step three: Start the virtual network card

sudo ifup vnet0 #启动之后用 ifconfig to see if the boot was successful, and if the error is noted, the copy error message is Google (if you don't read the wrong message)

Step four: Start IP forwarding

Modify/etc/sysctl.conf Remove this line of comment # Uncomment the next lines to enable packet forwarding for IPV4

Net.ipv4.ip_forward=1

Run the following command to make it effective

Sysctl-p

Step five: Set the network settings for VirtualBox

Link Mode: Bridging mode

Name: Vnet0

PS: Remember to tick cable Connected

Step Six: Configure the virtual machine IP

Enter the virtual machine configuration IP, take Win7 as an example

Set the virtual machine static IP on the same virtual network segment, the gateway is set to the virtual network segment IP of the actual host

Reference:

1. If you want the virtual machine to automatically acquire the virtual segment IP, you need to build additional DHCP server

[Reference Source: http://dngood.blog.51cto.com/446195/720131]

Installing DNSMASQ
Apt-get Install DNSMASQ
Modify/etc/dnsmasq.conf

Remove the following comment
# Include A another lot of configuration options.
#conf-file=/etc/dnsmasq.more.conf
Conf-dir=/etc/dnsmasq.d

Under the/etc/dnsmasq.d/directory, add a file named Wifi-dhcp with the content:
#######################################
Interface=vnet0
dhcp-range=192.168.100.2,192.168.100.254,1h
dhcp-option=option:dns-server,192.168.100.1,208.67.222.222,208.67.220.220
Dhcp-option=option:domain-name,precision-m65

Ubuntu 14.10 Creating a virtual network card for bridging networks

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.