Network-bridge and ifconfig: Configuring Xen networks on Linux

Learn how to use network-bridge and ifconfig commands with Xen on SUSE Linux Enterprise to control the network bridge and see all available interfaces on your network.

Configuring Xen virtual networks can be quite confusing. The domain 0 operating system shows a lot of network interfaces and it isn't always clear which one is doing what. In this article you'll learn the differences and learn how to do proper analysis and troubleshooting on the virtual network boards.

If your SUSE Linux Xen environment is installed with the default settings, the heart of the network is the virtual bridge. Consider it your physical bridge or switch, virtualized in your server. Communications of all virtual network devices goes through this bridge. SUSE will offer virtual routers and NAT devices as well, but these haven't reached a stable state yet.

Since the virtual network bridge is the heart of your virtual network infrastructure, all network maintenance starts here. This means that you can't use YaST anymore to change the network configuration if the network bridge is up. A simple change of the IP address of the virtual network card in domain 0 means that you have to bring down the virtual network bridge first, the traditional SUSE mechanisms are no longer managing the network now.

Listing 1: Use the network-bridge command to bring the network bridge up and down.
lin:/etc/xen/scripts # ./network-bridge start

eth0 device: Broadcom Corporation NetXtreme BCM5752 Gigabit Ethernet PCI Express (rev 02)

eth0 configuration: eth-id-00:18:8b:bb:f5:40

eth0 IP address: 192.168.1.68/24 (DHCP was already running)

eth0 device: Broadcom Corporation NetXtreme BCM5752 Gigabit Ethernet PCI Express (rev 02)

eth0 configuration: eth-id-00:18:8b:bb:f5:40

Nothing to flush.

Nothing to flush.

Waiting for peth0 to negotiate link.... eth0

eth0 configuration: eth-id-00:18:8b:bb:f5:40

eth0 (DHCP) . IP/Netmask: 192.168.1.68 / 255.255.255.0 

Once the network bridge is up, you'll see a whole bunch of network related interfaces. The best way to show them is by using the ifconfig command as you can see in listing two.

Listing 2: The ifconfig command shows all available network interfaces.
lin:/ # ifconfig

eth0 Link encap:Ethernet HWaddr 00:18:8B:BB:F5:40

inet addr:192.168.1.68 Bcast:192.168.1.255 Mask:255.255.255.0

inet6 addr: fe80::218:8bff:febb:f540/64 Scope:Link

UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1

RX packets:165 errors:0 dropped:0 overruns:0 frame:0

TX packets:38 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:11342 (11.0 Kb) TX bytes:5106 (4.9 Kb)







 

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:140 errors:0 dropped:0 overruns:0 frame:0

TX packets:140 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:11769 (11.4 Kb) TX bytes:11769 (11.4 Kb)







 

peth0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF

inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link

UP BROADCAST RUNNING NOARP MTU:1500 Metric:1

RX packets:151 errors:0 dropped:0 overruns:0 frame:0

TX packets:30 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:10686 (10.4 Kb) TX bytes:4430 (4.3 Kb)

Interrupt:17







 

vif0.0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF

inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link

UP BROADCAST RUNNING NOARP MTU:1500 Metric:1

RX packets:38 errors:0 dropped:0 overruns:0 frame:0

TX packets:165 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:5106 (4.9 Kb) TX bytes:11342 (11.0 Kb)







 

xenbr0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF

inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link

UP BROADCAST RUNNING NOARP MTU:1500 Metric:1

RX packets:132 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:6815 (6.6 Kb) TX bytes:0 (0.0 b) 

Xenbr0 and peth0
The xenbr0 device is the interface that is used to represent the network bridge itself. The network bridge on its turn has to communicate to the physical Ethernet board or boards in your server. This physical board is represented by the peth0 interface. You normally don't manage that directly, since it is just a representation of the physical network board. From the domain 0 environment, what you do need to talk to peth0, is the eth0 interface. This really is the virtualized interface that is used in domain 0. Every virtual machine (domain) has an eth0, and depending on its configuration may have other eth interfaces as well.

Eth0 and vif
The eth0 interface is the interface that is used by the virtual machines, all of these need a representation in domain 0 as well. These are the vif interfaces. The vif interfaces are connected to the Xen bridge directly and they make it possible for a virtual machine to communicate with other machines. All the vif interfaces have a name that looks like vifx.y. In this name, x corresponds to the virtual machine number as displayed with the xm list command and y is the number of the interface within that virtual machine. For instance, if the virtual machine with the ID 1 has two network boards, you would see them as vif1.1 and vif1.2 in the domain 0 machine.

Conclusion
In this article you've read about configuration of virtual network interfaces. We've just covered basics here. In the upcoming SUSE Linux Enterprise Server service pack 2, routing and NAT will most likely be available. There are also some load balancing issues. For instance, in particular environments, it may make sense to use two instead of one virtual bridge to allow for a better operation of the eth-interfaces. These subjects will be covered in future articles that you'll find on this site.

ABOUT THE AUTHOR: Sander van Vugt is an author and independent technical trainer, specializing in Linux since 1994. Vugt is also a technical consultant for high-availability clustering and performance optimization, as well as an expert on SLED 10 administration. 
 

This was first published in March 2008

Dig deeper on Virtual machine provisioning and configuration

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

1 comment

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchVMware

SearchWindowsServer

SearchCloudComputing

SearchVirtualDesktop

SearchDataCenter

Close