Gentoo 系統 KVM 橋接 tap 啟動指令碼

來源:互聯網
上載者:User

Gentoo 啟動 init 機制不同於 Debian 和 Redhat, 具體細節尚未總結。

現備份一 KVM tap 啟動指令碼:kvm_net

#!/sbin/runscript# Copyright chencheng use kvm# Distributed under the terms of the GNU General Public License v2# $Header: $user_id=999dev_num=3depend() {    need net.br0    need modules}start() {    ebegin "Start kvm-net"    /sbin/modprobe kvm-intel    #tapx=`tunctl -u nehc|awk '{print $2}'|cut -c 2,3,4,5`    for((i=0;i<${dev_num};i++))    do        tapx=`/usr/bin/tunctl -b -u ${user_id}`        brctl addif br0 ${tapx}        ifconfig ${tapx} promisc up        echo "${tapx} ready now! "    done    eend $?}stop() {    ebegin "Stop kvm-net"    for((i=0;i<${dev_num};i++))    do        brctl delif br0 tap$i        ifconfig tap$i down        tunctl -d tap$i    done    /sbin/modprobe -r kvm-intel    eend $?}restart() {    stop    start}

啟動指令碼不同於普通指令碼在於可以:rc-update add kvm-net 將 kvm-net 加入運行層級

另外,貼一 kvm 指令碼:start_kvm

#!/bin/bash# created by chencheng# use it to start virtual machine # $1 refer machine name# $2 refer tap namekvm -net nic,macaddr=00:00:00:00:00:00 -net tap,ifname=$2,script=no,downscript=no -m 300 /home/nehc/vms/$1/$1.img -daemonize      

這個就簡單啦 ....

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.