wiki:experiences:igraltist:kvm-network
=>  Releases

Current version
Git/Latestdiff: 1.5.6

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

GIT
RSBAC source code, can be unstable sometimes

=>  Events

No events planned

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
wiki:experiences:igraltist:kvm-network [2010/04/05 15:02]
127.0.0.1 (old revision restored)
wiki:experiences:igraltist:kvm-network [2011/02/14 13:17]
127.0.0.1 (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"​ +
-bridge="​br0"​+
  
-echo "​Executing /​etc/​kvm/​scripts/​kvm-ifup"​ +import sys 
-echo "​Bringing up ${1} for bridged mode..."​ +import os 
-sudo ${ifconfig} ${1} 0.0.0.0 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 1+    ​try:​ 
 +        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) 
 + 
 + 
 +add_iface_to_bridge()  ​
 </​code>​ </​code>​
  
-You can see this is a shell script.\\ 
-The '​${1}'​ is the argument in the '​ifname'​. \\ 
-In the example above it would replace with '​rsbac'​ otherwise if is was not set '​tap0'​.\\ 
-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. 
  
  
Line 123: Line 124:
  
  
-==== 3. Route Bride ====+==== 3. Route Bridge ​====
  
 Now the network part on host machine have to do. Now the network part on host machine have to do.
Line 204: Line 205:
  
  
-===== Advandce ​Setup =====+ 
 +===== Advance ​Setup =====
 My setup include two bridges. One for the local guests and one for a dmz. My setup include two bridges. One for the local guests and one for a dmz.
 The dmz-bridge i have add in the system-configuration to build on startup. The dmz-bridge i have add in the system-configuration to build on startup.
//
wiki/experiences/igraltist/kvm-network.txt · Last modified: 2011/02/14 13:17 by 127.0.0.1

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