24/7/365 Support

Combining methods

It is possible to combine both the interfaces file and Network Manager methods of network configuration, with each responsible for a portion of the configuration. This technique might be used when certain features are required that only one of the methods support. For example, Network Manager doesn't handle network bridging, and the interfaces file generally can't be used to configure VPN connections. If you needed both, you would set up bridging using the interfaces file and configure your VPN connection using Network Manager.

For those unfamiliar with network bridging, a good example would be a development system that runs one or more virtual machines that require direct access to the network (meaning its connection must behave as if it is an actual interface with a direct network connection).

Note that the host machine now uses br0 instead of eth0 as its primary interface. The bridge interface uses eth0 to connect to the actual network. The VM (Virtual Machine) will set up its own network interface (or you will set it up). These are generally set up as a tap or tunnel interface (hence the name tap0).

To set it up, the basic interfaces file might look like the following listing (assuming the hardware Ethernet card is eth0):
# TAP setup
auto tap0
iface tap0 inet manual
pre-up /usr/sbin/tunctl -t tap0
# Bridge setup
auto br0
iface br0 inet dhcp
bridge_ports eth0 tap0

This sets up a TAP device using the tunctl command to create the device. It must appear before the bridge or it won't be there when the bridge device is initialized and attempts to connect it to the bridge. The bridge setup creates the bridge interface and uses DHCP to obtain the IP address. The bridge_ports line indicates that it bridges traffic to the real interface (eth0) and the tap0 interface, which will be used by the VM. I've left out the loopback entry for clarity. In this example, VPN and wireless connections are left for Network Manager to handle. 

More about network bridging may be found in the bridge-utils package, and network tap and tunnel interfaces are covered by the uml-utilities package.

Help Category:

What Our Clients Say