Advertise with Googlier.compages tagged minipc
https://blog.liw.fi/tag/minipc/
blog.liw.fiikiwikiMon, 22 Aug 2022 04:52:09 +0000A tiny PC as a routerhttps://blog.liw.fi/posts/minipc-router/
https://blog.liw.fi/posts/minipc-router/
minipcrouterTue, 04 Oct 2016 09:56:23 +00002022-08-22T04:52:09Z<p>We needed a router and wifi access point in the office, and
simultaneously both I and my co-worker Ivan needed such a thing at our
respective homes. After some discussion, and after reading articles in
Ars Technica about building PCs to act as routers, we decided to do
just that.</p>
<ul>
<li><p>The PC solution seem to offer better performance, but this is
actually not a major reason for us.</p></li>
<li><p>We want to have systems we understand and can hack. A standard x86
PC running Debian sounds ideal to use.</p></li>
<li><p>Why not a cheap commercial router? They tend to be opaque and
mysterious, and can't be managed with standard tooling such as
Ansible. They may or may not have good security support. Also, they
may or may not have sufficient functionality to be nice things, such
as DNS for local machines, or the full power if iptables for
firewalling.</p></li>
<li><p>Why not OpenWRT? Some models of commercial routers are supported by
OpenWRT. Finding good hardware that is also supported by OpenWRT is
a task in itself, and not the kind of task especially I like to do.
Even if one goes this route, the environment isn't quite a standard
Linux system, because of various hardware limitations. (OpenWRT is a
worthy project, just not our preference.)</p></li>
</ul>
<p>We got some hardware:</p>
<table>
<thead>
<tr>
<th>Component </th>
<th> Model </th>
<th> Cost</th>
</tr>
</thead>
<tbody>
<tr>
<td>Barebone </td>
<td> Qotom Q190G4, VGA, 2x USB 2.0, 134x126x36mm, fanless </td>
<td> 130€</td>
</tr>
<tr>
<td>CPU </td>
<td> Intel J1900, 2-2.4GHz quad-core </td>
<td> -</td>
</tr>
<tr>
<td>NIC </td>
<td> Intel WG82583, 4x 10/100/1000 </td>
<td> -</td>
</tr>
<tr>
<td>Memory </td>
<td> Crucial CT102464BF160B, 8GB DDR3L-1600 SODIMM 1.35V CL11 </td>
<td> 40€</td>
</tr>
<tr>
<td>SSD </td>
<td> Kingston SSDNow mS200, 60GB mSATA </td>
<td> 42€</td>
</tr>
<tr>
<td>WLAN </td>
<td> AzureWave AW-NU706H, Ralink RT3070L, 300M 802.11b/g/n, half mPCIe </td>
<td> 17€</td>
</tr>
<tr>
<td>mPCIe adapter </td>
<td> Half to full mPCIe adapter </td>
<td> 3€</td>
</tr>
<tr>
<td>Antennas </td>
<td> 2x 2.4/5GHz 6dBi, RP-SMA, U.FL Cables </td>
<td> 7€</td>
</tr>
</tbody>
</table>
<p>These were bought at various online shops, including AliExpress and
verkkokauppa.com.</p>
<p>After assembling the hardware, we installed Debian on them:</p>
<ul>
<li><p>Connect the PC to a monitor (VGA) and keyboard (USB), as well as
power.</p></li>
<li><p>I built a "factory image" to be put on the SSD, and a USB stick
<a href="http://files.liw.fi/minipc-router/">installer image</a>, which includes the factory one. Write the
installer image on a USB stick, boot off that, then copy the factory
image to the SSD and reboot off the SSD.</p></li>
<li><p>The router now runs a very bare-bones, stripped-down Debian system,
which runs a DHCP server on eth3 (marked LAN4 on the box). You can
log as root on the console (no password), or via ssh, but for ssh
you need to replace the <code>/home/ansible/.ssh/authorized_keys</code> file
with one that contains only your public ssh key.</p></li>
<li><p>Connect a laptop to the Ethernet port marked LAN4, and get an IP
address with DHCP.</p></li>
<li><p>Log in with ssh to <code>ansible@10.0.0.4</code>, and verify that <code>sudo id</code>
works without password. Except you can't do this, unless you put in
your ssh key in the authorized keys file above.</p></li>
<li><p>Git clone the <a href="http://git.liw.fi/cgi-bin/cgit.cgi/minipc-router/tree/ansible">ansible playbooks</a>, adjust their parameters in
<code>minipc-router.yml</code> as wanted, and run the playbook. Then reboot the
router again.</p></li>
<li><p>You should now have wifi, routing (with NAT), and be generally
speaking able to do networking.</p></li>
</ul>
<p>There's a lot of limitations and problems:</p>
<ul>
<li><p>There's no web UI for managing anything. If you're not comfortable
doing sysadmin via ssh (with or without ansible), this isn't for
you.</p></li>
<li><p>No IPv6. We didn't want to enable it yet, until we understand it
better. You can, if you want to.</p></li>
<li><p>No real firewalling, but adjust <code>roles/router/files/ferm.conf</code> as
you wish.</p></li>
<li><p>The router factory image is 4 GB in size, and our SSD is 60 GB.
That's a lot of wasted space.</p></li>
<li><p>The router factory image embeds our public keys in the <code>ansible</code>
user's authorized keys file for ssh. This is because we built this
for ourselves first. If there's interest by others in using the
images, we'll solve this.</p></li>
<li><p>Probably a lot of stupid things. Feel free to tell us what it is
(bugs@liw.fi would be a good address for that).</p></li>
</ul>
<p>If you'd like to use the images and Ansible playbooks, please do. We'd
be happy to get feedback, bug reports, and patches. Send them to me
(liw@liw.fi) or my ticketing system (bugs@liw.fi).</p>