<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>howto — LowEndSpirit</title>
        <link>https://staging.lowendspirit.com/index.php?p=/</link>
        <pubDate>Sat, 11 Apr 2026 18:52:14 +0000</pubDate>
        <language>en</language>
            <description>howto — LowEndSpirit</description>
    <atom:link href="https://staging.lowendspirit.com/index.php?p=/discussions/tagged/howto/feed.rss" rel="self" type="application/rss+xml"/>
    <item>
        <title>How to Create and Setup a Debian KVM VPS with Proxmox VE 6 -- Part III -- Network Configuration</title>
        <link>https://staging.lowendspirit.com/index.php?p=/discussion/3933/how-to-create-and-setup-a-debian-kvm-vps-with-proxmox-ve-6-part-iii-network-configuration</link>
        <pubDate>Fri, 23 Jul 2021 12:00:00 +0000</pubDate>
        <category>LES Talk</category>
        <dc:creator>Not_Oles</dc:creator>
        <guid isPermaLink="false">3933@/index.php?p=/discussions</guid>
        <description><![CDATA[<p><em>Written by <a href="https://staging.lowendspirit.com/index.php?p=/profile/Not_Oles" rel="nofollow">@Not_Oles</a>, 23 Jul 2021</em><br />
<small>Article was migrated from WordPress to Vanilla in March 2022</small></p>

<p>
  <img src="https://talk.lowendspirit.com/uploads/editor/n9/cixat1djj0ag.png" alt="image" />
</p>

<h2>I. Before We Start</h2>

<p>We need to obtain our basic network configuration from our provider. Or, if we are running our own host node, we need to assign basic network configuration to ourselves. Our basic network configuration might look something like this:</p>

<table>
<thead>
<tr>
  <th><strong>Item</strong></th>
  <th><strong>Value</strong></th>
</tr>
</thead>
<tbody>
<tr>
  <td>IPv4 address</td>
  <td>172.16.165.97/28</td>
</tr>
<tr>
  <td>Netmask</td>
  <td>255.255.255.240</td>
</tr>
<tr>
  <td>Broadcast</td>
  <td>172.16.165.111</td>
</tr>
<tr>
  <td>Gateway</td>
  <td>172.16.164.1</td>
</tr>
</tbody>
</table>

<p>For IPv6, one might expect something like:</p>

<table>
<thead>
<tr>
  <th><strong>Item</strong></th>
  <th><strong>Value</strong></th>
</tr>
</thead>
<tbody>
<tr>
  <td>IPv6 address</td>
  <td>fe80::/64</td>
</tr>
</tbody>
</table>

<p>But occasionally, IPv6 could be something like:</p>

<table>
<thead>
<tr>
  <th><strong>Item</strong></th>
  <th><strong>Value</strong></th>
</tr>
</thead>
<tbody>
<tr>
  <td>IPv6 address</td>
  <td>fe80:xxxx:xxxx:xxxx::97/128</td>
</tr>
<tr>
  <td>Gateway6</td>
  <td>fe80:xxxx:xxxx:xxxx::3</td>
</tr>
</tbody>
</table>

<p>Notes:</p>

<ul>
<li>The /28 in the IPv4 address and the longer netmask are <a rel="nofollow" href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#:~:text=CIDR%20notation%20is%20a%20compact,bits%20in%20the%20network%20mask.">different ways of providing the same information about the size of the local, directly connected network.</a> It suffices for us to have this information in one format or the other. We don't need both formats because the information is the same. Also, the broadcast IP might not be provided, since it isn't strictly necessary.</li>
<li>For the second format of the IPv6 address, <strong>what happened to the /64</strong>? 😱 The /128 in the second form of the IPv6 address might seem <strong><em>clueless</em></strong> to IPv6 fans expecting a /64. Also, the second format of the IPv6 address includes a gateway6 address. The gateway6 address might seem strange to some IPv6 fans, but we need the gateway6 for our minimal, static configuration. More on all this below.</li>
</ul>

<h2>II. Introduction</h2>

<p>In <a rel="nofollow" href="https://lowendspirit.com/how-to-create-and-setup-a-debian-kvm-vps-with-proxmox-ve-6-part-ii-debian-install/">the previous post of this series</a> we finished using the Proxmox web GUI to install our new Debian KVM VPS via the <a rel="nofollow" href="https://www.debian.org/CD/netinst/">Debian netinst installer iso image.</a> The final step in Part II was removing the netinst install iso image from the emulated cdrom and then reooting our new VM, which came up from its own internal filesystem:</p>

<p><img src="https://talk.lowendspirit.com/uploads/editor/hs/2qx8afaew937.png" alt="" title="" /></p>

<p>In today's post, we continue from this exact place where we left Part II -- connected to our newly installed and newly rebooted KVM via the Proxmox web GUI. In this post, we will accomplish the networking configuration which was skipped in Part II because the <a rel="nofollow" href="https://talk.lowendspirit.com/discussion/comment/63101/#Comment_63101">Debian netinst iso doesn't automatically configure out of band IP addresses.</a></p>

<p>There are three network configuration and related tasks we will accomplish today:</p>

<ul>
<li>First, we go "inside" our VM through the Proxmox web GUI's emulated "physical" console connection and set up networking. In Debian, networking setup requires that we adjust the file /etc/network/interfaces to tell our VM its network address and the address of its gateway to the internet.</li>
<li>Second, we edit the file /etc/resolv.conf to tell our VM the numerical addresses of <a rel="nofollow" href="https://en.wikipedia.org/wiki/Domain_Name_System">Domain Name System ("DNS")</a> servers it can use to translate human readable <a rel="nofollow" href="https://en.wikipedia.org/wiki/Uniform_Resource_Identifier">Uniform Resource Identifiers (URI)</a> into numerical <a rel="nofollow" href="https://en.wikipedia.org/wiki/IP_address">Internet Protocaol ("IP") addresses.</a></li>
<li>Third, we set up /etc/apt/sources.list to tell our system's <a rel="nofollow" href="https://www.debian.org/doc/manuals/debian-faq/uptodate.en.html">Aptitude software package manager ("APT")</a> where to get software updates and the additional software packages we will want to install.</li>
</ul>

<p>Section III, Quick Setup, runs quickly through all three of today's tasks in "recipe style."</p>

<p>Section IV offers additional context on our setup environment.</p>

<p>Sections V, VI, and VII provide additional details on today's three setup tasks.</p>

<p>Section VIII discusses security.</p>

<p>Section IX discusses backup.</p>

<p>When we finish the Quick Setup, our new Debian KVM VPS should be connected to the internet, DNS should work, and we should be able to use the Debian package system to add whatever additional software we want.</p>

<p>When we finish all of today's post, we should have reasonable context within which to understand our Debian VM's networking setup.</p>

<h2>III. Quick Setup</h2>

<p>Logged into our VM through the Proxmox web GUI, we run the command <code>ip link show</code>. This command will give us the name of our network interface, probably something like "ens18."</p>

<p>As root or with <code>sudo</code>, we edit the text of the file /etc/network/interfaces so that it contains the minimum necessary information:</p>

<pre><code>auto ens18
iface ens18 inet static
  address IPv4_ADDRESS/CIDR
  gateway GATEWAY_ADDRESS

iface ens18 inet6 static
  address IPv6_ADDRESS/CIDR
  gateway GATEWAY6_ADDRESS
</code></pre>

<p>Using our example network configuration, our minimal /etc/network/interfaces looks like this:</p>

<pre><code>auto ens18
iface ens18 inet static
  address 172.16.165.97/28
  gateway 172.16.164.1

iface ens18 inet6 static
  address fe80:xxxx:xxxx:xxxx::97/128
  gateway fe80:xxxx:xxxx:xxxx::3
</code></pre>

<p>Second, we edit the /etc/resolv.conf file so that it looks like this:</p>

<pre><code>nameserver 1.1.1.1
nameserver 8.8.8.8
nameserver 2606:4700:4700::1111
nameserver 2001:4860:4860::8888
</code></pre>

<p>Third, we edit /etc/apt/sources.list so that it looks like this:</p>

<pre><code>deb http://deb.debian.org/debian buster main contrib non-free

deb http://deb.debian.org/debian-security/ buster/updates main contrib non-free

deb http://deb.debian.org/debian buster-updates main contrib non-free
</code></pre>

<p>Finally, we restart networking so that our new configuration takes effect:</p>

<pre><code>systemctl restart networking
</code></pre>

<p>At this point, we should have both IPv4 and IPv6 connectivity, and DNS and APT both should work.</p>

<h2>IV. More Context</h2>

<ul>
<li><strong>Virtualized Console Connection</strong></li>
</ul>

<p>The Proxmox web GUI virtualizes a wired console connection. In other words, our web browser does connect over the internet to our Proxmox server, but, the view from inside our new KVM is the same as though a wired connection was attached. Our new KVM thinks it's talking over a wired connection to a physical console. From inside our new KVM, there is, as yet, no network connection.</p>

<p>By default, the Proxmox web GUI works via <a rel="nofollow" href="https://en.wikipedia.org/wiki/Virtual_Network_Computing">VNC.</a> <a rel="nofollow" href="https://pve.proxmox.com/wiki/Serial_Terminal">In the Proxmox wiki on serial terminal</a> Proxmox warns that VNC might</p>

<blockquote><div>
  <p>not have the features you need (i.e. easy copy/paste between other terminals)</p>
</div></blockquote>

<p>or it might be</p>

<blockquote><div>
  <p>impossible to capture all &#91;kernel messages, standard output, or error&#93; messages on &#91;the&#93; VNC screen.</p>
</div></blockquote>

<p>Yep, copy / paste commands <a rel="nofollow" href="https://forum.proxmox.com/threads/copy-paste-keys-commands-for-ct-kvm-vnc-console.28037/">do not seem to work in the Proxmox KVM virtual console.</a></p>

<p>Also, if you enjoy using the vi editor, you might find what looks like a "Send-Esc" button among the set of choices within the set exposed by the top button on the console VNC control bar. Use of the real keyboard Escape key results in exiting full screen. However, a second real Esc seems to produce the expected mode change, despite that maybe we no longer can see too well without returning to full screen.</p>

<ul>
<li><strong>No DHCP, No SLAAC</strong></li>
</ul>

<p>These days most network setups use <a rel="nofollow" href="https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol">Dynamic Host Configuration Protocol (DHCP)</a> to autoconfigure IPv4 networking. The machine on which networking is to be configured asks for and receives from a DHCP server all the needed information for the networking setup.</p>

<p>It is possible to configure DHCP so that it always returns the same IP address to each VM, but, since our entire Proxmox network is static, it may be simpler to set up networking manually--the traditional way for servers.</p>

<p><a rel="nofollow" href="https://en.wikipedia.org/wiki/IPv6#Stateless_address_autoconfiguration_(SLAAC)">Stateless Address Autoconfiguration ("SLAAC")</a> provides automatic configuration of IPv6 addresses. SLAAC requires a /64, which is why people say, for IPv6, that a /64 is expected and that less than a /64 is <em>clueless.</em> However, it remains possible to hand configure a single static IPv6 address, as we are doing here.</p>

<p>What if, for whatever reason, we simply do not want to use SLAAC? What if our provider doesn't receive enough IPv6 addresses from <em>his</em> provider to allow passing on to each VPS its own /64? What if our provider's provider charges an extra fee for extra IPv6 addresses, but we do not want to pay our provider's pass through of his provider's extra fee? What if we simply choose to use single, static IPs as is traditional for servers?</p>

<ul>
<li><strong>No Cloud-Init</strong></li>
</ul>

<p>As mentioned in <a rel="nofollow" href="https://lowendspirit.com/how-to-create-and-setup-a-debian-kvm-vps-with-proxmox-ve-6-part-ii-debian-install/">the previous post of this series,</a> most VM network setups these days are done with <a rel="nofollow" href="https://github.com/canonical/cloud-init">Cloud-Init.</a> Proxmox <a rel="nofollow" href="https://pve.proxmox.com/wiki/Cloud-Init_Support">supports Cloud-Init,</a> which enables both networking and ssh access to virtual machines to be set up on the Proxmox hypervisor and outside of the VM. Cloud-init can use DHCP. Here, however, we have chosen the simplest possible manual configuration with static IPs.</p>

<ul>
<li><strong>Our Static, Routed Configuration And Out of Band Gateway From Our Provider's Provider</strong></li>
</ul>

<p>Here, our single, static IPv4 and single, static IPv6 are each derived from a <a rel="nofollow" href="https://en.wikipedia.org/wiki/Routing">routed subnet</a> assigned to our server node. However, our internet gateway IPv4 address is not included among our server's routed group of IPv4s. This is called an "out of band" gateway.</p>

<p>Besides routed subnets, it also is possible for a datacenter to assign to servers non-routed, individual IP addresses. Data for these non-routed IPs moves between the datacenter switch and server nodes via <a rel="nofollow" href="https://en.wikipedia.org/wiki/Network_layer">the "link layer."</a> Hetzner has a <a rel="nofollow" href="https://docs.hetzner.com/robot/dedicated-server/network/net-config-debian/">tutorial on Debian network configuration</a> which includes discussion of "bridged configuration" for non-routed IPs.</p>

<ul>
<li><strong>Systemd in Debian Networking</strong></li>
</ul>

<p><a rel="nofollow" href="https://lwn.net/Articles/585319/">Since about 2014,</a> networking is setup on Debian with <a rel="nofollow" href="https://en.wikipedia.org/wiki/Systemd">systemd.</a> The choice of systemd <a rel="nofollow" href="https://lwn.net/Articles/585363/">initially was</a> and <a rel="nofollow" href="https://www.howtogeek.com/675569/why-linuxs-systemd-is-still-divisive-after-all-these-years/">has continued to be divisive.</a> Nevertheless systemd has remained as the Debian default.</p>

<p>There are at least two basic variations of Debian's systemd network arrangement. The first--which seems to be the default variation for Debian systemd network configuration--at least with the netinst iso--is using systemd's networking.service. For example, by using <code>systemctl</code>, we can confirm that networking.service is what is being used on our Node:</p>

<pre><code>root@Proxmox-VE ~ # systemctl status networking.service
● networking.service - Raise network interfaces
   Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: 
   Active: active (exited) since Wed 2021-06-02 19:13:13 UTC; 1 weeks 2 days ago
     Docs: man:interfaces(5)
 Main PID: 791 (code=exited, status=0/SUCCESS)
    Tasks: 0 (limit: 4915)
   Memory: 0B
   CGroup: /system.slice/networking.service

 [ . . . ]
root@Proxmox-VE ~ # 
</code></pre>

<p>Our test KVM also seems to think its networking is controlled by systemd:</p>

<pre><code>root@debian-kvm:~# systemctl status networking
● networking.service - Raise network interfaces
   Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
   Active: active (exited) since Wed 2021-06-16 01:20:45 UTC; 4min 51s ago
     Docs: man:interfaces(5)
  Process: 448 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=0/SUCCESS)
 Main PID: 448 (code=exited, status=0/SUCCESS)

Jun 16 01:20:45 debian-kvm systemd[1]: Starting Raise network interfaces...
Jun 16 01:20:45 debian-kvm systemd[1]: Started Raise network interfaces.
root@debian-kvm:~#
</code></pre>

<p>As we can see, systemd networking.service calls the traditional debian <code>ifup</code> and <code>ifdown</code>.</p>

<pre><code>root@debian-kvm:~# cat /lib/systemd/system/networking.service
[Unit]
Description=Raise network interfaces
Documentation=man:interfaces(5)
DefaultDependencies=no
Requires=ifupdown-pre.service
Wants=network.target
After=local-fs.target network-pre.target apparmor.service systemd-sysctl.service systemd-modules-load.service ifupdown-pre.service
Before=network.target shutdown.target network-online.target
Conflicts=shutdown.target

[Install]
WantedBy=multi-user.target
WantedBy=network-online.target

[Service]
Type=oneshot
EnvironmentFile=-/etc/default/networking
ExecStart=/sbin/ifup -a --read-environment
ExecStop=/sbin/ifdown -a --read-environment --exclude=lo
RemainAfterExit=true
TimeoutStartSec=5min
root@debian-kvm:~# 
</code></pre>

<p>The second Debian systemd possibility--not the default on Debian netinst.iso and not used here--is systemd-networkd. Sahitya Maruvada has a simple, clear, Debian systemd-networkd introduction, <a rel="nofollow" href="https://medium.com/100-days-of-linux/working-with-systemd-networkd-e461cfe80e6d">Working with systemd-networkd.</a> The <a rel="nofollow" href="https://wiki.debian.org/SystemdNetworkd">systemd-networkd wiki page</a> and the <a rel="nofollow" href="https://manpages.debian.org/buster/systemd/systemd.network.5.en.html">systemd.network manpage</a> also are available.</p>

<ul>
<li><strong>Official Debian Network Setup Instructions</strong></li>
</ul>

<p>Official Debian network setup instructions include the <a rel="nofollow" href="https://wiki.debian.org/NetworkConfiguration">Wiki,</a> the <a rel="nofollow" href="https://www.debian.org/doc/manuals/debian-reference/ch05.en.html">Handbook,</a> manual pages such as <code>man interfaces</code>, /etc/network/interfaces examples <a rel="nofollow" href="https://salsa.debian.org/debian/ifupdown/-/blob/master/examples/network-interfaces">online,</a> and sometimes locally:</p>

<pre><code># less /usr/share/doc/ifupdown/examples/network-interfaces
</code></pre>

<ul>
<li><strong>The <code>ip</code> Command Usually Is Available Even Though Networking Setup Varies Among Linux Distributions</strong></li>
</ul>

<p>Setting up networking, DNS name resolution, and software package management is very different in different Linux distributions. Therefore, we should not assume that the steps taken below would be exactly the same with a different Linux distribution than Debian.</p>

<p>Nevertheless, despite the different distributions' differing network setup systems, the <code>ip</code> command, <a rel="nofollow" href="https://en.wikipedia.org/wiki/Iproute2">supplied by the iproute2 collection,</a> usually is available these days. Please see also Red Hat's <a rel="nofollow" href="https://access.redhat.com/sites/default/files/attachments/rh_ip_command_cheatsheet_1214_jcs_print.pdf">IP Command Cheat Sheet</a></p>

<p>Because the <code>ip</code> command often is available, networking can be configured in many distributions, including Debian, by running a sequence of <code>ip</code> commands. The net effect <img src="https://staging.lowendspirit.com/plugins/emojiextender/emoji/twitter/smile.png" title=":)" alt=":)" height="18" /> of the sequence of <code>ip</code> commands can be to get the network functioning on most distributions without touching that individual distribution's network setup scheme.</p>

<p>Here's <a rel="nofollow" href="https://talk.lowendspirit.com/discussion/comment/63067/#Comment_63067">an example</a> of the <code>ip</code> command used in the context of an <a rel="nofollow" href="https://en.wikipedia.org/wiki/IPXE">iPXE boot.</a> Note that the first command in the linked example requires knowledge of the name of the interface. We can list the names of the interfaces on our system by running the <code>ip link show</code> command.</p>

<p>One issue with using a sequence of <code>ip</code> commands is that the network setup fails to persist across reboots. However, we can place the <code>ip</code> command sequence inside a script which will be run automagically every time the server reboots. The sequence of <code>ip</code> commands in a script reminds us of the days before systemd, when scripts controlled all parts of the boot process including network setup.</p>

<p>Our KVM VPS's internal network configuration that we will be using below is similar to <a rel="nofollow" href="https://lowendspirit.com/creating-our-first-lxc-vps-with-proxmox-ve-6-2-at-soyoustart/">how LXC containers are configured in Proxmox.</a> As will be seen below, Proxmox's LXC containers' network configuration adopts a variant of the "scripted <code>ip</code> command" approach, which also works inside Proxmox's KVM VPSes.</p>

<h2>V. Our VM's Network Setup</h2>

<ul>
<li><strong>Interfaces</strong></li>
</ul>

<p>Our original /etc/network/interfaces file, the one installed by the netinst.iso, might look like this:</p>

<pre><code>debian@debian-kvm:~$ cd /etc/network
debian@debian-kvm:/etc/network$ cat interfaces.original
# 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
debian@debian-kvm:/etc/network$ 
</code></pre>

<p>Note that, in the default from the netinst.iso, /etc/network/interfaces.d is empty, so sourcing its files does nothing to the configuration.</p>

<pre><code>debian@debian-kvm:/etc/network$ ls interfaces.d
debian@debian-kvm:/etc/network$ 
</code></pre>

<p>Now, let's edit /etc/network/interfaces to match our example network information from the above Before We Start section.</p>

<pre><code>debian@debian-kvm:/etc/network$ cat 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

auto ens18
iface ens18 inet static
  address 172.16.165.97/28
  gateway 172.16.164.1

iface ens18 inet6 static
  address fe80:xxxx:xxxx:xxxx::97/128
  gateway fe80:xxxx:xxxx:xxxx::3

debian@debian-kvm:/etc/network$ 
</code></pre>

<p>The minimum required information does not include comments (lines beginning with <code>#</code>). Maybe we can make the rash and short-sighted assumption that we are not going to install anything which will want a file included from interfaces.d. The loopback interface might no longer be required <a rel="nofollow" href="https://salsa.debian.org/debian/ifupdown/-/blob/master/examples/network-interfaces">(please see lines 17 and 18 in this file from Debian sources).</a> Thus, for our example setup, the minimum /etc/network/interfaces might be:</p>

<pre><code>debian@debian-kvm:/etc/network$ cat interfaces

auto ens18
iface ens18 inet static
  address 172.16.165.97/28
  gateway 172.16.164.1

iface ens18 inet6 static
  address fe80:xxxx:xxxx:xxxx::97/128
  gateway fe80:xxxx:xxxx:xxxx::3

debian@debian-kvm:/etc/network$ 
</code></pre>

<p>When configuring Debian LXC containers, Proxmox configures their /etc/network/interfaces files using added post-up and pre-down routes. Similarly, just for fun, instead of giving the gateway addresses in our /etc/network/interfaces,, we can manually add routes. Except for the initial <code>post-up</code> and <code>pre-down</code> these added lines mirror <a rel="nofollow" href="https://talk.lowendspirit.com/discussion/comment/63067/#Comment_63067"><code>ip route</code> commands that we could run manually</a> to set up or take down networking without touching the /etc/network/interfaces file.</p>

<pre><code>debian@debian-kvm:/etc/network$ cat 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

auto ens18
iface ens18 inet static
  address 172.16.165.97/28
     post-up ip route add 172.16.164.1 dev ens18
     post-up ip route add default via 172.16.164.1 dev ens18
     pre-down ip route del default via 172.16.164.1 dev ens18
     pre-down ip route del 172.16.164.1 dev ens18

iface ens18 inet6 static
  address fe80:xxxx:xxxx:xxxx::97/128
     post-up ip route add fe80:xxxx:xxxx:xxxx::3  dev ens18
     post-up ip route add default via fe80:xxxx:xxxx:xxxx::3  dev ens18
     pre-down ip route del default via fe80:xxxx:xxxx:xxxx::3  dev ens18
     pre-down ip route del fe80:xxxx:xxxx:xxxx::3  dev ens18

debian@debian-kvm:/etc/network$ 
</code></pre>

<h2>VI. Our VM's DNS</h2>

<p>We might want to add more or different nameservers to /etc/resolv.conf. Our Quick Setup configuration, above, includes <a rel="nofollow" href="https://blog.cloudflare.com/dns-resolver-1-1-1-1/">IPs from Cloudflare</a> and <a rel="nofollow" href="https://developers.google.com/speed/public-dns">from Google.</a></p>

<h2>VII. Our VM's Apt Setup</h2>

<p>The Debian wiki instructions for configuring apt are at <a rel="nofollow" href="https://wiki.debian.org/SourcesList">https://wiki.debian.org/SourcesList.</a> There also is a <a rel="nofollow" href="https://manpages.debian.org/buster/apt/sources.list.5.en.html">man page.</a> The configuration shown above, in Section III Quick Setup, is from the <a rel="nofollow" href="https://wiki.debian.org/SourcesList">SourcesList Debian wiki page.</a></p>

<p>The Debian <a rel="nofollow" href="https://www.debian.org/security/">Security Information page</a> says:</p>

<blockquote><div>
  <p>You can use apt to easily get the latest security updates. This requires a line such as<br />
  deb <a href="http://security.debian.org/debian-security" rel="nofollow">http://security.debian.org/debian-security</a> buster/updates main contrib non-free</p>
</div></blockquote>

<p>Many of the larger providers offer Debian mirrors. For example, Debian packages and security updates are available from the <a rel="nofollow" href="https://docs.hetzner.com/robot/dedicated-server/operating-systems/hetzner-aptitude-mirror/">Hetzner Debian Mirror</a></p>

<p>After /etc/sources.list is edited, we update our system's package repositories as follows:</p>

<pre><code>apt-get upgrade &amp;&amp; apt-get dist-upgrade -y
</code></pre>

<p>We can see exactly which packages are installed by looking at the logs in /var/log/apt.</p>

<p>We may wish to install openssh-server so that we can connect to our VM via ssh in addition to our Proxmox VNC connection. With ssh we regain cut and paste functionality while enjoying lower apparent latency!</p>

<pre><code>apt-get install openssh-server
</code></pre>

<p>The <a rel="nofollow" href="https://aboutbryan.com/2013/03/03/my-first-5-minutes-on-a-server-or-essential-security-for-linux-servers/">Kennedy article,</a> mentioned below in Section VII, has some good tips for ssh server configuration.</p>

<h2>VIII. Security</h2>

<p><a rel="nofollow" href="https://www.google.com">Google</a> suggests its <a rel="nofollow" href="https://aboutbryan.com/2013/03/03/my-first-5-minutes-on-a-server-or-essential-security-for-linux-servers/">first choice among essential server security articles.</a> This article from 2013, by Bryan Kennedy, seems to provide still-good advice, except that, nowadays, many people prefer to use <a rel="nofollow" href="https://en.wikipedia.org/wiki/EdDSA">ed25519 keys</a></p>

<h2>IX. Backup</h2>

<p>After all this work, we certainly want to make an offline backup of our new VM. We can <a rel="nofollow" href="https://pve.proxmox.com/wiki/Backup_and_Restore">use Proxmox to make the backup</a> and then download a a copy from the host node's /var/lib/vz/dump directory.</p>
]]>
        </description>
    </item>
    <item>
        <title>HOWTO: Locate empty files and directories</title>
        <link>https://staging.lowendspirit.com/index.php?p=/discussion/3930/howto-locate-empty-files-and-directories</link>
        <pubDate>Wed, 05 May 2021 12:00:00 +0000</pubDate>
        <category>LES Talk</category>
        <dc:creator>mikho</dc:creator>
        <guid isPermaLink="false">3930@/index.php?p=/discussions</guid>
        <description><![CDATA[<p><em>Written by <a href="https://staging.lowendspirit.com/index.php?p=/profile/mikho" rel="nofollow">@mikho</a>, 5 May 2021</em><br />
<small>Article was migrated from WordPress to Vanilla in March 2022</small></p>

<p>
  <img src="https://talk.lowendspirit.com/uploads/editor/kl/ovtru2uav7gg.png" alt="image" />
</p>

<p>When installing software on your VPS you will end up with both empty files and empty directories, often these are used as placeholders/lock files/socket files for communication.</p>

<p>This short guide will give you some examples on how to find those empty files/directories.</p>

<p>The command we are going to use is the “<strong>find</strong>” command. To find empty directories/files in the current directory, you use the parameter “<em><strong>&#45;empty</strong></em>“.</p>

<p>You also have to use the parameter “<em><strong>&#45;type</strong></em>” to define if you are looking for directories (d) or files (f).</p>

<h2><strong>Examples</strong></h2>

<p>Here is the command to find empty directories in the current directory:</p>

<pre><code>find ./ -type d -empty
</code></pre>

<p>And here is the command to find empty files in the current directory:</p>

<pre><code>find ./ -type f -empty
</code></pre>

<p>If you need to know how many empty files you have in the current directory, pipe the find command to “<em><strong>wc -l</strong></em>“:</p>

<pre><code>find ./ -type f -empty | wc -l
</code></pre>

<p>Similarly, to recursivly count how many how many files are located under the current directory and sub-directories,  you can use the following command:</p>

<pre><code>find ./ -type f -not -empty | wc -l 
</code></pre>

<p>To remove all empty directories in the current directory, the command you can use is:</p>

<pre><code>find ./ -type d -empty -exec rmdir {} \;
</code></pre>

<p><strong>– In all the commands above, the  (./) means the current directory or folder, if you want to perform actions in other directories, just replace the  (./) with the path to the new directory.</strong></p>

<p><strong>– In system directories such as /etc/, there are many empty files and directories.</strong></p>

<p><strong>But it is strongly recommended to not remove them.</strong></p>
]]>
        </description>
    </item>
    <item>
        <title>Portainer – A Docker management tool</title>
        <link>https://staging.lowendspirit.com/index.php?p=/discussion/3919/portainer-a-docker-management-tool</link>
        <pubDate>Mon, 21 Mar 2022 19:47:34 +0000</pubDate>
        <category>LES Talk</category>
        <dc:creator>sahjanivishal</dc:creator>
        <guid isPermaLink="false">3919@/index.php?p=/discussions</guid>
        <description><![CDATA[<p><em>Written by <a href="https://staging.lowendspirit.com/index.php?p=/profile/sahjanivishal" rel="nofollow">@sahjanivishal</a>, 27 Apr 2021</em><br />
<small>Article was migrated from WordPress to Vanilla in March 2022</small></p>

<h3>What is Docker?</h3>

<p>If you're reading this, most probably you already know Docker or have at least heard about it a lot. But still, for the uninitiated, Docker is an open platform for developing, shipping, and running applications and it enables you to separate your applications from your infrastructure so you can deliver software quickly. Find Docker interesting and want to know more? Head over to their <a rel="nofollow" href="https://docs.docker.com/get-started/overview/">docs</a> and you can find all the information you need!</p>

<h3>What is Portainer?</h3>

<p>So, talking about the elephant in the room, <a rel="nofollow" href="https://www.portainer.io/">Portainer</a> is a fully-featured web based GUI management tool for Docker. It runs locally, giving developers a rich UI to build and publish container images, deploy and manage applications and leverage data persistence and horizontal scaling for their applications.<br />
Worried about the cost? Portainer Community Edition is open source, free forever and used by more than 500,000 developers worldwide.</p>

<h3>What can I use Portainer for?</h3>

<ol>
<li>Visualize your server's docker environment on your web browser. (<em>I know that you don't fear the terminal, but hey, a little help won't harm anybody!</em>)</li>
<li>Aggregate view of Docker Swarm clusters (<em>Yeah, it's that fancy!</em>)</li>
<li>Deploy containers with some pre-built templates, right from inside the Portainer.</li>
<li>Start, Stop, Kill, Restart, Pause, Resume and Remove the containers easily with the web-GUI.</li>
<li>Facing any issue while deploying containers? Don't worry, Portainer to rescue! You can inspect the logs for any containers directly from the GUI and see what is stopping you from conquering the world.</li>
</ol>

<h3>How do I install Portainer?</h3>

<p>So, you're happy to give Portainer a go and want to know how can you install it? I have got you covered:</p>

<ol>
<li>Make sure you have Docker Engine installed on your server. You can follow the install instructions given <a rel="nofollow" href="https://docs.docker.com/get-docker/">here.</a></li>
<li>Run the following command to create a docker volume which should give output as <code>portainer_data</code> indicating the command was successfully executed:</li>
</ol>

<p><code>sudo docker volume create portainer_data</code></p>

<ol start="3">
<li>Once the volume is created, run the following command to create and run the Portainer container:</li>
</ol>

<p><code>sudo docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce</code></p>

<p>The above command should create and run the Portainer container on your server's port number 9000, which can be generally accessed in following ways:</p>

<p>a) By opening <code>http://your_server_ip:9000</code> in your favorite browser.<br />
b) If you have a domain name pointed towards your server's IP, by opening <code>yourdomain.com:9000</code> in your browser.</p>

<blockquote><div>
  <p>Note: If you want to access Portainer over a subdomain instead of every time typing <code>yourdomain.com:9000</code>, you can put it behind a reverse proxy with the help of any web server, like Caddy.</p>
</div></blockquote>

<p>4&#46; Alright, once the container is up and running, access it via any of the above methods and you will be greeted by the following initial setup screen of Portainer:</p>

<p><img src="https://talk.lowendspirit.com/uploads/editor/pa/33updf14w5mb.png" alt="" title="" /></p>

<blockquote><div>
  <p>Set the username and password for admin user here and click on <code>Create User</code>.</p>
</div></blockquote>

<p>5&#46; Next, select Docker as the container management environment you want Portainer to connect to (yes Portainer can connect to Kubernetes too, but that's a story for another day):</p>

<p><img src="https://talk.lowendspirit.com/uploads/editor/xp/jl35jgd665h1.png" alt="" title="" /></p>

<p>6&#46; Voila! now you have successfully connected your local Docker environment to Portainer and you should be able to see below screen:</p>

<p><img src="https://talk.lowendspirit.com/uploads/editor/90/43xcygcvlqnz.png" alt="" title="" /></p>

<p>7&#46; Click on the <code>local</code> endpoint to see all the containers, images, volumes, networks etc. in your Docker environment:</p>

<p><img src="https://talk.lowendspirit.com/uploads/editor/am/z4sbzvuao0qn.png" alt="" title="" /></p>

<p>8&#46; You can also deploy app templates containers right from inside the Portainer:</p>

<p><img src="https://talk.lowendspirit.com/uploads/editor/65/sakwc8mh0hvd.png" alt="" title="" /></p>

<blockquote><div>
  <p>This is it! Go on, play around a bit and I'm sure you'll love how easy Portainer makes it to manage Docker containers. Given how many of the self-hosted apps can be deployed using Docker containers, Portainer is a must-have tool in your arsenal.</p>
</div></blockquote>
]]>
        </description>
    </item>
    <item>
        <title>Reclaim reserved disk space KVM/VMWare/Dedicated</title>
        <link>https://staging.lowendspirit.com/index.php?p=/discussion/3922/reclaim-reserved-disk-space-kvm-vmware-dedicated</link>
        <pubDate>Mon, 21 Mar 2022 20:04:09 +0000</pubDate>
        <category>LES Talk</category>
        <dc:creator>mikho</dc:creator>
        <guid isPermaLink="false">3922@/index.php?p=/discussions</guid>
        <description><![CDATA[<p><em>Written by <a href="https://staging.lowendspirit.com/index.php?p=/profile/mikho" rel="nofollow">@mikho</a>, 29 Apr 2021</em><br />
<small>Article was migrated from WordPress to Vanilla in March 2022</small></p>

<p>
  <img src="https://talk.lowendspirit.com/uploads/editor/c2/qds4s5mryuc2.png" alt="image" />
</p>

<p>Following up on the bonus tip posted on <a rel="nofollow" href="https://lowendspirit.com/resize-your-kvm-vps-disk-partition-2-methods-and-bonus-tip-to-reclaim-disk-space-easy-mode/">Resize your KVM VPS disk partition, 2 methods and bonus tip to reclaim disk space – Easy mode</a>, here is a longer explanation and guide how to reclaim your reserved disk space.</p>

<hr />

<p>Joe Dougherty from <a rel="nofollow" href="https://securedragon.net/">SecureDragon.net</a> (great guy running a great company) sent me a tip about <a rel="nofollow" href="http://www.lowendtalk.com/discussion/33817/reclaim-some-free-space-on-your-server-with-this-weird-trick-kvm-xen-dedi-only">this thread</a> and asked if I could write something about this “weird trick”. Actually it’s not a wierd trick, it’s a built in security feature. The information in this post will only work on dedicated servers or Virtual Servers that utilize full virtualization, meaning that <strong>this won’t work on OpenVZ</strong>.</p>

<hr />

<p>On a newly created filesystems (Ext &#91;2/3/4&#93;) some of the space will be allocated for the system superuser (root) as “system reserved”. The default of 5% is meant for system partitions. If something goes wrong and your server consumes all its free disk space, the root user could still log in and check logs/crashdumps/etc and generally fix the situation.</p>

<p>For example, if your disk space fills up, the system logs (<em><code>/var/log</code></em>) and root’s mailbox (<em><code>/var/mail/root</code></em>) can still receive important information. For a <em><code>/home</code></em> or general data storage partition, there’s no need to leave any space for root. For very special needs, you can even change the user that gets this emergency space.</p>

<p>There’s another reason to not allow an ext&#91;23&#93; filesystem to get full, which is <a rel="nofollow" href="http://en.wikipedia.org/wiki/Defragmentation">fragmentation</a>. Ext4 should be better at this, as <a rel="nofollow" href="https://www.redhat.com/archives/ext3-users/2009-January/msg00026.html">explained by Linux filesystem developer/guru Theodore Ts’o</a>:</p>

<blockquote><div>
  <p>If you set the reserved block count to zero, it won't affect performance much except if you run for long periods of time (with lots of file creates and deletes) while the filesystem is almost full (i.e., say above 95%), at which point you'll be subject to fragmentation problems.  Ext4's multi-block allocator is much more fragmentation resistant, because it tries much harder to find contiguous blocks, so even if you don't enable the other ext4 features, you'll see better results simply mounting an ext3 filesystem using ext4 before the filesystem gets completely full.If you are just using the filesystem for long-term archive, where files aren't changing very often (i.e., a huge mp3 or video store), it obviously won't matter.</p>
  
  <p>Theodore Tso </p>
</div></blockquote>

<p>If you have a VPS with small disk size the 5% won’t mean much but if you have a 100GB drive or bigger, it quickly adds up to a vaste amount of unused space. In those cases we could lower the amount of reserved space in order to claim and use a few more GB.</p>

<p>At the time of writing the original post, I actually had an unused XEN VPS so lets have a look at what we can do about this by using that as a real life example.</p>

<p>first we confirm the filesystem parameters by running this <a rel="nofollow" href="https://linux.die.net/man/8/tune2fs">command</a>:</p>

<pre><code># tune2fs -l /dev/xvda1
</code></pre>

<p>it will list all information about the disk. This is the output I got from my server:</p>

<pre><code>tune2fs 1.42.5 (29-Jul-2012)
Filesystem volume name:   &lt;none&gt;
Last mounted on:          &lt;not available&gt;
Filesystem UUID:          50fd54e4-7740-4683-b1e5-64e93d6d1e92
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super large_file
Filesystem flags:         signed_directory_hash 
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              9830400
Block count:              39321600
Reserved block count:     1966080
Free blocks:              38473681
Free inodes:              9799099
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      1014
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
RAID stride:              1
RAID stripe width:        80
Filesystem created:       Mon Nov 10 19:05:08 2014
Last mount time:          Sun Dec 14 17:25:37 2014
Last write time:          Sun Dec 14 17:25:13 2014
Mount count:              12
Maximum mount count:      34
Last checked:             Mon Nov 10 19:05:08 2014
Check interval:           15552000 (6 months)
Next check after:         Sat May  9 19:05:08 2015
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      e2ccf267-28ea-4e34-9df0-a349d06f0247
Journal backup:           inode blocks
</code></pre>

<p>The ineresting part from the output above:</p>

<pre><code>Reserved block count:     1966080
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
</code></pre>

<p>Before we move on to the amount of reserved space, take a moment to reflect on what user who is allowed to use the reserved space. By default it is root unless changed by the system administrator.</p>

<p>if you multiply the <em>Reserved Block Count</em> with the current <em>Block Size</em> (also found in the tune2fs output above)</p>

<pre><code>Block size:               4096
</code></pre>

<p>we get how much space in bytes that is reserved by the system:</p>

<table><tbody><tr><td>Block count * Block Size</td><td>Byte</td><td>Kilobyte</td><td>Megabyte</td><td>Gigabyte</td></tr><tr><td>1966080 * 4096</td><td>8053063680</td><td>7864320</td><td>7680</td><td>7,5</td></tr></tbody></table>

<p>Doing the same operation using the Block Count value:</p>

<pre><code>Block count:              39321600
</code></pre>

<p>will give you the Total Disk space of the drive</p>

<table><tbody><tr><td>Block count * Block Size</td><td>Byte</td><td>Kilobyte</td><td>Megabyte</td><td>Gigabyte</td></tr><tr><td>39321600 * 4096</td><td>161061273600</td><td>157286400</td><td>153600</td><td>150</td></tr></tbody></table>

<p>As you can see (7,5GB out of 150GB) exactly 5% of the disk is reserved space.</p>

<p>As previously mentioned, if you don’t have a large disk it would be wise to not change that 5% value since it could mean that you wont have enough “system reserved space” to recover from a full disk problem.</p>

<p>In my case, 7,5 GB of reserved space is a bit much and I would benefit if this was available for me to store my backups instead. So, how do we change the amount of reserved space?</p>

<p>Since my disk is in total 150GB each percentage is 1,5GB and I think that 1,5GB will be enough for this server, the command to set the reserved space to 1 percent would therefor look like this:</p>

<pre><code># tune2fs -m 1 /dev/xvda1
</code></pre>

<p>The returned result :</p>

<pre><code>Setting reserved blocks percentage to 1% (393216 blocks)
</code></pre>

<p>Keeping in mind that each block is 4096 bytes the above result means the reserved space is:</p>

<pre><code>393216 * 4096 = 1,5 GB
</code></pre>

<p>Before you jump of joy I would like to end this article with a few words of caution;</p>

<p>While this is a nice way to get some extra space on your server <strong>TAKE EXTREME CARE</strong> if you decide to change the settings on the drive that has the / volume or you could end up with a server that even root can’t save when the disk runs out of space. If you have a secondary drive that only holds data, may it be your mp3 collection or family photos, you can set the reserved space to 0percent on that drive. As long as it is NOT the system drive.</p>
]]>
        </description>
    </item>
    <item>
        <title>How to Create and Setup a Debian KVM VPS with Proxmox VE 6 — Part II — Debian Install</title>
        <link>https://staging.lowendspirit.com/index.php?p=/discussion/3917/how-to-create-and-setup-a-debian-kvm-vps-with-proxmox-ve-6-part-ii-debian-install</link>
        <pubDate>Mon, 21 Mar 2022 19:40:48 +0000</pubDate>
        <category>LES Talk</category>
        <dc:creator>Not_Oles</dc:creator>
        <guid isPermaLink="false">3917@/index.php?p=/discussions</guid>
        <description><![CDATA[<p><em>Written by <a href="https://staging.lowendspirit.com/index.php?p=/profile/Not_Oles" rel="nofollow">@Not_Oles</a>, 21 Apr 2021</em><br />
<small>Article was migrated from WordPress to Vanilla in March 2022</small></p>

<p>
  <img src="https://talk.lowendspirit.com/uploads/editor/n9/cixat1djj0ag.png" alt="image" />
</p>

<p><strong>Introduction</strong></p>

<p>In <a rel="nofollow" href="https://lowendspirit.com/how-to-create-and-setup-a-debian-kvm-vps-with-proxmox-ve-6-part-i-creation">Part I of this series</a>, we downloaded the <a rel="nofollow" href="https://www.debian.org/CD/netinst/">Debian netinst install iso</a>. We then created a KVM VPS with the iso attached, and, finally, we successfully booted the iso.</p>

<p>In today's post, we're going to install our KVM with Debian 10 from the newly booted iso. But first, a bit of context on installing.</p>

<p><strong>Context</strong></p>

<ul>
<li><strong>Why the Debian minimal netinst iso?</strong></li>
</ul>

<p>Debian themselves say, <a rel="nofollow" href="https://www.debian.org/CD/netinst/">"we think that in many cases the minimal CD image is better — above all, you only download the packages that you selected for installation on your machine. . . ."</a></p>

<p>What we gain from this series is a well-proven, widely used, minimal, highly extensible, open-source server operating system.</p>

<ul>
<li><strong>What about networking?</strong></li>
</ul>

<p>The biggest difference between installing on our VPS and installing on our personal laptop or desktop might be network configuration. On personal devices, we are used to automatic network configuration happening behind the scenes via <a rel="nofollow" href="https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol">Dynamic Host Configuration Protocol (DHCP)</a>. We turn on our device, it gets its own IP address and internet connection without our having to do much.</p>

<p>On servers, however, the server's IP address and internet connection sometimes are set by hand instead of automatically via DHCP. Traditionally, server network settings are done from a console physically connected to the running server. Obviously, however, if our server is at a remote location, we cannot have a wired connection. Also, since networking hasn't yet been set up inside the server, we can't connect directly to our remote server over the internet, either.</p>

<p>As might be expected, the Debian minimal netinst iso is set up to configure networking automatically via DHCP. Thus, when we try the networking step of the install, that step will fail. The netinst iso will succeed, however, in installing a minimal Debian system without networking. In Part III of this series, covering Post Install Configuration, we will use the Proxmox web GUI and VNC to go inside our minimal system and set up networking by hand.</p>

<ul>
<li><strong>Alternative installation methods</strong></li>
</ul>

<p>It might be worth mentioning a few of the many other excellent methods of server installation which, although frequently used, are not selected here because they might be even more complex than our "simple" <img src="images/smile.png" alt=":)" title=":)" /> method.</p>

<ul>
<li>First, <a rel="nofollow" href="https://lowendspirit.com/debian-unattended-installation-using-a-preseed-file">Debian unattended Installation using a preseed file</a> will not work here because no networking is set up to use for obtaining the preseed file.</li>
<li>Cloud-init is <a rel="nofollow" href="https://github.com/canonical/cloud-init">"the <em>industry standard</em> multi-distribution method for cross-platform cloud instance initialization."</a> However, the <a rel="nofollow" href="https://pve.proxmox.com/wiki/Cloud-Init_Support">Proxmox Cloud-Init Support wiki article</a> says, despite the convenience of ready-made images, "we usually recommended to prepare the images by yourself," because "you will know exactly what you have installed." Also, for a special perspective on Cloud-Init, you might enjoy watching <a rel="nofollow" href="https://www.hashicorp.com/resources/cloudinit-the-good-parts">Cloud-Init: The Good Parts.</a></li>
<li>Proxmox supports <a rel="nofollow" href="https://pve.proxmox.com/wiki/VM_Templates_and_Clones">Templates.</a> It's possible to create templates with <a rel="nofollow" href="https://www.packer.io/">Packer.</a> If interested, you can check <a rel="nofollow" href="https://dev.to/aaronktberry/creating-proxmox-templates-with-packer-1b35">Creating proxmox templates with packer.</a></li>
</ul>

<p><strong>Before We Start</strong></p>

<p>We need to begin today at <a rel="nofollow" href="https://lowendspirit.com/how-to-create-and-setup-a-debian-kvm-vps-with-proxmox-ve-6-part-i-creation">the exact stage where we left Part I.</a> Our Debian Installer should be booted and running on our VPS.</p>

<p>We also will need the server's hostname (which can be Debian) plus the username (which also can be Debian) and the real name for the user account which the installer will create. It's also convenient to have on hand two <a rel="nofollow" href="https://passwords-generator.org/">previously generated good passwords,</a> one for the root account and another for the new user account.</p>

<p><strong>Debian Installer Steps</strong></p>

<ul>
<li><strong>Select Install</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/h2/9s2boinm789t.png" alt="" title="" /></p>

<ul>
<li><strong>Language</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/oi/jyzq11ay2z2c.png" alt="" title="" /></p>

<ul>
<li><strong>Location</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/d8/4ogce6eln8c9.png" alt="" title="" /></p>

<ul>
<li><strong>Keyboard</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/10/ws7jw1dfl4uk.png" alt="" title="" /></p>

<ul>
<li><strong>DHCP Tries and Fails</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/00/qbxl1icecoc6.png" alt="" title="" /></p>

<p><img src="https://talk.lowendspirit.com/uploads/editor/dz/csnojjtvtggb.png" alt="" title="" /></p>

<ul>
<li><strong>Select "Do Not Configure Network at this Time"</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/9e/73uzhwy2lvp4.png" alt="" title="" /></p>

<ul>
<li><strong>Hostname</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/il/445y6j7140ya.png" alt="" title="" /></p>

<ul>
<li><strong>Enter and Confirm the Root Password</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/7n/9pzj9y6y9qtf.png" alt="" title="" /></p>

<p><img src="https://talk.lowendspirit.com/uploads/editor/ya/jymedyyrhi6x.png" alt="" title="" /></p>

<ul>
<li><strong>User's Real Name</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/o5/bbaqkg91187q.png" alt="" title="" /></p>

<ul>
<li><strong>Username</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/p7/a0ccap5kqxff.png" alt="" title="" /></p>

<ul>
<li><strong>User Password</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/40/9mkk3s6d1qzk.png" alt="" title="" /></p>

<p><img src="https://talk.lowendspirit.com/uploads/editor/od/sh8bx3s7ht09.png" alt="" title="" /></p>

<ul>
<li><strong>Time Zone</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/tq/1qgateac02jk.png" alt="" title="" /></p>

<ul>
<li><strong>Partitioning Method</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/3h/gxc2wxgj9mfk.png" alt="" title="" /></p>

<ul>
<li><strong>Disk to Partition</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/os/uvqci3hbc4vy.png" alt="" title="" /></p>

<ul>
<li><strong>Partitioning Scheme</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/pl/31wn8e92ka2o.png" alt="" title="" /></p>

<ul>
<li><strong>Confirm Partitioning</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/9l/hh5ah0wha62m.png" alt="" title="" /></p>

<ul>
<li><strong>Write Changes to Disks</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/io/55x6c3zhihri.png" alt="" title="" /></p>

<ul>
<li><strong>Confirm No Additional Install Media</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/n4/b8zo11jrg9vz.png" alt="" title="" /></p>

<ul>
<li><strong>Confirm No Network Mirror</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/tj/riw8uqbklrhr.png" alt="" title="" /></p>

<ul>
<li><strong>Package Usage Survey</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/nl/brp3sp93qayg.png" alt="" title="" /></p>

<ul>
<li><strong>Choose Additional Software</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/8p/vtuzuhlsub2p.png" alt="" title="" /></p>

<ul>
<li><strong>Dual Boot</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/ad/vzsroraic1ds.png" alt="" title="" /></p>

<ul>
<li><strong>Grub</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/rf/a825mn0s7p30.png" alt="" title="" /></p>

<ul>
<li><strong>Installation Complete</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/3g/q96cfykeh2zm.png" alt="" title="" /></p>

<p>In the Proxmox web GUI, we select VPS &gt; Hardware &gt; CD/DVD Drive. Press edit and select "Do not use any media." Then, we return to our "Installation Complete" screen by selecting Console, which should reappear just as we left it. Finally, we click the "Continue" button, which should reboot the VPS.</p>

<p>In <a rel="nofollow" href="https://lowendspirit.com/how-to-create-and-setup-a-debian-kvm-vps-with-proxmox-ve-6-part-i-creation">Part I</a>, we did not install Qemu Agent. Therefore, rebooting from the Proxmox web GUI (outside our VPS) as opposed to rebooting from the console (inside our VPS) might not work. However, if it is necessary to stop the server from the web GUI, we can use the web GUI's Stop command found on the drop-down menu of the Shutdown button.</p>

<ul>
<li><strong>Successful Reboot</strong></li>
</ul>

<p><img src="https://talk.lowendspirit.com/uploads/editor/yi/5qiz1u3nginb.png" alt="" title="" /></p>
]]>
        </description>
    </item>
    <item>
        <title>Easy add IP to be blocked by iptables</title>
        <link>https://staging.lowendspirit.com/index.php?p=/discussion/3905/easy-add-ip-to-be-blocked-by-iptables</link>
        <pubDate>Mon, 12 Apr 2021 12:00:00 +0000</pubDate>
        <category>LES Talk</category>
        <dc:creator>mikho</dc:creator>
        <guid isPermaLink="false">3905@/index.php?p=/discussions</guid>
        <description><![CDATA[<p><em>Written by <a href="https://staging.lowendspirit.com/index.php?p=/profile/mikho" rel="nofollow">@mikho</a>, 12 Apr 2021</em><br />
<small>Article was migrated from WordPress to Vanilla in March 2022</small></p>

<p>Following up on the post on how to loop thru a file and perform an action per line, which you can find here</p>

<p><a href="https://lowendspirit.com/how-to-loop-through-a-file-and-perform-an-action-per-line/" rel="nofollow">https://lowendspirit.com/how-to-loop-through-a-file-and-perform-an-action-per-line/</a></p>

<hr />

<p>There is a case when this is useful, adding IPs from a text file into iptables and block their access to your VPS or dedicated server.</p>

<p>if you break down this command with its parameters (<em>iptables being the command</em>)</p>

<pre><code>iptables -A INPUT -s XXX.XXX.XXX.XXX -p udp -m udp --dport 28960:28965 -j DROP
</code></pre>

<p><u><strong>Parameter</strong>: Explanation</u><br />
<strong>&#45;A</strong>: Append this to existing rules<br />
<strong>INPUT</strong>: The chain where the rule should be added into<br />
<strong>&#45;s XXX.XXX.XXX.XXX</strong>: &#45;s Sets the source for a particular packet, in this case the ip of XXX.XXX.XXX.XXX<br />
<strong>&#45;p udp</strong>: &#45;p = Sets the IP protocol for the rule, which can be either icmp, tcp, udp, or all, to match every possible protocol. If this option is omitted when creating a rule, the all option is the default.<br />
<strong>&#45;m udp</strong>: &#45;m = match option  Different network protocols provide specialized matching options which may be set in specific ways to match a particular packet using that protocol. Of course, the protocol must first be specified in the iptables command, such as using -p tcp , to make the options for that protocol available.<br />
<strong>–dport 28960:28965</strong>: –dport Specifies the destination port of the UDP packet, using the service name, port number, or range of port numbers. The –destination-port match option may be used instead of –dport.  To specify a specific range of port numbers, separate the two numbers with a colon (:), such as our example.  You may also use an exclamation point character (!) as a flag after the –dport option to tell iptables to match all packets which do not use that network service or port.<br />
<strong>&#45;j DROP</strong>: &#45;j Tells iptables to jump to a particular target when a packet matches a particular rule. Valid targets to be used include the standard options, ACCEPT, DROP, QUEUE, and RETURN, as well as extended options that are available through modules loaded, such as LOG, MARK, and REJECT, among others. If no target is specified, the packet moves past the rule with no action taken. However, the counter for this rule is still increased by 1, as the packet matched the specified rule.  in our example we use DROP — The system that sent the packet is not notified of the failure. The packet is simply removed from the rule checking the chain and discarded.</p>

<p>This command will DROP connections from IP XXX.XXX.XXX.XXX on udp port 28960:28965</p>

<p>If you want to block all connections from a specific IP, no matter what port it tries to connect to, omit the -p -m and --dport parameters. This will look like this</p>

<pre><code>iptables -A INPUT -s XXX.XXX.XXX.XXX -j DROP
</code></pre>

<p>You might ask when are we going to loop thru the file?</p>

<pre><code>#!/bin/sh

# This will loop thru the file /ban/banip.txt and add every IP in that 
# file with a DROP to the INPUT chain in iptables.
#
# change the path and file name if required

# you can re-run this file if you are not saving your iptables config 
# between reboots. 
while read blist
do
/sbin/iptables -A INPUT -s $blist -j DROP &amp;&amp; sleep 2
echo $blist has been added to your iptables

done &lt; /ban/banip.txt
</code></pre>

<p>To add a single IP to the block list in iptables and add the IP to your text file, you could use a simple shell script like this</p>

<pre><code>#!/bin/sh
# Script to add ip
echo -n "Enter the IP to BAN and press [ENTER]:"
read ip
/sbin/iptables -A INPUT -s $ip -j DROP

#keep a record of the banned IP's if you want or comment out
echo $ip &gt;&gt; /ban/banip.txt
# Make sure you use the same path and filename as in the loop script
</code></pre>

<p>This is a quick and dirty way to keep a list of IPs you would like to block access from.</p>

<p>I'm sure that the readers have more sophisticated and innovative ways to add their own list of IPs to iptables.</p>

<p>Comment with how you do it and why you do it the way you do.</p>
]]>
        </description>
    </item>
   </channel>
</rss>
