-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqs.html
238 lines (211 loc) · 10.3 KB
/
qs.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Qemu Script</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="Char">
<!-- Le styles -->
<link rel="stylesheet" href="https://hack-char.github.io/theme/css/bootstrap.dark.css" type="text/css" />
<style type="text/css">
body {
padding-top: 60px;
padding-bottom: 40px;
}
.sidebar-nav {
padding: 9px 0;
}
.tag-1 {
font-size: 20pt;
}
.tag-2 {
font-size: 17pt;
}
.tag-3 {
font-size: 14pt;
}
.tag-4 {
font-size: 12pt;
}
</style>
<link href="https://hack-char.github.io/theme/css/bootstrap-responsive.dark.css" rel="stylesheet">
<link href="https://hack-char.github.io/theme/css/font-awesome.css" rel="stylesheet">
<link href="https://hack-char.github.io/theme/css/pygments.css" rel="stylesheet">
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="https://hack-char.github.io/theme/images/favicon.ico">
<link rel="apple-touch-icon" href="https://hack-char.github.io/theme/images/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://hack-char.github.io/theme/images/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://hack-char.github.io/theme/images/apple-touch-icon-114x114.png">
<link href="https://hack-char.github.io/" type="application/atom+xml" rel="alternate" title="Hack Char ATOM Feed" />
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="https://hack-char.github.io/index.html">Hack Char </a>
<div class="nav-collapse">
<ul class="nav">
<li class="divider-vertical"></li>
<li class="active">
<a href="https://hack-char.github.io/category/cloud.html">
<i class="icon-folder-open icon-large"></i>cloud
</a>
</li>
<li >
<a href="https://hack-char.github.io/category/security.html">
<i class="icon-folder-open icon-large"></i>security
</a>
</li>
<ul class="nav pull-right">
<li><a href="https://hack-char.github.io/archives.html"><i class="icon-th-list"></i>Archives</a></li>
</ul>
</ul>
<!--<p class="navbar-text pull-right">Logged in as <a href="#">username</a></p>-->
</div><!--/.nav-collapse -->
</div>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="span9" id="content">
<section id="content">
<article>
<header>
<h1>
<a href=""
rel="bookmark"
title="Permalink to Qemu Script">
Qemu Script
</a>
</h1>
</header>
<div class="entry-content">
<div class="well">
<footer class="post-info">
<span class="label">Date</span>
<abbr class="published" title="2018-03-17T00:00:00-07:00">
<i class="icon-calendar"></i>Sat 17 March 2018
</abbr>
<span class="label">By</span>
<a href="https://hack-char.github.io/author/char.html"><i class="icon-user"></i>Char</a>
<span class="label">Category</span>
<a href="https://hack-char.github.io/category/cloud.html"><i class="icon-folder-open"></i>cloud</a>.
<span class="label">Tags</span>
<a href="https://hack-char.github.io/tag/vm.html"><i class="icon-tag"></i>vm</a>
<a href="https://hack-char.github.io/tag/qemu.html"><i class="icon-tag"></i>qemu</a>
</footer><!-- /.post-info --> </div>
<p>This will be updated...</p>
<div class="section" id="summary">
<h2>Summary</h2>
<p>Using Qemu from the command line can be a real pain. It either requires very long commands or maintaining many different scripts.
Normally people just use something like libvirt or another set of programs to make it easier. I like doing things the hard way. I prefer
minimizing the amount of programs running in general and especially on a dedicated machine hosting my VMs. This Qemu Script helps do that.</p>
<p>QS is a work in progress. It's at a state where it is very usable, but not well documented. It also requires manually copying files to
install. That was on purpose since it's possible you might blow away your NFTables firewall if you weren't paying attention. In the future
I plan to make a debian package for ease of use.</p>
<div class="section" id="download-and-install">
<h3>Download and Install</h3>
<p>QS is available on GitHub at <a class="reference external" href="https://github.com/Hack-Char/qs">https://github.com/Hack-Char/qs</a></p>
</div>
<div class="section" id="overview">
<h3>Overview</h3>
<p>Qemu Script (QS) has a main Bash script <code>/usr/bin/qs</code> used to start, stop and interact with your virtual machines.
It also tightly interacts with NFTables to allow virtual machines access to each other and/or the Internet. There are a couple
other scripts that can be used as examples to pass virtual-IO PCI devices to your vm - for example <code>/usr/sbin/qs-wifi-before.sh</code>
which will connect my wifi and ethernet devices directly to the vm.</p>
<p>Virtual machines are defined by a storage file as well as characteristics such as the number of CPUs, amount of memory, etc.
VMware solutions rely on OVA (Open Virtual Machine Archive) and OVF (Open Virtual Machine File). The OVF defines characteristics
and is tar'd into an OVA along with the VMDK (Virtual Machine Disk). For QS, the storage is either a qcow2 or raw file and the
characteristics are defined in a file located in <code>${HOME}/.qs</code> or <code>/etc/qs</code>. An example of such a file is:</p>
<pre class="literal-block">
vm debian
cores 2
mem 4
image /var/vm/debian.qcow2
internet 192.168.100.1
</pre>
<p>To use this example VM, it would be started with <code>qs up debian</code>, the memory and cpu usage can be checked with <code>qs info</code>
and if required you can issue an ACPI power down (similar to pushing your power button) using <code>qs down 1</code> (where 1 is the index
of the VM reported by <code>qs info</code>).</p>
</div>
<div class="section" id="creating-a-vm">
<h3>Creating a VM</h3>
<ol class="arabic simple">
<li>Create the disk storage using <code>qemu-img</code></li>
<li>Create the description, for example in <code>${HOME}/.qs/newvm</code></li>
<li>Run the install ISO using <code>qs up newvm bootonce /var/iso/debian-install.iso</code></li>
</ol>
<p>In the future you can just run <code>qs up newvm</code> to boot after the ISO installed.</p>
</div>
<div class="section" id="basic-vm-interaction">
<h3>Basic VM interaction</h3>
<blockquote>
<code>TO DO</code></blockquote>
<p>Using <cite>alt-f1</cite> and other send-key type messages. Introduce using TCP ports for interacting with the VM.
Mention integration into <code>pass</code> password manager.</p>
</div>
<div class="section" id="configuring-for-virtual-io">
<h3>Configuring for Virtual IO</h3>
<blockquote>
<code>TO DO</code></blockquote>
<p>Explain how to find your virt-io groups and the process to figure out which modules need to be
unloaded before reassigning to your VM.</p>
</div>
<div class="section" id="more-things-to-explain">
<h3>More things to explain</h3>
<blockquote>
<code>TO DO</code></blockquote>
<p>Explain qemu group, sudo, auto-boot VM, ARCHITECTURE: nftables, bridge/tap, masquerade</p>
</div>
</div>
</div><!-- /.entry-content -->
</article>
</section>
</div><!--/span-->
<div class="span3 well sidebar-nav" id="sidebar">
<ul class="nav nav-list">
<li class="nav-header"><h4><i class="icon-external-link"></i>blogroll</h4></li>
<li><a href="https://github.com/hack-char"><i class="icon-external-link"></i>Hack Char @ GitHub</a></li>
<li class="nav-header"><h4><i class="icon-home icon-large"></i> social</h4></li>
<li><a href="https://hack-char.github.io/" rel="alternate"><i class="icon-bookmark icon-large"></i>atom feed</a></li>
<li><a href="https://twitter.com/@Hack_Char"><i class="icon-Hack Char @ Twitter-sign icon-large"></i>Hack Char @ Twitter</a></li>
<li class="nav-header"><h4><i class="icon-folder-close icon-large"></i>Categories</h4></li>
<li>
<a href="https://hack-char.github.io/category/cloud.html">
<i class="icon-folder-open icon-large"></i>cloud
</a>
</li>
<li>
<a href="https://hack-char.github.io/category/security.html">
<i class="icon-folder-open icon-large"></i>security
</a>
</li>
<li class="nav-header"><h4><i class="icon-tags icon-large"></i>Tags</h4></li>
</ul> </div><!--/.well -->
</div><!--/row-->
<hr>
<footer>
<address id="about">
Proudly powered by <a href="http://pelican.notmyidea.org/">Pelican <i class="icon-external-link"></i></a>,
which takes great advantage of <a href="http://python.org">Python <i class="icon-external-link"></i></a>.
</address><!-- /#about -->
<p>The theme is based on <a href="http://twitter.github.com/bootstrap/">Bootstrap from Twitter <i class="icon-external-link"></i></a>,
and <a href="http://fortawesome.github.com/Font-Awesome/">Font-Awesome <i class="icon-external-link"></i></a>, thanks!</p>
</footer>
</div><!--/.fluid-container-->
<!-- Le javascript -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://hack-char.github.io/theme/js/jquery-1.7.2.min.js"></script>
<script src="https://hack-char.github.io/theme/js/bootstrap.min.js"></script>
</body>
</html>