Understanding VIRBR0-5 minutes a day to play with OpenStack (11)

Source: Internet
Author: User


Virbr0 is a Bridge created by the KVM by default to provide NAT access to the extranet for the virtual machine NIC on which it is connected.

VIRBR0 is assigned an IP 192.168.122.1 by default and provides DHCP services for other virtual network cards that are connected to it.

Below we show how to use Virbr0.

In Virt-manager Open the VM1 configuration interface, the NIC Source device selects "Default", and the VM1 network card is hung on the virbr0.

Start Vm1,brctl Show to see that Vnet0 is already hanging on the virbr0.

# brctl Showbridge name     Bridge ID               STP enabled   &NBSP ; Interfacesbr0             8000.000C298DECBE       No       &NB Sp            ETH0VIRBR0          8000.FE540075DD1A     &NBS P Yes                   vnet0

Use the Virsh command to confirm that the vnet is the VM1 virtual network card.

# Virsh domiflist vm1interface Type Source Model MAC----------------------------------------------------- --vnet0 Network Default rtl8139 52:54:00:75:dd:1a

virbr0 use DNSMASQ to provide a DHCP service that can be viewed in the host to view the process information

# ps-elf|grep dnsmasq

5 S libvirt+  2422     1  0  80   0- 7054 poll_s 11:2 4}        00:00:00/usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf

In the/var/lib/libvirt/dnsmasq/directory there is a default.leases file, when VM1 successfully obtains the DHCP IP, you can view the corresponding information in the file

# cat/var/lib/libvirt/dnsmasq/default.leases1441525677 52:54:00:75:dd:1a 192.168.122.6 ubuntu *

52:54:00:75:dd:1a 's network card, which is the Vnet0 MAC. You can then use that IP to access the VM1.

# ssh 192.168.122.6[email protected] ' s password:welcome to Ubuntu 14.04.2 LTS (GNU /linux 3.16.0-30-generic x86_64) Last Login:sun Sep  6 01:30:23 2015[email protected]:~# ifconfigeth0   &N Bsp  link encap:ethernet  hwaddr 52:54:00:75:dd:1a          inet addr:192.168.122.6  bcast:192.168.122.255  mask : 255.255.255.0          INET6 addr:fe80::5054:ff:fe75:dd1a/64 scope:link       &N Bsp  up Broadcast RUNNING multicast  mtu:1500  metric:1          RX packets:61 errors: 0 dropped:0 overruns:0 frame:0          TX packets:66 errors:0 dropped:0 overruns:0 carrier:0 &nb Sp        collisions:0 txqueuelen:1000          rx bytes:7453 (7.4 KB)  tx bytes:8649 (8.6 KB)

Ping the outside network.

[Email protected]:~# ping Www.baidu.comPING www.a.shifen.com (180.97.33.107), bytes of data.64 bytes from 180.97.33. 107:icmp_seq=1 ttl=52 time=36.9 ms64 bytes from 180.97.33.107:icmp_seq=2 ttl=52 time=119 ms64 bytes from 180.97.33.107: icmp_seq=3 ttl=52 time=88.5 ms64 bytes from 180.97.33.107:icmp_seq=4 ttl=52 time=38.0 ms64 bytes from 180.97.33.107:icmp _seq=5 ttl=52 time=122 ms

No problem, you can access the extranet, which means that NAT is working.

It should be explained that the virtual machine VM1 with NAT can access the extranet, but the extranet cannot directly access the VM1. Because the network packet source address emitted by VM1 is not 192.168.122.6, it is replaced by NAT with the host's IP address.

This is not the same as using BR0, in the case of Br0, VM1 through their own IP directly with the external network communication, will not be NAT address translation.

In the next section we discuss the implementation of VLANs in Linux Bridge.

Understanding VIRBR0-5 minutes a day to play with OpenStack (11)

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.