
The /usr/lib/systemd/system/getty@.service file is responsible for the virtual terminals (/dev/tty[X]). /usr/lib/systemd/system/serial-getty@.service is responsible for all other terminals, such as a serial terminal on /dev/ttyS0 .
Systemd provides a template unit file for serial getty. Template file can be found here /lib/systemd/system/serial-getty@.service
There are many cloud platforms which are working in Linux virtualisation on back-end. In terms of connectivity we have better option in KVM, which connect it through serial console.
In this post we would see how we could connect Ubuntu17.04 KVM Virtual machine through serial console. I remember in earlier version and distributions, it need to configure serial console in grub file, but in Ubuntu its very easy and reliable as most of configurations and settings are already configured in OS.
let’s see how things happened here …
For this post, we are using Ubuntu-17.04 Guest Machine on Ubuntu-16.04 Host machine.
How to setup serial console, for same we have to connect machine and login on as root user.
We could connect on KVM Guest machine through SSH from Host Machine.
We could connect Guest machine through VNC Viewer and could setup Serial console from there. Configuring and connecting VNC viewer posted here . This could be best option to connect Guest machine in any troubleshooting because it could configure without any network connectivity, this also make it same control which we have in serial console with Graphical User Interface from remote host.
This is Graphical User interface on Host Machine. For this we should have access to Host Machine or Graphical desktop from remote through SSH or VNC.
Above package should installed for this command. Like in below image we could connect KVM Guest machine.
Configure a serial console in the Ubuntu guest
After getting login console we need to start serial console and enable it with below two commands.
Now we could connect serial console in easy way with virsh console command.
以下方法: 在centos6.5也适用
将Open vSwitch安装在Ubuntu或Debian上虽然OVS以程序包的方式出现在Ubuntu或Debian上,但我在此还是通过源代码来构建OVS,这将拥有最新的功能特性和修正版。
首先,安装用于构建OVS的依赖项。
$ sudo apt-get install build-essential libssl-dev linux-headers-$(uname -r)
通过源代码来构建OVS,如下所示。下列步骤将构建OVS内核模块以及OVS用户空间工具。
$ wget http://openvswitch.org/releases/openvswitch-1.9.3.tar.gz
$ tar xvfvz openvswitch-1.9.3.tar.gz
$ cd openvswitch-1.9.3
$ ./configure --with-linux=/lib/modules/`uname -r`/build
$ make
接下来,继续在/usr/local/share/下安装OVS用户空间组件:
$ sudo make install
下一步是,测试OVS内核模块(安装该模块之前)。为此,先在内核中装入内核模块。
$ sudo insmod ./datapath/linux/openvswitch.ko
证实OVS内核模块已成功装入。
$ lsmod | grep openvswitch
openvswitch97934 0
一旦你证实openvswitch.ko已成功装入到内核中,继续安装内核模块,如下所示。
$ sudo make modules_install
配置和启动Open vSwitch
创建一个框架式OVS配置数据库。
$ sudo mkdir /etc/openvswitch
$ sudo ovsdb-tool create /etc/openvswitch/conf.db ./vswit
chd/vswitch.ovsschema
启动OVS数据库服务器。
$ sudo ovsdb-server --remote=punix:/usr/local/var/run/ope
nvswitch/db.sock - remote=db:Open_vSwitch,manager_options
--pidfile --detach
OVS配置数据库初始化。
$ sudo ovs-vsctl --no-wait init
最后,启动OVS守护程序。
$ sudo ovs-vswitchd --pidfile --detach
将KVM安装在Ubuntu或Debian上
使用apt-get命令,安装KVM和必要的用户空间工具。
$ sudo apt-get install qemu-kvm libvirt-bin bridge-utils
virt-manager
将一个普通的非根用户(如alice)添加到libvirtd群组,那样该用户不需要根用户权限,就能启动虚拟机。
$ sudo adduser alice libvirtd
退出,重新以该用户身份登录,让群组成员的变更生效。
运行下面这个命令。如果你看到空空如也的虚拟机列表,这意味着KVM已成功设置完毕。
$ virsh -c qemu:///system list
IdNameState
为KVM配置Open vSwitch
现在是时候创建OVS网桥启动脚本了,那样启动或终止虚拟机时,OVS就能自动配置。
安装依赖项(用户模式Linux实用工具),这些依赖项将用于处理Linux网桥模式。
$ sudo apt-get install uml-utilities
创建网桥启动脚本,如下所示。
$ sudo vi /etc/openvswitch/ovs-ifup
#!/bin/sh
switch='br0'
/sbin/ifconfig $1 0.0.0.0 up
ovs-vsctl add-port ${switch} $1
$ sudo vi /etc/openvswitch/ovs-ifdown
#!/bin/sh
switch='br0'
/sbin/ifconfig $1 0.0.0.0 down
ovs-vsctl del-port ${switch} $1
$ sudo chmod +x /etc/openvswitch/ovs-if*
然后,创建一个默认的网桥br0,并添加一个物理网络接口,虚拟机将通过这个接口与外部网络进行联系。在该教程中,我假设这类网络接口是eth5。
$ sudo ovs-vsctl add-br br0
$ sudo ovs-vsctl add-port br0 eth5
借助KVM启动虚拟机
现在你可以准备启动访客虚拟机了。
我假设,你已经准备好了一个访客虚拟机映像(比如ubuntu-client.img)。使用下面这个命令,启动访客虚拟机。
$ sudo kvm -m 1024 -net nic,macaddr=11:11:11:EE:EE:EE -ne
t tap,script=/etc/openvswitch/ovs-ifup,downscript=/etc/op
envswitch/ovs-ifdown -vnc :1 -drive file=/home/dev/images
/ubuntu-client.img,boot=on
这会创建并启动一个访客虚拟机;一旦访客虚拟机启动,其虚拟接口就自动添加到OVS网桥br0。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)