=>  Releases

Current version
Git/Snapshot: 1.5.3
Release: 1.5.0

Latest Snapshots
Produced after each commit or rebase to new upstream version

RSBAC source code, can be unstable sometimes

=>  Events

No events planned


This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
wiki:experiences:igraltist:kvm-network [2010/11/10 15:42] (old revision restored)
wiki:experiences:igraltist:kvm-network [2011/02/14 13:16] (old revision restored)
Line 53: Line 53:
 Thats all. Thats all.
Line 88: Line 89:
 The content of the script '/​etc/​kvm/​scripts/​kvm-ifup'​ The content of the script '/​etc/​kvm/​scripts/​kvm-ifup'​
 <code bash> <code bash>
-#!/bin/sh +#!/usr/bin/env python
-ifconfig="/​sbin/​ifconfig"​ +
-brctl="/​sbin/​brctl"​ +
-echo "​Executing /​etc/​kvm/​scripts/​kvm-ifup"​ +import sys 
-echo "​Bringing up ${1} for bridged mode..."​ +import os 
-sudo ${ifconfig} ${1} promisc up +from subprocess import call
-echo "​Adding ${1} to bridge ${bridge} ..." +
-sudo ${brctl} addif ${bridge} ${1}+
-# wait a moment +def add_iface_to_bridge():​ 
-sleep +    ​try:​ 
-</​code>​+        iface = sys.argv[1
 +        bridge = os.environ["​bridge_%s"​ % iface] 
 +        cmd = ["​brctl",​ "​addif",​ bridge, iface] 
 +        call(cmd) 
 +        iface_up = ["​ip",​ "​link",​ "​set",​ iface, "​up"​] 
 +        call(iface_up) 
 +    except KeyError, e: 
 +        print str(e)
-You can see this is a shell script.\\ + 
-The '​${1}'​ is the argument in the '​ifname'​. \\ +add_iface_to_bridge()  ​ 
-In the example above it would replace with '​rsbac'​ otherwise if is was not set '​tap0'​.\\ +</​code>​
-Then its use sudo because my guest starts with unprivileged user '​kvm'​ which have in normal case no rights to do adminstrative +
-tasks.\\ +
-This line 'sudo ${brctl} addif ${bridge} ${1}' add the new create '​tap'​ device to the bridge.+
wiki/experiences/igraltist/kvm-network.txt · Last modified: 2011/02/14 13:17 by

wiki/experiences/igraltist/kvm-network.txt · Last modified: 2011/02/14 13:17 by
This website is kindly hosted by m-privacy