centos7 和 Ubuntu server 16爲虛擬化做的一些設置

在虛擬化技術快速發展的今天,我們往往在虛擬機中搭建一套雲平臺,因此虛擬化嵌套支持就不得不開啓,下面講解如何在主流的centos7以及Ubuntu server16操作系統上開啓嵌套虛擬化。同時,修改網卡命名參數爲ethx,以使程序員更易於理解。

Centos7:

  1. 安裝開發工具包
yum groupinstall "Development Tools" -y
yum install net-tools -y
yum install tcpdump -y
yum install vim -y
yum install tree -y
yum install wget -y

2.修改網卡名稱爲eth0

修改/etc/sysconfig/netwok-scripts/ifcfg-xxx
將NAME=eth0
將DEVICE=eth0
修改:vim /etc/default/grub
[root@localhost ~]# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet net.ifnames=0 biosdevname=0"
GRUB_DISABLE_RECOVERY="true"
執行:grub2-mkconfig -o /boot/grub2/grub.cfg 重新生成啓動文件

3.開啓嵌套虛擬化(nested)

執行:cat /sys/module/kvm_intel/parameters/nested輸出爲N,表示不支持嵌套虛擬化
修改:vim /etc/default/grub
[root@localhost ~]# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet net.ifnames=0 biosdevname=0 kvm-intel.nested=1"
GRUB_DISABLE_RECOVERY="true"
執行:grub2-mkconfig -o /boot/grub2/grub.cfg 重新生成啓動文件
reboot
執行:cat /sys/module/kvm_intel/parameters/nested  輸出爲Y,表示嵌套虛擬化已經開啓

Ubuntu Server 16.04:

  1. 安裝開發工具包
sudo apt-get install build-essential -y
sudo apt-get install tree -y
sudo apt-get install wget -y

2.網卡eth0

root@bogon:~# cat /etc/network/interfaces
#This file describes the network interfaces available on your system
#and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
#The loopback network interface
auto lo
iface lo inet loopback
#The primary network interface
auto eth0
iface eth0 inet dhcp
#vim /etc/default/grub 
在”GRUB_CMDLINE_LINUX_DEFAULT”中添加參數net.ifnames=0 biosdevname=0

3.開啓嵌套虛擬化(nested)

執行:cat /sys/module/kvm_intel/parameters/nested輸出爲N,表示不支持嵌套虛擬化
修改:vim /etc/default/grub
[root@localhost ~]# cat /etc/default/grub
GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=2
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="net.ifnames=0 biosdevname=0 quiet splash kvm-intel.nested=1"
GRUB_CMDLINE_LINUX=""
執行:grub-mkconfig -o /boot/grub/grub.cfg 重新生成啓動文件
reboot
執行:cat /sys/module/kvm_intel/parameters/nested  輸出爲Y,表示嵌套虛擬化已經開啓
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章