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 14:53]
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 122: Line 123:
  
  
-==== 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 156: Line 158:
  
 === Guest Network === === Guest Network ===
 +On your guest set the ip address to the bridge network.\\
 +For example:
 +<code bash>
 +ifconfig eth0 192.168.100.2 netmask 255.255.255.0 up
 +</​code>​
 +and add a default gateway.
 +<code bash>
 +route add default gw 192.168.100.1
 +</​code>​
 +The last is to set a nameserver.\\
 +Open your editor on your terminal and add if your host machine nameserver as the same in your host machine.\\
 +When the host machine has nameserver '​192.168.1.1'​ add this to '/​etc/​resolv.conf'​ in your guest too.
 +<code bash>
 +nameserver 192.168.1.1
 +</​code>​
 +Now you can try to ping for expamle:
 +<code bash>
 +ping rsbac.org
 +</​code>​
 +If your get a response than all basic setup is done.\\
 +Now your have to put all in some script for automatic configuration.\\
 +And see how your distribution setup bridges and network interface in general way.
 +
 +
 +
 +
 +
 +
  
  
Line 176: Line 206:
  
  
-===== 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