#!/bin/bash # Bring up a virtual ethernet device pair. . /etc/init.d/functions cd /etc/sysconfig/network-scripts . ./network-functions [ -f ../network ] && . ../network CONFIG=${1} need_config "${CONFIG}" source_config if ! ip link show dev ${DEVICE} >/dev/null 2>&1 ; then echo "Creating veth pair ${DEVICE} - ${PEER_DEVICE}" ip link add dev ${DEVICE} type veth peer name ${PEER_DEVICE} if [[ $? -ne 0 ]]; then echo "Failed creating veth pair" exit 1 fi fi ./ifup-eth ${CONFIG} ${2} ./ifup-eth ifcfg-${PEER_DEVICE} ${2}