<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mhavela</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mhavela"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Mhavela"/>
	<updated>2026-05-01T12:44:56Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Tutorials_and_Howtos&amp;diff=9698</id>
		<title>Tutorials and Howtos</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Tutorials_and_Howtos&amp;diff=9698"/>
		<updated>2014-01-07T08:52:06Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: /* Other Servers */ Send SMS using gnokii&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:package_edutainment.svg|right|link=]]&lt;br /&gt;
{{TOC left}}&lt;br /&gt;
&#039;&#039;&#039;Welcome to Tutorials and Howtos, a place of basic and advanced configuration tasks for your Alpine Linux.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The tutorials are hands-on and the reader is expected to try and achieve the goals described in each step, possibly with the help of a good example. The output in one step is the starting point for the following step.&lt;br /&gt;
&lt;br /&gt;
Howtos are smaller articles explaining how to perform a particular task with Alpine Linux.&lt;br /&gt;
&lt;br /&gt;
We encourage people to send in both complete articles as well as requesting topics to be covered. If you think you have the skills and knowledge to write an Alpine Linux related article please do so on this Wiki. If you want to request a topic, please add your request in this page&#039;s [[Talk:Tutorials_and_Howtos|Discussion]].&lt;br /&gt;
&lt;br /&gt;
{{Clear}}&lt;br /&gt;
== Storage ==&lt;br /&gt;
&lt;br /&gt;
* [[Alpine local backup|Alpine local backup (lbu)]] &#039;&#039;(Permanently store your modifications in case your box needs reboot)&#039;&#039; &amp;lt;!-- Installation and Storage --&amp;gt;&lt;br /&gt;
** [[Back Up a Flash Memory Installation]] &amp;lt;!-- Installation and Storage --&amp;gt;&lt;br /&gt;
** [[Manually editing a existing apkovl]]&lt;br /&gt;
&lt;br /&gt;
* [[Setting up disks manually]] &amp;lt;!-- Installation and Storage --&amp;gt;&lt;br /&gt;
* [[Setting up a software RAID1 array]]&lt;br /&gt;
&amp;lt;!-- ** [[Setting up a /var partition on software IDE raid1]]  Obsolete, Installation and Storage --&amp;gt; &lt;br /&gt;
* [[Setting up encrypted volumes with LUKS]]&lt;br /&gt;
* [[Setting up Logical Volumes with LVM]]&lt;br /&gt;
** [[Setting up LVM on GPT-labeled disks]]&lt;br /&gt;
* [[Filesystems|Formatting HD/Floppy/Other]] &amp;lt;!-- just a stub --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Setting up iSCSI]]&lt;br /&gt;
** [[iSCSI Raid and Clustered File Systems]]&lt;br /&gt;
* [[High performance SCST iSCSI Target on Linux software Raid]] &#039;&#039;(deprecated)&#039;&#039; &amp;lt;!-- solution --&amp;gt;&lt;br /&gt;
* [[Linux iSCSI Target (TCM)]]&lt;br /&gt;
* [[Disk Replication with DRBD]] &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Burning ISOs]] &amp;lt;!-- just some links now --&amp;gt;&lt;br /&gt;
* [[Bootmanagers]]&lt;br /&gt;
* [[Migrating data]]&lt;br /&gt;
&lt;br /&gt;
== Networking ==&lt;br /&gt;
&lt;br /&gt;
* [[Configure Networking]]&lt;br /&gt;
* [[Connecting to a wireless access point]]&lt;br /&gt;
* [[Bonding]]&lt;br /&gt;
* [[Vlan]]&lt;br /&gt;
* [[Bridge]]&lt;br /&gt;
* [[How to configure static routes]]&lt;br /&gt;
&lt;br /&gt;
* [[Alpine Wall]] - [[How-To Alpine Wall]] - [[Alpine Wall User&#039;s Guide]] &#039;&#039;(a new firewall management framework)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Using serial modem]]&lt;br /&gt;
* [[Using HSDPA modem]]&lt;br /&gt;
* [[Setting up Satellite Internet Connection]]&lt;br /&gt;
* [[Using Alpine on Windows domain with IPSEC isolation]]&lt;br /&gt;
&lt;br /&gt;
* [[Setting up a ssh-server]] &#039;&#039;(Using ssh is a good way to administer your box remotely)&#039;&#039; &amp;lt;!-- Server and Networking --&amp;gt;&lt;br /&gt;
* [[How to setup a wireless access point]] &#039;&#039;(Setting up Secure Wireless AP w/ WPA encryption with bridge to wired network)&#039;&#039;&lt;br /&gt;
* [[Setting up a OpenVPN server with Alpine]] &#039;&#039;(Allowing single users or devices to remotely connect to your network)&#039;&#039;&lt;br /&gt;
&amp;lt;!-- [[Using Racoon for Remote Sites]] is a different VPN tunnelling method, but that article is just a stub --&amp;gt;&lt;br /&gt;
* [[Experiences with OpenVPN-client on ALIX.2D3]]  &amp;lt;!-- solution --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Generating SSL certs with ACF]] &amp;lt;!-- Generating SSL certs with ACF 1.9 --&amp;gt;&lt;br /&gt;
* [[Setting up unbound DNS server]]&lt;br /&gt;
* [[Setting up nsd DNS server]]&lt;br /&gt;
* [[TinyDNS Format]]&lt;br /&gt;
* [[Fault Tolerant Routing with Alpine Linux]] &amp;lt;!-- solution --&amp;gt;&lt;br /&gt;
* [[Freeradius Active Directory Integration]]&lt;br /&gt;
* [[Multi_ISP]] &#039;&#039;(Dual-ISP setup with load-balancing and automatic failover)&#039;&#039;&lt;br /&gt;
* [[OwnCloud]] &#039;&#039;(Installing OwnCloud)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Post-Install ==&lt;br /&gt;
&amp;lt;!-- If you edit this, please coordinate with Installation#Post-Install and Developer_Documentation#Package_management.  Note that these three sections are not exact duplicates. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Alpine Linux package management|Package Management (apk)]] &#039;&#039;(How to add/remove packages on your Alpine)&#039;&#039;&lt;br /&gt;
   &amp;lt;!-- [[Alpine Linux package management#Local_Cache|How to enable APK caching]] --&amp;gt;&lt;br /&gt;
** [[Comparison with other distros]]&lt;br /&gt;
* [[Alpine local backup|Alpine local backup (lbu)]] &#039;&#039;(Permanently store your modifications in case your box needs reboot)&#039;&#039;&lt;br /&gt;
** [[Back Up a Flash Memory Installation]] &amp;lt;!-- new --&amp;gt;&lt;br /&gt;
** [[Manually editing a existing apkovl]]&lt;br /&gt;
* [[Alpine Linux Init System|Init System (OpenRC)]] &#039;&#039;(Configure a service to automatically boot at next reboot)&#039;&#039;&lt;br /&gt;
** [[Multiple Instances of Services]]&lt;br /&gt;
   &amp;lt;!-- [[Writing Init Scripts]] --&amp;gt;&lt;br /&gt;
* [[Upgrading Alpine]]&lt;br /&gt;
&amp;lt;!-- Obsolete&lt;br /&gt;
 [[Upgrading Alpine - v1.9.x]]&lt;br /&gt;
 [[Upgrading Alpine - CD v1.8.x]]&lt;br /&gt;
 [[Upgrading Alpine - HD v1.8.x]]&lt;br /&gt;
 [[Upgrade to repository main|Upgrading to signed repositories]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Setting up a ssh-server]] &#039;&#039;(Using ssh is a good way to administer your box remotely)&#039;&#039;&lt;br /&gt;
* [[setup-acf]] &#039;&#039;(Configures ACF (webconfiguration) so you can manage your box through https)&#039;&#039;&lt;br /&gt;
* [[Changing passwords for ACF|Changing passwords]]&lt;br /&gt;
* [[Ansible]] &#039;&#039;(Configuration management)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Enable Serial Console on Boot]]&lt;br /&gt;
* [[Error message on boot: Address space collision: host bridge window conflicts with Adaptor ROM]]&lt;br /&gt;
&lt;br /&gt;
== Desktop Environment ==&lt;br /&gt;
&lt;br /&gt;
* [[XFCE Setup]] and [[Xfce Desktop|Desktop Ideas]]&lt;br /&gt;
* [[EyeOS]] &#039;&#039;(Cloud Computing Desktop)&#039;&#039;&lt;br /&gt;
* [[Oneye]] &#039;&#039;(Cloud Computing Desktop - Dropbox Alternative)&#039;&#039;&lt;br /&gt;
* [[Owncloud]] &#039;&#039;(Cloud Computing Desktop - Dropbox Alternative)&#039;&#039;&lt;br /&gt;
** (to be merged with [[OwnCloud]] &#039;&#039;(Your personal Cloud for storing and sharing your data on-line)&#039;&#039;)&lt;br /&gt;
* [[Gnome Setup]]&lt;br /&gt;
* [[Awesome(wm) Setup]]&lt;br /&gt;
&lt;br /&gt;
== Applications ==&lt;br /&gt;
&lt;br /&gt;
=== Telephony ===&lt;br /&gt;
* [[Setting up Zaptel/Asterisk on Alpine]]&lt;br /&gt;
** [[Setting up Streaming an Asterisk Channel]]&lt;br /&gt;
* [[Freepbx on Alpine Linux]]&lt;br /&gt;
* [[FreePBX_V3]] &#039;&#039;(FreeSWITCH, Asterisk GUI web acces tool)&#039;&#039;&lt;br /&gt;
* [[2600hz]] &#039;&#039;(FreeSWITCH, Asterisk GUI web access tool)&#039;&#039;&lt;br /&gt;
* [[Kamailio]] &#039;&#039;(SIP Server, formerly OpenSER)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Mail ===&lt;br /&gt;
* [[Hosting services on Alpine]] &#039;&#039;(Hosting mail, webservices and other services)&#039;&#039;&lt;br /&gt;
** [[Hosting Web/Email services on Alpine]]&lt;br /&gt;
* [[ISP Mail Server HowTo]] &amp;lt;!-- solution, Mail --&amp;gt;&lt;br /&gt;
** [[ISP Mail Server Upgrade 2.x]]&lt;br /&gt;
** [[ISP Mail Server 2.x HowTo]] &#039;&#039;(Beta, please test)&#039;&#039;&lt;br /&gt;
* [[Roundcube]] &#039;&#039;(Webmail system)&#039;&#039;&lt;br /&gt;
* [[Setting up postfix with virtual domains]]&lt;br /&gt;
* [[Protecting your email server with Alpine]]&lt;br /&gt;
* [[Setting up clamsmtp]]&lt;br /&gt;
* [[Setting up dovecot with imap and ssl]]&lt;br /&gt;
&lt;br /&gt;
=== HTTP ===&lt;br /&gt;
* [[Lighttpd]]&lt;br /&gt;
** [[Lighttpd Https access]]&lt;br /&gt;
** [[Setting Up Lighttpd with PHP]]&lt;br /&gt;
** [[Setting Up Lighttpd With FastCGI]]&lt;br /&gt;
* [[Cherokee]]&lt;br /&gt;
* [[Nginx]]&lt;br /&gt;
* [[Apache]]&lt;br /&gt;
** [[Setting Up Apache with PHP]]&lt;br /&gt;
** [[Apache authentication: NTLM Single Signon]]&lt;br /&gt;
&lt;br /&gt;
* [[High Availability High Performance Web Cache]] &#039;&#039;(uCarp + HAProxy for High Availability Services such as Squid web proxy)&#039;&#039; &amp;lt;!-- solution, Server --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Setting up Transparent Squid Proxy]] &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
** [[SqStat]] &#039;&#039;(Script to look at active squid users connections)&#039;&#039;&lt;br /&gt;
** [[Obtaining user information via SNMP]] &#039;&#039;(Using squark-auth-snmp as a Squid authentication helper)&#039;&#039; &amp;lt;!-- Networking and Server, &amp;lt;== Using squark-auth-snmp --&amp;gt;&lt;br /&gt;
* [[Setting up Explicit Squid Proxy]]&lt;br /&gt;
&lt;br /&gt;
* [[Drupal]] &#039;&#039;(Content Management System (CMS) written in PHP)&#039;&#039;&lt;br /&gt;
* [[WordPress]] &#039;&#039;(Web software to create website or blog)&#039;&#039;&lt;br /&gt;
* [[MediaWiki]] &#039;&#039;(Free web-based wiki software application)&#039;&#039;&lt;br /&gt;
* [[DokuWiki]]&lt;br /&gt;
&lt;br /&gt;
=== Other Servers ===&lt;br /&gt;
* [[Setting up a ssh-server]] &#039;&#039;(Using ssh is a good way to administer your box remotely)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Phpizabi]] &#039;&#039;(Social Networking Platform)&#039;&#039;&lt;br /&gt;
* [[Statusnet]] &#039;&#039;(Microblogging Platform)&#039;&#039;&lt;br /&gt;
* [[Pastebin]] &#039;&#039;(Pastebin software application)&#039;&#039;&lt;br /&gt;
* [[Setting up Transmission (bittorrent) with Clutch WebUI]]&lt;br /&gt;
&lt;br /&gt;
* [[Redmine]] &#039;&#039;(Project management system)&#039;&#039;&lt;br /&gt;
* [[Request-Tracker]] &#039;&#039;(Ticket system)&#039;&#039;&lt;br /&gt;
* [[OsTicket]] &#039;&#039;(Ticket system)&#039;&#039;&lt;br /&gt;
* [[Setting up trac wiki|Trac]] &#039;&#039;(Enhanced wiki and issue tracking system for software development projects)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Cgit]]&lt;br /&gt;
** [[Setting up a git repository server with gitolite and cgit]] &amp;lt;!-- doesn&#039;t exist yet --&amp;gt;&lt;br /&gt;
* [[Roundcube]] &#039;&#039;(Webmail system)&#039;&#039;&lt;br /&gt;
* [[Glpi]] &#039;&#039;(Manage inventory of technical resources)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[How to setup a Alpine Linux mirror]]&lt;br /&gt;
* [[Cups]]&lt;br /&gt;
* [[NgIRCd]] &#039;&#039;(Server for Internet Relay Chat/IRC)&#039;&#039;&lt;br /&gt;
* [[OpenVCP]] &#039;&#039;(VServer Control Panel)&#039;&#039;&lt;br /&gt;
* [[Mahara]] &#039;&#039;(E-portfolio and social networking system)&#039;&#039;&lt;br /&gt;
* [[Chrony and GPSD | Using chrony, gpsd, and a garmin LVC 18 as a Stratum 1 NTP source ]]&lt;br /&gt;
* [[Sending SMS using gnokii]]&lt;br /&gt;
&lt;br /&gt;
=== Monitoring ===&lt;br /&gt;
* [[Traffic monitoring]] &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting up traffic monitoring using rrdtool (and snmp)]] &amp;lt;!-- Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting up monitoring using rrdtool (and rrdcollect)]]&lt;br /&gt;
* [[Setting up Cacti|Cacti]] &#039;&#039;(Front-end for rrdtool networking monitor)&#039;&#039;&lt;br /&gt;
* [[Setting up Zabbix|Zabbix]] &#039;&#039;(Monitor and track the status of network services and hardware)&#039;&#039;&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039; &amp;lt;!-- draft, solution, Networking and Monitoring and Server --&amp;gt;&lt;br /&gt;
** [[Setting up NRPE daemon]] &#039;&#039;(Performs remote Nagios checks)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting up Smokeping|Smokeping]] &#039;&#039;(Network latency monitoring)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
** [[Setting up MRTG and Smokeping to Monitor Bandwidth Usage and Network Latency]]&lt;br /&gt;
* [[Setting Up Fprobe And Ntop|Ntop]] &#039;&#039;(NetFlow collection and analysis using a remote fprobe instance)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Cvechecker]] &#039;&#039;(Compare installed packages for Common Vulnerabilities Exposure)&#039;&#039; &amp;lt;!-- Monitoring and Security --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[IP Accounting]] &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Obtaining user information via SNMP]] &#039;&#039;(Using squark-auth-snmp as a Squid authentication helper)&#039;&#039; &amp;lt;!-- Networking and Server, &amp;lt;== Using squark-auth-snmp --&amp;gt;&lt;br /&gt;
* [[SqStat]] &#039;&#039;(Script to look at active squid users connections)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Piwik]] &#039;&#039;(A real time web analytics software program)&#039;&#039;&lt;br /&gt;
* [[Awstats]] &#039;&#039;(Free log file analyzer)&#039;&#039;&lt;br /&gt;
* [[Intrusion Detection using Snort]]&lt;br /&gt;
** [[Intrusion Detection using Snort, Sguil, Barnyard and more]]&lt;br /&gt;
* [[Dglog]] &#039;&#039;(Log analyzer for the web content filter DansGuardian)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Webmin]] &#039;&#039;(A web-based interface for Linux system)&#039;&#039;&lt;br /&gt;
* [[PhpPgAdmin]] &#039;&#039;(Web-based administration tool for PostgreSQL)&#039;&#039;&lt;br /&gt;
* [[PhpMyAdmin]] &#039;&#039;(Web-based administration tool for MYSQL)&#039;&#039;&lt;br /&gt;
* [[PhpSysInfo]] &#039;&#039;(A simple application that displays information about the host it&#039;s running on)&#039;&#039;&lt;br /&gt;
* [[Linfo]]&lt;br /&gt;
&lt;br /&gt;
* [[Setting up lm_sensors]]&lt;br /&gt;
&lt;br /&gt;
== Misc ==&lt;br /&gt;
&lt;br /&gt;
* [[:Category:Shell]]&lt;br /&gt;
* [[:Category:Programming]]&lt;br /&gt;
* [[Running glibc programs]]&lt;br /&gt;
* [[:Category:Drivers]]&lt;br /&gt;
* [[:Category:Multimedia]]&lt;br /&gt;
&lt;br /&gt;
== Complete Solutions ==&lt;br /&gt;
* [[Replacing non-Alpine Linux with Alpine remotely]]&lt;br /&gt;
* [[High performance SCST iSCSI Target on Linux software Raid]]&lt;br /&gt;
* [[Fault Tolerant Routing with Alpine Linux]]&lt;br /&gt;
* [[Experiences with OpenVPN-client on ALIX.2D3]]&lt;br /&gt;
&lt;br /&gt;
* [[ISP Mail Server HowTo]] &#039;&#039;(Postfix+PostfixAdmin+DoveCot+Roundcube+ClamAV+Spamd - A full-serivce ISP mail server)&#039;&#039;&lt;br /&gt;
** [[ISP Mail Server Upgrade 2.x]]&lt;br /&gt;
** [[ISP Mail Server 2.x HowTo]] &#039;&#039;(Beta, please test)&#039;&#039;&lt;br /&gt;
* [[High Availability High Performance Web Cache]] &#039;&#039;(uCarp + HAProxy for High Availability Services such as Squid web proxy)&#039;&#039;&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039; &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
* [[Streaming Security Camera Video with VLC]]&lt;br /&gt;
* [[Dynamic Multipoint VPN (DMVPN)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This does not attempt to be complete. Is it useful to have these listed here? I find them more accessible if grouped with their topics; also, an up-to-date list of all Draft or Obsolete pages can be found at [[Project:Wiki maintenance]].&lt;br /&gt;
&lt;br /&gt;
== Drafts ==&lt;br /&gt;
Currently unfinished/works-in-progress.&lt;br /&gt;
* [[Using Racoon for Remote Sites]]&lt;br /&gt;
* [[Setting up Transparent Squid Proxy]] &#039;&#039;(Covers Squid proxy and URL Filtering system)&#039;&#039;&lt;br /&gt;
** [[Obtaining user information via SNMP]] &#039;&#039;(Using the Squark Squid authentication helper)&#039;&#039; [!-- no longer a draft --]&lt;br /&gt;
* [[Setting up Streaming an Asterisk Channel]]&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039;&lt;br /&gt;
* [[Intrusion Detection using Snort]] &#039;&#039;(Installing and configuring Snort and related applications on Alpine 2.0.x)&#039;&#039;&lt;br /&gt;
* [[IP Accounting]] &#039;&#039;(Installing and configuring pmacct for IP Accounting, Netflow/sFlow collector)&#039;&#039;&lt;br /&gt;
* [[Disk Replication with DRBD]]&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Sending_SMS_using_gnokii&amp;diff=9697</id>
		<title>Sending SMS using gnokii</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Sending_SMS_using_gnokii&amp;diff=9697"/>
		<updated>2014-01-07T08:47:45Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Created page with &amp;quot;__NOTOC__ In this tutorial we are using {{pkg|gnokii}} to send SMS  == Prerequisites == This doc is documented and tested based on Alpine Linux 2.7, but it might work for earl...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
In this tutorial we are using {{pkg|gnokii}} to send SMS&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
This doc is documented and tested based on Alpine Linux 2.7, but it might work for earlier versions too.&amp;lt;BR&amp;gt;&lt;br /&gt;
You will also need some sort of modem that can send SMS (e.g. a USB dongle with a SIM-card).&lt;br /&gt;
&lt;br /&gt;
== Install ==&lt;br /&gt;
* Install required package(s)&lt;br /&gt;
 {{Cmd|apk add gnokii}}&lt;br /&gt;
* Create missing folders&lt;br /&gt;
 {{Cmd|mkdir -p /root/.cache/gnokii/}}&lt;br /&gt;
* Physically attach a SMS capable modem to the host&lt;br /&gt;
&lt;br /&gt;
== Configure ==&lt;br /&gt;
* Add the following content to &#039;&amp;lt;tt&amp;gt;/etc/gnokiirc&amp;lt;/tt&amp;gt;&#039;&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
[global]&lt;br /&gt;
port = /dev/ttyUSB0&lt;br /&gt;
model = AT&lt;br /&gt;
connection = serial&lt;br /&gt;
use_locking = yes&lt;br /&gt;
serial_baudrate = 115200&lt;br /&gt;
smsc_timeout = 30&lt;br /&gt;
&lt;br /&gt;
[gnokiid]&lt;br /&gt;
binddir = /usr/bin/&lt;br /&gt;
&lt;br /&gt;
[logging]&lt;br /&gt;
debug = off&lt;br /&gt;
rlpdebug = off&lt;br /&gt;
xdebug = off&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 {{Note|You will most likely need to change the above config so it to suit your equipment and setup.}}&lt;br /&gt;
* Verify if the configuration works as expected&lt;br /&gt;
 {{cmd|gnokii --identify}}&lt;br /&gt;
 {{note|You should receive a output that looks something like this:&amp;lt;pre&amp;gt;&lt;br /&gt;
GNOKII Version 0.6.31&lt;br /&gt;
Cannot open logfile /root/.cache/gnokii/gnokii-errors&lt;br /&gt;
WARNING: cannot open logfile, logs will be directed to stderr&lt;br /&gt;
IMEI         : 123456789012345&lt;br /&gt;
Manufacturer : Undefined&lt;br /&gt;
No flags section in the config file.&lt;br /&gt;
Model        : Teltonika TM1&lt;br /&gt;
Product name : Teltonika TM1&lt;br /&gt;
Revision     : VilniusSMD 05.94.01&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Sending SMS ==&lt;br /&gt;
* Now send a SMS&lt;br /&gt;
 {{cmd|echo &amp;quot;Test sms&amp;quot; {{!}} gnokii --sendsms 123456}}&lt;br /&gt;
 {{note|You will need to replace 123456 with the phone number you want to send your test SMS}}&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Changing_passwords_for_ACF&amp;diff=9537</id>
		<title>Changing passwords for ACF</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Changing_passwords_for_ACF&amp;diff=9537"/>
		<updated>2013-11-20T15:22:33Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Re-defining procedurs on how to set acf-password (now describing &amp;#039;acfpasswd&amp;#039; feature)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
This provides documentation for beginner Alpine Linux users on how to change passwords for the console login as well as the ACF. It is pretty simple.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Changing ACF password using command line ==&lt;br /&gt;
Setting ACF password is done in various ways depending on how old your system is.&lt;br /&gt;
&lt;br /&gt;
=== Set ACF-password on Alpine Linux 1.9 and newer ===&lt;br /&gt;
Set the ACF-password for a specific user (where &#039;&amp;lt;TT&amp;gt;username&amp;lt;/TT&amp;gt;&#039; could be a system user, such as &#039;&amp;lt;TT&amp;gt;root&amp;lt;/TT&amp;gt;&#039;):&lt;br /&gt;
{{Cmd|acfpasswd username}}&lt;br /&gt;
You would be prompted to enter a new password for this user.&lt;br /&gt;
{{Tip|You could set the ACF password to reflect the system user&#039;s password. In such case you would run a command that looks like this:&lt;br /&gt;
{{Cmd|acfpasswd -s username}}&lt;br /&gt;
&#039;&#039;(The &#039;&amp;lt;TT&amp;gt;-s&amp;lt;/TT&amp;gt;&#039; flag tells the system to copy the system user&#039;s password into ACF-password database.)&#039;&#039;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Set ACF-password on Alpine Linux 1.8 and older ===&lt;br /&gt;
The logins and passwords for the ACF users are stored in a separate location: &#039;&amp;lt;TT&amp;gt;/etc/acf/passwd&amp;lt;/TT&amp;gt;&#039;.&lt;br /&gt;
&lt;br /&gt;
The syntax for the &#039;&amp;lt;TT&amp;gt;/etc/acf/passwd&amp;lt;/TT&amp;gt;&#039; file is as follows:&lt;br /&gt;
&lt;br /&gt;
 username:md5sumpassword::ROLE&lt;br /&gt;
&lt;br /&gt;
For example, change the ACF user &#039;&amp;lt;TT&amp;gt;Alpine&amp;lt;/TT&amp;gt;&#039; as follows:&lt;br /&gt;
&lt;br /&gt;
# Generate a md5sum hash of the password &#039;&amp;lt;TT&amp;gt;testing123&amp;lt;/TT&amp;gt;&#039;, and send it to the passwd file: {{Cmd|echo -n &amp;quot;testing123&amp;quot; {{!}} md5sum &amp;gt;&amp;gt; /etc/acf/passwd}}&lt;br /&gt;
# Edit the passwd file to put the hash in the correct place as shown below, deleting the existing hash:&lt;br /&gt;
::&amp;lt;pre&amp;gt;Alpine:92707c3c2766ce04133e0f85681add8b::ADMIN&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== To change passwords from the ACF Interface ==&lt;br /&gt;
&lt;br /&gt;
Log on as a user with the Admin role, which has rights to change user passwords other than it&#039;s own.&lt;br /&gt;
&lt;br /&gt;
Browse to &#039;&#039;&#039;System &amp;gt;&amp;gt; User Management&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Under the Existing Account section, click &#039;&#039;&#039;[Edit this account]&#039;&#039;&#039; under the user whose password you want to change.&lt;br /&gt;
&lt;br /&gt;
Enter the new password in the &#039;&amp;lt;TT&amp;gt;Password&amp;lt;/TT&amp;gt;&#039; and &#039;&amp;lt;TT&amp;gt;Password (Confirm)&amp;lt;/TT&amp;gt;&#039; fields.&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;[Save]&#039;&#039;&#039; to save the changes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Save changes ==&lt;br /&gt;
Remember to commit all changes (if you are running from &#039;tmpfs&#039;): {{Cmd|lbu ci}}&lt;br /&gt;
&lt;br /&gt;
[[Category:ACF]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Include:Copying_Alpine_to_Flash&amp;diff=9397</id>
		<title>Include:Copying Alpine to Flash</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Include:Copying_Alpine_to_Flash&amp;diff=9397"/>
		<updated>2013-10-17T11:58:44Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: &amp;quot;modprobe vfat&amp;quot; if setup-bootable is failing&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Boot Alpine Linux CD-ROM ===&lt;br /&gt;
# Insert the Alpine Linux CD-ROM into a computer.&lt;br /&gt;
# Boot the computer from the Alpine Linux CD-ROM.&lt;br /&gt;
#* This step may require changes to the BIOS settings to select booting from CD. &lt;br /&gt;
# Login with the username &#039;&#039;root&#039;&#039;. No password is needed.&lt;br /&gt;
&lt;br /&gt;
{{Tip|If you&#039;re not able to boot from the CD, then another option is to boot from a regular Alpine installation, and [[Burning_ISOs|manually mount the ISO image to {{Path|/media/cdrom}}]].}} &lt;br /&gt;
&lt;br /&gt;
=== Determine the Device Name of the {{{1|Flash Medium}}} ===&lt;br /&gt;
Determine the name your computer uses for your {{{1|flash medium}}}. The following step is one way to do this.&lt;br /&gt;
# After inserting the {{{1|flash medium}}}, run the command:&lt;br /&gt;
#* {{Cmd|dmesg}}&lt;br /&gt;
#* At the end of this command you should see the name of your {{{1|flash medium}}}, likely starting with &amp;quot;sd&amp;quot;. (For example: &amp;quot;sda&amp;quot;).&lt;br /&gt;
#* The remainder of this document will assume that your {{{1|flash medium}}} is called /dev/sda&lt;br /&gt;
&lt;br /&gt;
{{Warning|Be very careful about this. You do not want to mistakenly wipe your hard drive if it&#039;s on /dev/sda}}&lt;br /&gt;
&lt;br /&gt;
=== Format {{{1|Flash Medium}}} ===&lt;br /&gt;
Run fdisk (replacing sda with your {{{1|flash medium}}} name):&lt;br /&gt;
{{Cmd|fdisk /dev/sda}}&lt;br /&gt;
&lt;br /&gt;
# (&#039;&#039;Optional&#039;&#039;) - Create new partition table with one FAT32 partition&lt;br /&gt;
#* &#039;&#039;&#039;d&#039;&#039;&#039; Delete all partitions (this may take a few steps)&lt;br /&gt;
#* &#039;&#039;&#039;n&#039;&#039;&#039; Create a new partition&lt;br /&gt;
#* &#039;&#039;&#039;p&#039;&#039;&#039; A primary partition&lt;br /&gt;
#* &#039;&#039;&#039;1&#039;&#039;&#039; Partition number 1&lt;br /&gt;
#** Use defaults for first and last cylinder (just press [Enter] twice).&lt;br /&gt;
#* &#039;&#039;&#039;t&#039;&#039;&#039; Change partition type&lt;br /&gt;
#* &#039;&#039;&#039;c&#039;&#039;&#039; Partition type (Win95 FAT32/LBA)&lt;br /&gt;
#Verify that the primary partition is bootable&lt;br /&gt;
#* &#039;&#039;&#039;p&#039;&#039;&#039; Print list of partitions&lt;br /&gt;
#* If there is no &#039;*&#039; next to the first partition, follow the next steps:&lt;br /&gt;
#** &#039;&#039;&#039;a&#039;&#039;&#039; &amp;lt;big&amp;gt;Make the partition bootable (set boot flag)&amp;lt;/big&amp;gt;&lt;br /&gt;
#** &#039;&#039;&#039;1&#039;&#039;&#039; Partition number 1&lt;br /&gt;
#&#039;&#039;&#039;w&#039;&#039;&#039; Write your changes to the device&lt;br /&gt;
&lt;br /&gt;
=== Add Alpine Linux to the {{{1|Flash Medium}}}  ===&lt;br /&gt;
To boot from your {{{1|flash medium}}} you need to copy the contents of the CDROM to the {{{1|flash medium}}} and make it bootable. Those two operations can be automated with the [[setup-bootable]] tool or can be done manually.&lt;br /&gt;
&lt;br /&gt;
{{Note|If the following commands fail due to &#039;No such file or directory&#039;, you may have to remove and reinsert the {{{1|flash medium}}}, or even reboot, to get /dev/sda1 to appear}}&lt;br /&gt;
&lt;br /&gt;
==== Automated ====&lt;br /&gt;
{{Tip|If using Alpine Linux 1.10.4 or newer, you can use this section to complete the install. Otherwise, follow the Manual steps below.}}&lt;br /&gt;
{{Note|The target partition has to be formatted. Use the &amp;lt;code&amp;gt;mkdosfs&amp;lt;/code&amp;gt; command from the Manual steps below if needed.}}&lt;br /&gt;
# Run the [[setup-bootable]] script to add Alpine Linux to the {{{1|flash medium}}} and make it bootable (replacing sda with your {{{1|flash medium}}} name):&lt;br /&gt;
#: {{Cmd|setup-bootable /media/cdrom /dev/sda1}}&lt;br /&gt;
{{Note|If you get something like &#039;&amp;lt;code&amp;gt;Failed to mount /dev/sda1 on /media/sda1&amp;lt;/code&amp;gt;&#039; when running the above [[setup-bootable]] command, you might want to try running:&lt;br /&gt;
{{Cmd|modprobe vfat}}&lt;br /&gt;
and then try re-run the [[setup-bootable]] command as described above.}}&lt;br /&gt;
{{Warning|If you are installing to a USB Stick, you may need to modify the {{Path|syslinux.cfg}} file to say &amp;lt;code&amp;gt;usbdisk&amp;lt;/code&amp;gt; as [[#Wrong_Device_Name|described below]], or you will face possible problems booting and definite problems with the package cache. Recent versions of &amp;lt;code&amp;gt;setup-bootable&amp;lt;/code&amp;gt; will specify the alpine_dev using a UUID instead, so it should work properly by default.}}&lt;br /&gt;
&lt;br /&gt;
==== Manual ====&lt;br /&gt;
# (&#039;&#039;Optional&#039;&#039;) - If you created a new partition above, format the {{{1|flash medium}}} with a FAT32 filesystem (replacing sda with your {{{1|flash medium}}} name):&lt;br /&gt;
#: {{Cmd|apk add dosfstools&amp;lt;BR&amp;gt;mkdosfs -F32 /dev/sda1}}&lt;br /&gt;
# Install syslinux and MBR (replacing sda with your {{{1|flash medium}}} name):&lt;br /&gt;
#: {{Cmd|{{{|apk add syslinux&amp;lt;BR&amp;gt;dd if=/usr/share/syslinux/mbr.bin of=/dev/sda}}}&amp;lt;BR&amp;gt;syslinux /dev/sda1}}&lt;br /&gt;
#Copy the files to the {{{1|flash medium}}} (replacing sda with your {{{1|flash medium}}} name):&lt;br /&gt;
#: {{Cmd|&amp;lt;nowiki&amp;gt;mkdir -p /media/sda1&lt;br /&gt;
mount -t vfat /dev/sda1 /media/sda1&lt;br /&gt;
cd /media/cdrom&lt;br /&gt;
cp -a .alpine-release * /media/sda1/&lt;br /&gt;
umount /media/sda1&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
=== Wrong Device Name ===&lt;br /&gt;
If you cannot boot from the {{{1|flash medium}}} and you see something like:&lt;br /&gt;
 Mounting boot media failed.&lt;br /&gt;
 initramfs emergency recovery shell launched. Type &#039;exit&#039; to continue boot&lt;br /&gt;
then it is likely that the device name in {{Path|syslinux.cfg}} is wrong. You should replace the device name in this line:&lt;br /&gt;
 append initrd=/boot/grsec.gz alpine_dev=&#039;&#039;&#039;usbdisk&#039;&#039;&#039;:vfat modules=loop,cramfs,sd-mod,usb-storage quiet&lt;br /&gt;
with the proper device name.&lt;br /&gt;
* For boot from USB, the device name should be &#039;usbdisk&#039; (as shown above)&lt;br /&gt;
* For other options, you can run &amp;lt;code&amp;gt;cat /proc/partitions&amp;lt;/code&amp;gt; to see the available disks (i.e. &#039;sda&#039; or &#039;sdb&#039;)&lt;br /&gt;
&lt;br /&gt;
=== Non-FAT32 Filesystems ===&lt;br /&gt;
When your {{{1|flash medium}}} is formatted with a filesystem other than FAT32, you might have to specify the necessary filesystem modules in the boot parameters.&lt;br /&gt;
&lt;br /&gt;
To do so, mount the {{{1|flash medium}}} and change the {{Path|syslinux.cfg}} file line from &lt;br /&gt;
 append initrd=/boot/grsec.gz alpine_dev=usbdisk:vfat modules=loop,cramfs,sd-mod,usb-storage quiet&lt;br /&gt;
to&lt;br /&gt;
 append initrd=/boot/grsec.gz alpine_dev=usbdisk:&#039;&#039;&#039;ext3&#039;&#039;&#039; modules=loop,cramfs,sd-mod,usb-storage&#039;&#039;&#039;,ext3&#039;&#039;&#039; quiet&lt;br /&gt;
in the case of an ext3 formatted partition. A similar procedure might apply to other filesystems (if they are supported by syslinux and the Alpine Linux kernel).&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Dynamic_Multipoint_VPN_(DMVPN)&amp;diff=9353</id>
		<title>Dynamic Multipoint VPN (DMVPN)</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Dynamic_Multipoint_VPN_(DMVPN)&amp;diff=9353"/>
		<updated>2013-09-17T14:58:36Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Allow this host to act as NTP server&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
&lt;br /&gt;
http://alpinelinux.org/about under &#039;&#039;&#039;Why the Name Alpine?&#039;&#039;&#039; states: [ref?]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The first open-source implementation of Cisco&#039;s DMVPN, called OpenNHRP, was written for Alpine Linux.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
So the aim of this document is to be the reference Linux DMVPN setup, with all the networking services needed for the clients that will use the DMVPN (DNS, DHCP, firewall, etc.).&lt;br /&gt;
&lt;br /&gt;
= Terminology =&lt;br /&gt;
;NBMA: &#039;&#039;Non-Broadcast Multi-Access&#039;&#039; network as described in [http://tools.ietf.org/html/rfc2332 RFC 2332]&lt;br /&gt;
&lt;br /&gt;
;Hub: the &#039;&#039;Next Hop Server&#039;&#039; (NHS) performing the Next Hop Resolution Protocol service within the NBMA cloud.&lt;br /&gt;
&lt;br /&gt;
;Spoke: the &#039;&#039;Next Hop Resolution Protocol Client&#039;&#039; (NHC) which initiates NHRP requests of various types in order to obtain access to the NHRP service.&lt;br /&gt;
&lt;br /&gt;
{{Tip|At the time of this writing the recommended Alpine version for building a DMVPN should be at minimum 2.4.11. Don&#039;t use 2.5.x, or 2.6.0 since the kernel has in-tunnel IP fragmentation issues. Alpine 2.6.1 or later should be okay instead.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|This document assumes that all Alpine installations are run in [[Installation#Basics|diskless mode]] and that the configuration is saved on USB key}}&lt;br /&gt;
&lt;br /&gt;
= Hardware =&lt;br /&gt;
If you are looking for hundreds of megabits of throughput for your VPN with a limited budget, you should consider using [http://www.via.com.tw/en/initiatives/padlock/hardware.jsp VIA Padlock] engine present in VIA processor C7, Eden, Nano and Quad. If you need gigabits throughput you should go instead for an Intel Xeon processor with [http://software.intel.com/en-us/articles/intel-advanced-encryption-standard-instructions-aes-ni AES-NI] and [http://software.intel.com/en-us/articles/intel-sha-extensions SHA Extensions]&lt;br /&gt;
&lt;br /&gt;
For supporting VIA Padlock engine enable its modules:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|echo -e &amp;quot;padlock_aes\npadlock-sha&amp;quot; &amp;gt;&amp;gt; /etc/modules}}&lt;br /&gt;
&lt;br /&gt;
= Extract Certificates =&lt;br /&gt;
We will use certificates for DMVPN and for OpenVPN (RoadWarrior clients). If you are in need to generate your own certificates, please see [[Generating_SSL_certs_with_ACF]]. You should use a separate machine for this purpose. If you downloaded the certificates on a Windows machine, you may use [http://winscp.net/eng/download.php WinSCP] to copy them on the DMVPN box.&lt;br /&gt;
&lt;br /&gt;
Here are the general purpose instruction for extracting certificates from pfx files:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|openssl pkcs12 -in cert.pfx -cacerts -nokeys -out cacert.pem&lt;br /&gt;
openssl pkcs12 -in cert.pfx -nocerts -nodes -out serverkey.pem&lt;br /&gt;
openssl pkcs12 -in cert.pfx -nokeys -clcerts -out cert.pem&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Set appropriate permission for your certificate files:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|chmod 600 *.pem *.pfx}}&lt;br /&gt;
&lt;br /&gt;
= Spoke Node =&lt;br /&gt;
A local spoke node network has support for multiple ISP connections, along with redundant layer 2 switches.  At least one 802.1q capable switch is required, and a second is optional for redundancy purposes.  The typical spoke node network looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:DMVPN-Spoke.png]]&lt;br /&gt;
&lt;br /&gt;
== Alpine Setup ==&lt;br /&gt;
We will setup the network interfaces as follows:&lt;br /&gt;
&lt;br /&gt;
bond0.3 = Management &#039;&#039;&#039;(not implemented below yet)&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
bond0.8 = LAN&amp;lt;br&amp;gt;&lt;br /&gt;
bond0.64 = DMZ&amp;lt;br&amp;gt;&lt;br /&gt;
bond0.80 = Voice &#039;&#039;&#039;(not implemented below yet)&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
bond0.96 = Internet Access Only (no access to the DMVPN network)&#039;&#039;&#039;(not implemented below yet)&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
bond0.256 = ISP1&amp;lt;br&amp;gt;&lt;br /&gt;
bond0.257 = ISP2&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Boot Alpine in [[Installation#Basics|diskless mode]] and run &amp;lt;code&amp;gt;[[setup-alpine]]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!&#039;&#039;&#039;You will be prompted something like this...&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Suggestion on what you could enter...&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Select keyboard layout [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Type an appropriate layout for you&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Select variant:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Type an appropriate layout for you (if prompted)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter system hostname (short form, e.g. &#039;foo&#039;) [localhost]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter the hostname, e.g.&#039;&#039; &#039;&#039;&#039;vpnc&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Available interfaces are: eth0&amp;lt;br&amp;gt;Enter &#039;?&#039; for help on bridges, bonding and vlans.&amp;lt;br&amp;gt;Which one do you want to initialize? (or &#039;?&#039; done&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter&#039;&#039; &#039;&#039;&#039;bond0.8&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Available bond slaves are: eth0 eth1&amp;lt;br&amp;gt;Which slave(s) do you want to add to bond0? (or &#039;done&#039;) [eth0]&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;&#039;eth0 eth1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IP address for bond0? (or &#039;dhcp&#039;, &#039;none&#039;, &#039;?&#039;) [dhcp]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IP address for bond0.8? (or &#039;dhcp&#039;, &#039;none&#039;, &#039;?&#039;) [dhcp]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter the IP address of your LAN interface, e.g.&#039;&#039; &#039;&#039;&#039;10.1.0.1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Netmask? [255.255.255.0]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;255.255.255.0&#039; or type another appropriate subnet mask&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Gateway? (or &#039;none&#039;) [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Do you want to do any manual network configuration? [no]&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;&#039;yes&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;Make a copy of the bond0.8 configuration for bond0.64, bond0.256 and bond0.257 (optional) interfaces.&amp;lt;br&amp;gt;Don&#039;t forget to add a gateway and a metric value for ISP interfaces when multiple gateways are set.&amp;lt;br&amp;gt;Save and close the file (:wq)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DNS domain name? (e.g. &#039;bar.com&#039;) []:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter the domain name of your intranet, e.g.,&#039;&#039; &#039;&#039;&#039;example.net&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DNS nameservers(s)? []:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;&#039;8.8.8.8 8.8.4.4&#039;&#039;&#039; (we will change them later)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Changing password for root&amp;lt;br&amp;gt;New password:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter a secure password for the console&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Retype password:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Retype the above password&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which timezone are you in? (&#039;?&#039; for list) [UTC]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;UTC&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;HTTP/FTP proxy URL? (e.g. &#039;http://proxy:8080&#039;, or &#039;none&#039;) [none]&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter mirror number (1-9) or URL to add (or r/f/e/done) [f]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Select a mirror close to you and press Enter&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which SSH server? (&#039;openssh&#039;, &#039;dropbear&#039; or &#039;none&#039;) [openssh]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;openssh&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which NTP client to run? (&#039;openntpd&#039;, &#039;chrony&#039; or &#039;none&#039;) [chrony]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;chrony&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which disk(s) would you like to use? (or &#039;?&#039; for help or &#039;none&#039;) [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039; or type &#039;none&#039; if needed&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter where to store configs (&#039;floppy&#039;, &#039;usb&#039; or &#039;none&#039;) [usb]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;usb&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter apk cache directory (or &#039;?&#039; or &#039;none&#039;) [/media/usb/cache]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;/media/usb/cache&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bonding ==&lt;br /&gt;
Update the bonding configuration:&lt;br /&gt;
&lt;br /&gt;
{{cmd|echo bonding mode{{=}}balance-tlb miimon{{=}}100 updelay{{=}}500 &amp;gt;&amp;gt; /etc/modules}}&lt;br /&gt;
&lt;br /&gt;
== Physically install ==&lt;br /&gt;
At this point, you&#039;re ready to connect the VPN Spoke Node to the network if you haven&#039;t already done so.  Please set up an 802.1q capable switch with the VLANs listed in AlpineSetup section.  Once done, tag all of the VLANs on one port.  Connect that port to &amp;lt;code&amp;gt;eth0&amp;lt;/code&amp;gt;.  Then, connect your first ISP&#039;s CPE to a switchport with VLAN 256 untagged.&lt;br /&gt;
&lt;br /&gt;
== SSH ==&lt;br /&gt;
Remove password authentication and DNS reverse lookup:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|sed -i &amp;quot;s/.PasswordAuthentication yes/PasswordAuthentication no/&amp;quot; /etc/ssh/sshd_config&lt;br /&gt;
sed -i &amp;quot;s/.UseDNS yes/UseDNS no/&amp;quot; /etc/ssh/sshd_config}}&lt;br /&gt;
&lt;br /&gt;
== NTP server ==&lt;br /&gt;
In order to have attached devices syncing their time agains this host, we need to do some modifications to chrony config.&amp;lt;BR&amp;gt;&lt;br /&gt;
Add &#039;&amp;lt;code&amp;gt;allow all&amp;lt;/code&amp;gt;&#039; to the end of the &#039;&amp;lt;code&amp;gt;/etc/chrony/chrony.conf&amp;lt;/code&amp;gt;&#039; so the file looks something like this:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/chrony/chrony.conf|&lt;br /&gt;
server pool.ntp.org &lt;br /&gt;
initstepslew 10 pool.ntp.org&lt;br /&gt;
commandkey 10&lt;br /&gt;
keyfile /etc/chrony/chrony.keys&lt;br /&gt;
driftfile /etc/chrony/chrony.drift&lt;br /&gt;
allow all&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Restart chronyd for the changes to take effect&lt;br /&gt;
 {{cmd|/etc/init.d/chronyd restart}}&lt;br /&gt;
&lt;br /&gt;
== Recursive DNS  ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add -U unbound}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/unbound/unbound.conf&amp;lt;/code&amp;gt; and add the following configuration.  If you have a domain that you want unbound to resolve but is internal to your network only, the stub-zone stanza is present:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/unbound/unbound.conf|&lt;br /&gt;
server:&lt;br /&gt;
        verbosity: 1&lt;br /&gt;
        interface: 10.1.0.1&lt;br /&gt;
        do-ip4: yes&lt;br /&gt;
        do-ip6: no&lt;br /&gt;
        do-udp: yes&lt;br /&gt;
        do-tcp: yes&lt;br /&gt;
        do-daemonize: yes&lt;br /&gt;
        access-control: 10.1.0.0/16 allow&lt;br /&gt;
        access-control: 127.0.0.0/8 allow&lt;br /&gt;
&lt;br /&gt;
do-not-query-localhost: no&lt;br /&gt;
&lt;br /&gt;
root-hints: &amp;quot;/etc/unbound/root.hints&amp;quot;&lt;br /&gt;
&lt;br /&gt;
stub-zone:&lt;br /&gt;
	name: &amp;quot;location1.example.net&amp;quot;&lt;br /&gt;
	stub-addr: 10.1.0.2&lt;br /&gt;
&lt;br /&gt;
stub-zone:&lt;br /&gt;
        name: &amp;quot;example.net&amp;quot;&lt;br /&gt;
        stub-addr: 172.16.255.1&lt;br /&gt;
        stub-addr: 172.16.255.2&lt;br /&gt;
        stub-addr: 172.16.255.3&lt;br /&gt;
        stub-addr: 172.16.255.4&lt;br /&gt;
        stub-addr: 172.16.255.5&lt;br /&gt;
        stub-addr: 172.16.255.7&lt;br /&gt;
&lt;br /&gt;
stub-zone:&lt;br /&gt;
        name: &amp;quot;example2.net&amp;quot;&lt;br /&gt;
        stub-addr: 172.16.255.1&lt;br /&gt;
        stub-addr: 172.16.255.2&lt;br /&gt;
        stub-addr: 172.16.255.3&lt;br /&gt;
        stub-addr: 172.16.255.4&lt;br /&gt;
        stub-addr: 172.16.255.5&lt;br /&gt;
        stub-addr: 172.16.255.7&lt;br /&gt;
&lt;br /&gt;
python:&lt;br /&gt;
remote-control:&lt;br /&gt;
        control-enable: no&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start unbound and start using unbound on this host:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/unbound start&lt;br /&gt;
rc-update add unbound&lt;br /&gt;
echo nameserver 10.1.0.1 &amp;gt; /etc/resolv.conf}}&lt;br /&gt;
&lt;br /&gt;
== Local DNS Zone ==&lt;br /&gt;
If you have a DNS zone that is only resolvable internally to your network, you will need a 2nd IP address on your LAN interface, and use NSD to host the zone.&lt;br /&gt;
&lt;br /&gt;
First, add the following to the end of the &amp;lt;code&amp;gt;bond0.8&amp;lt;/code&amp;gt; stanza:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|&lt;br /&gt;
auto bond0.8&lt;br /&gt;
     ...&lt;br /&gt;
     ...&lt;br /&gt;
     up ip addr add 10.1.0.2/24 dev bond0.8&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add nsd}}&lt;br /&gt;
&lt;br /&gt;
Create &amp;lt;code&amp;gt;/etc/nsd/nsd.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/nsd/nsd.conf|&lt;br /&gt;
server:&lt;br /&gt;
        ip-address: 10.1.0.2&lt;br /&gt;
        port: 53&lt;br /&gt;
        server-count: 1&lt;br /&gt;
        ip4-only: yes&lt;br /&gt;
        hide-version: yes&lt;br /&gt;
        identity: &amp;quot;&amp;quot;&lt;br /&gt;
        zonesdir: &amp;quot;/etc/nsd&amp;quot;&lt;br /&gt;
zone:&lt;br /&gt;
        name: location1.example.net&lt;br /&gt;
        zonefile: location1.example.net.zone&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create zonefile in &amp;lt;code&amp;gt;/etc/nsd/location1.example.net.zone&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/nsd/location1.example.net.zone|&lt;br /&gt;
;## location1.example.net authoritative zone&lt;br /&gt;
&lt;br /&gt;
$ORIGIN location1.example.net.&lt;br /&gt;
$TTL 86400&lt;br /&gt;
&lt;br /&gt;
@ IN SOA ns1.location1.example.net. webmaster.location1.example.net. (&lt;br /&gt;
                2013081901      ; serial&lt;br /&gt;
                28800           ; refresh&lt;br /&gt;
                7200            ; retry&lt;br /&gt;
                86400           ; expire&lt;br /&gt;
                86400           ; min TTL&lt;br /&gt;
                )&lt;br /&gt;
&lt;br /&gt;
                NS              ns1.location1.example.net.&lt;br /&gt;
                MX      10      mail.location1.example.net.&lt;br /&gt;
ns              IN      A       10.1.0.2&lt;br /&gt;
mail            IN      A       10.1.0.4&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Check configuration then start:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|nsd-checkconf /etc/nsd/nsd.conf&lt;br /&gt;
nsdc rebuild&lt;br /&gt;
/etc/init.d/nsd start&lt;br /&gt;
rc-update add nsd}}&lt;br /&gt;
&lt;br /&gt;
== GRE Tunnel ==&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; and add the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|&lt;br /&gt;
auto gre1&lt;br /&gt;
iface gre1 inet static&lt;br /&gt;
      pre-up ip tunnel add $IFACE mode gre ttl 64 tos inherit key 12.34.56.78 || true&lt;br /&gt;
      address 172.16.1.1&lt;br /&gt;
      netmask 255.255.0.0&lt;br /&gt;
      post-down ip tunnel del $IFACE || true&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Bring up the new &amp;lt;code&amp;gt;gre1&amp;lt;/code&amp;gt; interface:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ifup gre1}}&lt;br /&gt;
&lt;br /&gt;
== IPSEC ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add ipsec-tools}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor create &amp;lt;code&amp;gt;/etc/ipsec.conf&amp;lt;/code&amp;gt; and set the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/ipsec.conf|&lt;br /&gt;
spdflush;&lt;br /&gt;
spdadd 0.0.0.0/0 0.0.0.0/0 gre -P out	ipsec esp/transport//require;&lt;br /&gt;
spdadd 0.0.0.0/0 0.0.0.0/0 gre -P in 	ipsec esp/transport//require;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create missing directory:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|mkdir /etc/racoon/}}&lt;br /&gt;
&lt;br /&gt;
Extract your pfx into &amp;lt;code&amp;gt;/etc/racoon&amp;lt;/code&amp;gt;, using the filenames &#039;&#039;&#039;&amp;lt;code&amp;gt;ca.pem&amp;lt;/code&amp;gt;&#039;&#039;&#039;, &#039;&#039;&#039;&amp;lt;code&amp;gt;cert.pem&amp;lt;/code&amp;gt;&#039;&#039;&#039;, and &#039;&#039;&#039;&amp;lt;code&amp;gt;key.pem&amp;lt;/code&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor create &amp;lt;code&amp;gt;/etc/racoon/racoon.conf&amp;lt;/code&amp;gt; and set the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/racoon/racoon.conf|&lt;br /&gt;
path certificate &amp;quot;/etc/racoon/&amp;quot;;&lt;br /&gt;
remote anonymous {&lt;br /&gt;
	exchange_mode main;&lt;br /&gt;
	lifetime time 2 hour;&lt;br /&gt;
	certificate_type x509 &amp;quot;/etc/racoon/cert.pem&amp;quot; &amp;quot;/etc/racoon/key.pem&amp;quot;;&lt;br /&gt;
	ca_type x509 &amp;quot;/etc/racoon/ca.pem&amp;quot;;&lt;br /&gt;
	my_identifier asn1dn;&lt;br /&gt;
	nat_traversal on;&lt;br /&gt;
        script &amp;quot;/etc/opennhrp/racoon-ph1dead.sh&amp;quot; phase1_dead;&lt;br /&gt;
	dpd_delay 120;&lt;br /&gt;
	proposal {&lt;br /&gt;
		encryption_algorithm aes 256;&lt;br /&gt;
		hash_algorithm sha1;&lt;br /&gt;
		authentication_method rsasig;&lt;br /&gt;
		dh_group modp4096;&lt;br /&gt;
	}&lt;br /&gt;
	proposal {&lt;br /&gt;
		encryption_algorithm aes 256;&lt;br /&gt;
		hash_algorithm sha1;&lt;br /&gt;
		authentication_method rsasig;&lt;br /&gt;
		dh_group 2;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sainfo anonymous {&lt;br /&gt;
	pfs_group 2;&lt;br /&gt;
	lifetime time 2 hour;&lt;br /&gt;
	encryption_algorithm aes 256;&lt;br /&gt;
	authentication_algorithm hmac_sha1;&lt;br /&gt;
	compression_algorithm deflate;&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;/etc/conf.d/racoon&amp;lt;/code&amp;gt; and unset &amp;lt;code&amp;gt;RACOON_PSK_FILE&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/conf.d/racoon|&lt;br /&gt;
...&lt;br /&gt;
RACOON_PSK_FILE{{=}}&lt;br /&gt;
...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/racoon start&lt;br /&gt;
rc-update add racoon}}&lt;br /&gt;
&lt;br /&gt;
== Next Hop Resolution Protocol (NHRP) ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add opennhrp}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp.conf&amp;lt;/code&amp;gt; and change the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/opennhrp/opennhrp.conf|&lt;br /&gt;
interface gre1&lt;br /&gt;
	dynamic-map 172.16.0.0/16 hub.example.com&lt;br /&gt;
	shortcut&lt;br /&gt;
	redirect&lt;br /&gt;
	non-caching&lt;br /&gt;
&lt;br /&gt;
interface bond0.8&lt;br /&gt;
	shortcut-destination&lt;br /&gt;
&lt;br /&gt;
interface bond0.64&lt;br /&gt;
	shortcut-destination&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
You must have a DNS A record &#039;&#039;&amp;lt;code&amp;gt;hub.example.com&amp;lt;/code&amp;gt;&#039;&#039; for each hub node IP address.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp-script&amp;lt;/code&amp;gt; and change the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/opennhrp/opennhrp-script|&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
MYAS=$(sed -n &#039;s/router bgp \(\d*\)/\1/p&#039; &amp;lt; /etc/quagga/bgpd.conf)&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
interface-up)&lt;br /&gt;
    echo &amp;quot;Interface $NHRP_INTERFACE is up&amp;quot;&lt;br /&gt;
    if [ &amp;quot;$NHRP_INTERFACE&amp;quot; = &amp;quot;gre1&amp;quot; ]; then&lt;br /&gt;
        ip route flush proto 42 dev $NHRP_INTERFACE&lt;br /&gt;
        ip neigh flush dev $NHRP_INTERFACE&lt;br /&gt;
&lt;br /&gt;
        vtysh -d bgpd \&lt;br /&gt;
            -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
            -c &amp;quot;router bgp $MYAS&amp;quot; \&lt;br /&gt;
            -c &amp;quot;no neighbor core&amp;quot; \&lt;br /&gt;
            -c &amp;quot;neighbor core peer-group&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    ;;&lt;br /&gt;
peer-register)&lt;br /&gt;
    ;;&lt;br /&gt;
peer-up)&lt;br /&gt;
    if [ -n &amp;quot;$NHRP_DESTMTU&amp;quot; ]; then&lt;br /&gt;
        ARGS=`ip route get $NHRP_DESTNBMA from $NHRP_SRCNBMA | head -1`&lt;br /&gt;
        ip route add $ARGS proto 42 mtu $NHRP_DESTMTU&lt;br /&gt;
    fi&lt;br /&gt;
    echo &amp;quot;Create link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
    racoonctl establish-sa -w isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA || exit 1&lt;br /&gt;
    racoonctl establish-sa -w esp inet $NHRP_SRCNBMA $NHRP_DESTNBMA gre || exit 1&lt;br /&gt;
    ;;&lt;br /&gt;
peer-down)&lt;br /&gt;
    echo &amp;quot;Delete link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
    racoonctl delete-sa isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA&lt;br /&gt;
    ip route del $NHRP_DESTNBMA src $NHRP_SRCNBMA proto 42&lt;br /&gt;
    ;;&lt;br /&gt;
nhs-up)&lt;br /&gt;
    echo &amp;quot;NHS UP $NHRP_DESTADDR&amp;quot;&lt;br /&gt;
    (&lt;br /&gt;
        flock -x 200&lt;br /&gt;
        vtysh -d bgpd \&lt;br /&gt;
            -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
            -c &amp;quot;router bgp $MYAS&amp;quot; \&lt;br /&gt;
            -c &amp;quot;neighbor $NHRP_DESTADDR remote-as 65000&amp;quot; \&lt;br /&gt;
            -c &amp;quot;neighbor $NHRP_DESTADDR peer-group core&amp;quot; \&lt;br /&gt;
            -c &amp;quot;exit&amp;quot; \&lt;br /&gt;
            -c &amp;quot;exit&amp;quot; \&lt;br /&gt;
            -c &amp;quot;clear bgp $NHRP_DESTADDR&amp;quot;&lt;br /&gt;
    ) 200&amp;gt;/var/lock/opennhrp-script.lock&lt;br /&gt;
    ;;&lt;br /&gt;
nhs-down)&lt;br /&gt;
    (&lt;br /&gt;
        flock -x 200&lt;br /&gt;
        vtysh -d bgpd \&lt;br /&gt;
            -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
            -c &amp;quot;router bgp $MYAS&amp;quot; \&lt;br /&gt;
            -c &amp;quot;no neighbor $NHRP_DESTADDR&amp;quot;&lt;br /&gt;
    ) 200&amp;gt;/var/lock/opennhrp-script.lock&lt;br /&gt;
    ;;&lt;br /&gt;
route-up)&lt;br /&gt;
    echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is up&amp;quot;&lt;br /&gt;
    ip route replace $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42 via $NHRP_NEXTHOP dev $NHRP_INTERFACE&lt;br /&gt;
    ip route flush cache&lt;br /&gt;
    ;;&lt;br /&gt;
route-down)&lt;br /&gt;
    echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is down&amp;quot;&lt;br /&gt;
    ip route del $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42&lt;br /&gt;
    ip route flush cache&lt;br /&gt;
    ;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Make it executable and start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|chmod +x /etc/opennhrp/opennhrp-script&lt;br /&gt;
/etc/init.d/opennhrp start&lt;br /&gt;
rc-update add opennhrp}}&lt;br /&gt;
&lt;br /&gt;
== BGP ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add quagga&lt;br /&gt;
touch /etc/quagga/zebra.conf}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/quagga/bgpd.conf&amp;lt;/code&amp;gt; and change the content to the following (replace &amp;lt;code&amp;gt;strongpassword&amp;lt;/code&amp;gt; with a password of your choice and &amp;lt;code&amp;gt;%HUB_GRE_IP%&amp;lt;/code&amp;gt; with the &#039;&#039;&#039;Hub&#039;&#039;&#039; node GRE IP address):&lt;br /&gt;
* Add the line &amp;lt;code&amp;gt;neighbor %HUB_GRE_IP% remote-as 65000&amp;lt;/code&amp;gt; for each &#039;&#039;&#039;Hub&#039;&#039;&#039; host you have in your NBMA cloud.&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/quagga/bgpd.conf|&lt;br /&gt;
password strongpassword&lt;br /&gt;
enable password strongpassword&lt;br /&gt;
log syslog&lt;br /&gt;
&lt;br /&gt;
access-list 1 remark Command line access authorized IP&lt;br /&gt;
access-list 1 permit 127.0.0.1&lt;br /&gt;
line vty&lt;br /&gt;
 access-class 1&lt;br /&gt;
&lt;br /&gt;
hostname vpnc.example.net&lt;br /&gt;
&lt;br /&gt;
router bgp 65001&lt;br /&gt;
	bgp router-id 172.16.1.1&lt;br /&gt;
	network 10.1.0.0/16&lt;br /&gt;
	neighbor %HUB_GRE_IP% remote-as 65000&lt;br /&gt;
	neighbor %HUB_GRE_IP% remote-as 65000&lt;br /&gt;
        ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/bgpd start&lt;br /&gt;
rc-update add bgpd}}&lt;br /&gt;
&lt;br /&gt;
== OpenVPN ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|echo tun &amp;gt;&amp;gt; /etc/modules&lt;br /&gt;
modprobe tun&lt;br /&gt;
apk add openvpn openssl&lt;br /&gt;
openssl dhparam -out /etc/openvpn/dh1024.pem 1024}}&lt;br /&gt;
&lt;br /&gt;
Configure openvpn:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/openvpn/openvpn.conf|&lt;br /&gt;
dev tun&lt;br /&gt;
proto udp&lt;br /&gt;
port 1194&lt;br /&gt;
&lt;br /&gt;
server 10.1.128.0 255.255.255.0&lt;br /&gt;
push &amp;quot;route 10.0.0.0 255.0.0.0&amp;quot;&lt;br /&gt;
push &amp;quot;dhcp-option DNS 10.1.0.1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
tls-server&lt;br /&gt;
ca /etc/openvpn/cacert.pem&lt;br /&gt;
cert /etc/openvpn/servercert.pem&lt;br /&gt;
key /etc/openvpn/serverkey.pem&lt;br /&gt;
&lt;br /&gt;
crl-verify /etc/openvpn/crl.pem&lt;br /&gt;
&lt;br /&gt;
dh /etc/openvpn/dh1024.pem&lt;br /&gt;
&lt;br /&gt;
persist-key&lt;br /&gt;
persist-tun&lt;br /&gt;
&lt;br /&gt;
keepalive 10 120&lt;br /&gt;
&lt;br /&gt;
comp-lzo&lt;br /&gt;
&lt;br /&gt;
status /var/log/openvpn.status&lt;br /&gt;
mute 20&lt;br /&gt;
verb 3&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/openvpn start&lt;br /&gt;
rc-update add openvpn}}&lt;br /&gt;
&lt;br /&gt;
== Firewall ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add awall}}&lt;br /&gt;
&lt;br /&gt;
Enable IP forwarding:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|sysctl -w net.ipv4.ip_forward{{=}}1&lt;br /&gt;
sed -i &#039;s/.*net\.ipv4\.ip_forward.*$/net.ipv4.ip_forward {{=}} 1/g&#039; /etc/sysctl.conf}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor, edit the following files and set their contents as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/params.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;params&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;B_IF&amp;quot; {{=}} &amp;quot;bond0.8&amp;quot;,&lt;br /&gt;
    &amp;quot;C_IF&amp;quot; {{=}} &amp;quot;bond0.64&amp;quot;,&lt;br /&gt;
    &amp;quot;ISP1_IF&amp;quot; {{=}} &amp;quot;bond0.256&amp;quot;,&lt;br /&gt;
    &amp;quot;ISP2_IF&amp;quot; {{=}} &amp;quot;bond0.257&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/internet-host.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Internet host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;params&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;E&amp;quot;: { &amp;quot;iface&amp;quot;: [ &amp;quot;$ISP1_IF&amp;quot;, &amp;quot;$ISP2_IF&amp;quot; ] },&lt;br /&gt;
    &amp;quot;ISP1&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$ISP1_IF&amp;quot; },&lt;br /&gt;
    &amp;quot;ISP2&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$ISP2_IF&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ping&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;,&lt;br /&gt;
      &amp;quot;flow-limit&amp;quot;: { &amp;quot;count&amp;quot;: 10, &amp;quot;interval&amp;quot;: 6 }&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ssh&amp;quot;, &amp;quot;https&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;,&lt;br /&gt;
      &amp;quot;conn-limit&amp;quot;: { &amp;quot;count&amp;quot;: 3, &amp;quot;interval&amp;quot;: 60 }&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;dns&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;ntp&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ping&amp;quot;, &amp;quot;ssh&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/openvpn.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;OpenVPN support&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;internet-host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;service&amp;quot;: { &lt;br /&gt;
     &amp;quot;openvpn&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;udp&amp;quot;, &amp;quot;port&amp;quot;: 1194 }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [ &lt;br /&gt;
     { &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;openvpn&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
    ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/clampmss.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Deal with ISPs afraid of ICMP&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;internet-host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;clamp-mss&amp;quot;: [ { &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot; } ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/mark.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Mark traffic based on ISP&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: [ &amp;quot;params&amp;quot;, &amp;quot;internet-host&amp;quot; ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;route-track&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;ISP1&amp;quot;, &amp;quot;mark&amp;quot;: 1 },&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;ISP2&amp;quot;, &amp;quot;mark&amp;quot;: 2 }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/dmvpn.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;DMVPN router&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;internet-host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;A_ADDR&amp;quot;: [ &amp;quot;10.0.0.0/8&amp;quot;, &amp;quot;172.16.0.0/16&amp;quot; ]&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;A&amp;quot;: { &amp;quot;addr&amp;quot;: &amp;quot;$A_ADDR&amp;quot;, &amp;quot;iface&amp;quot;: &amp;quot;gre1&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;ipsec&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;ipsec&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;ipsec&amp;quot;: &amp;quot;in&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;gre&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;ipsec&amp;quot;: &amp;quot;out&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;gre&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;bgp&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;bgp&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;},&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;dest&amp;quot;: &amp;quot;$A_ADDR&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;reject&amp;quot; }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/vpnc.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;VPNc&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: [ &amp;quot;params&amp;quot;, &amp;quot;internet-host&amp;quot;, &amp;quot;dmvpn&amp;quot; ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;B&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$B_IF&amp;quot; },&lt;br /&gt;
    &amp;quot;C&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$C_IF&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;policy&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;B&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;C&amp;quot;, &amp;quot;out&amp;quot;: [ &amp;quot;A&amp;quot;, &amp;quot;E&amp;quot; ], &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;drop&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;snat&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;A&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ping&amp;quot;, &amp;quot;ssh&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;https&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: [ &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot; ],&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;dns&amp;quot;, &amp;quot;ntp&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;https&amp;quot;, &amp;quot;ssh&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: [ &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot; ],&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;dns&amp;quot;, &amp;quot;ntp&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    { &lt;br /&gt;
      &amp;quot;in&amp;quot;: [ &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot; ],&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;proto&amp;quot;: &amp;quot;icmp&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Activate the firewall:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|modprobe ip_tables&lt;br /&gt;
modprobe iptable_nat &lt;br /&gt;
awall enable clampmss&lt;br /&gt;
awall enable openvpn&lt;br /&gt;
awall enable vpnc&lt;br /&gt;
awall activate&lt;br /&gt;
rc-update add iptables}}&lt;br /&gt;
&lt;br /&gt;
== ISP Failover ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add pingu&lt;br /&gt;
echo -e &amp;quot;1\tisp1&amp;quot;&amp;gt;&amp;gt; /etc/iproute2/rt_tables&lt;br /&gt;
echo -e &amp;quot;2\tisp2&amp;quot;&amp;gt;&amp;gt; /etc/iproute2/rt_tables}}&lt;br /&gt;
&lt;br /&gt;
Configure pingu to monitor our &amp;lt;code&amp;gt;bond0.256&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;bond0.257&amp;lt;/code&amp;gt; interfaces in &amp;lt;code&amp;gt;/etc/pingu/pingu.conf&amp;lt;/code&amp;gt;.  Add the hosts to monitor for ISP failover to &amp;lt;code&amp;gt;/etc/pingu/pingu.conf&amp;lt;/code&amp;gt; and bind to primary ISP. We also set the ping timeout to 4 seconds.:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/pingu/pingu.conf|&lt;br /&gt;
timeout 4&lt;br /&gt;
required 2&lt;br /&gt;
retry 11&lt;br /&gt;
&lt;br /&gt;
interface bond0.256 { &lt;br /&gt;
  # route-table must correspond with mark in /etc/awall/optional/mark.json&lt;br /&gt;
  route-table 1&lt;br /&gt;
  fwmark 1&lt;br /&gt;
  rule-priority 20000&lt;br /&gt;
  # google dns&lt;br /&gt;
  ping 8.8.8.8&lt;br /&gt;
  # opendns&lt;br /&gt;
  ping 208.67.222.222&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface bond0.257 {&lt;br /&gt;
  # route-table must correspond with mark in /etc/awall/optional/mark.json&lt;br /&gt;
  route-table 2&lt;br /&gt;
  fwmark 2&lt;br /&gt;
  rule-priority 20000&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Make sure we can reach the public IP from our LAN by adding static route rules for our private net(s). Edit &amp;lt;code&amp;gt;/etc/pingu/route-rules&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/pingu/route-rules|&lt;br /&gt;
to 10.0.0.0/8 table main prio 1000&lt;br /&gt;
to 172.16.0.0/12 table main prio 1000&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/pingu start&lt;br /&gt;
rc-update add pingu}}&lt;br /&gt;
&lt;br /&gt;
Now, if both hosts stop responding to pings, ISP-1 will be considered down and all gateways via bond0.256 will be removed from main route table. Note that the gateway will not be removed from the route table &#039;1&#039;. This is so we can continue try ping via &amp;lt;code&amp;gt;bond0.256&amp;lt;/code&amp;gt; so we can detect that the ISP is back online. When ISP starts working again, the gateways will be added back to main route table again.&lt;br /&gt;
&lt;br /&gt;
== Commit Configuration ==&lt;br /&gt;
Commit configuration:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|lbu ci}}&lt;br /&gt;
&lt;br /&gt;
= Hub Node =&lt;br /&gt;
We will document only what changes from the Spoke node setup.&lt;br /&gt;
&lt;br /&gt;
== Routing Tables ==&lt;br /&gt;
{{Todo|Would we need to change this command - or add some description on why it&#039;s documented?}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|echo -e &amp;quot;42\tnhrp_shortcut\n43\tnhrp_mtu\n44\tquagga\n}}&lt;br /&gt;
&lt;br /&gt;
== NHRP ==&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp.conf&amp;lt;/code&amp;gt; on Hub 2 and set the content as follows:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/opennhrp/opennhrp.conf|&lt;br /&gt;
interface gre1&lt;br /&gt;
  map %Hub1_GRE_IP%/%MaskBit% hub1.example.org&lt;br /&gt;
  route-table 44&lt;br /&gt;
  shortcut&lt;br /&gt;
  redirect&lt;br /&gt;
  non-caching&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Do the same on Hub 1 adding the data relative to Hub 2.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp-script&amp;lt;/code&amp;gt; and set the content as follows:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/opennhrp/opennhrp-script|&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
interface-up)&lt;br /&gt;
	ip route flush proto 42 dev $NHRP_INTERFACE&lt;br /&gt;
	ip neigh flush dev $NHRP_INTERFACE&lt;br /&gt;
	;;&lt;br /&gt;
peer-register)&lt;br /&gt;
	CERT=`racoonctl get-cert inet $NHRP_SRCNBMA $NHRP_DESTNBMA | openssl x509 -inform der -text -noout | egrep -o &amp;quot;/OU=[^/]*(/[0-9]+)?&amp;quot; | cut -b 5-`&lt;br /&gt;
	if [ -z &amp;quot;`echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^GRE=$NHRP_DESTADDR&amp;quot;`&amp;quot; ]; then&lt;br /&gt;
		logger -t opennhrp-script -p auth.err &amp;quot;GRE registration of $NHRP_DESTADDR to $NHRP_DESTNBMA DENIED&amp;quot;&lt;br /&gt;
		exit 1&lt;br /&gt;
	fi&lt;br /&gt;
	logger -t opennhrp-script -p auth.info &amp;quot;GRE registration of $NHRP_DESTADDR to $NHRP_DESTNBMA authenticated&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	(&lt;br /&gt;
		flock -x 200&lt;br /&gt;
		&lt;br /&gt;
		AS=`echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^AS=&amp;quot; | cut -b 4-`&lt;br /&gt;
		vtysh -d bgpd -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
			-c &amp;quot;router bgp 65000&amp;quot; \&lt;br /&gt;
			-c &amp;quot;neighbor $NHRP_DESTADDR remote-as $AS&amp;quot; \&lt;br /&gt;
			-c &amp;quot;neighbor $NHRP_DESTADDR peer-group leaf&amp;quot; \&lt;br /&gt;
			-c &amp;quot;neighbor $NHRP_DESTADDR prefix-list net-$AS-in in&amp;quot;&lt;br /&gt;
&lt;br /&gt;
		SEQ=5&lt;br /&gt;
		(echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^NET=&amp;quot; | cut -b 5-) | while read NET; do&lt;br /&gt;
			vtysh -d bgpd -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
				-c &amp;quot;ip prefix-list net-$AS-in seq $SEQ permit $NET le 26&amp;quot;&lt;br /&gt;
			SEQ=$(($SEQ+5))&lt;br /&gt;
		done&lt;br /&gt;
	) 200&amp;gt;/var/lock/opennhrp-script.lock&lt;br /&gt;
	;;&lt;br /&gt;
peer-up)&lt;br /&gt;
	echo &amp;quot;Create link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
	racoonctl establish-sa -w isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA || exit 1&lt;br /&gt;
	racoonctl establish-sa -w esp inet $NHRP_SRCNBMA $NHRP_DESTNBMA gre || exit 1 &lt;br /&gt;
&lt;br /&gt;
	CERT=`racoonctl get-cert inet $NHRP_SRCNBMA $NHRP_DESTNBMA | openssl x509 -inform der -text -noout | egrep -o &amp;quot;/OU=[^/]*(/[0-9]+)?&amp;quot; | cut -b 5-`&lt;br /&gt;
	if [ -z &amp;quot;`echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^GRE=$NHRP_DESTADDR&amp;quot;`&amp;quot; ]; then&lt;br /&gt;
		logger -p daemon.err &amp;quot;GRE mapping of $NHRP_DESTADDR to $NHRP_DESTNBMA DENIED&amp;quot;&lt;br /&gt;
		exit 1&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	if [ -n &amp;quot;$NHRP_DESTMTU&amp;quot; ]; then&lt;br /&gt;
		ARGS=`ip route get $NHRP_DESTNBMA from $NHRP_SRCNBMA | head -1`&lt;br /&gt;
		ip route add $ARGS proto 42 mtu $NHRP_DESTMTU table nhrp_mtu&lt;br /&gt;
	fi&lt;br /&gt;
	;;&lt;br /&gt;
peer-down)&lt;br /&gt;
	echo &amp;quot;Delete link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
	if [ &amp;quot;$NHRP_PEER_DOWN_REASON&amp;quot; != &amp;quot;lower-down&amp;quot; ]; then&lt;br /&gt;
		racoonctl delete-sa isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA&lt;br /&gt;
	fi&lt;br /&gt;
	ip route del $NHRP_DESTNBMA src $NHRP_SRCNBMA proto 42 table nhrp_mtu&lt;br /&gt;
	;;&lt;br /&gt;
route-up)&lt;br /&gt;
	echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is up&amp;quot;&lt;br /&gt;
	ip route replace $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42 via $NHRP_NEXTHOP dev $NHRP_INTERFACE table nhrp_shortcut&lt;br /&gt;
	ip route flush cache&lt;br /&gt;
	;;&lt;br /&gt;
route-down)&lt;br /&gt;
	echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is down&amp;quot;&lt;br /&gt;
	ip route del $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42 table nhrp_shortcut&lt;br /&gt;
	ip route flush cache&lt;br /&gt;
	;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== BGP ==&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/quagga/bgpd.conf&amp;lt;/code&amp;gt; on Hub 2 and set the content as follows:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/quagga/bgpd.conf|&lt;br /&gt;
password zebra&lt;br /&gt;
enable password zebra&lt;br /&gt;
log syslog&lt;br /&gt;
&lt;br /&gt;
router bgp 65000&lt;br /&gt;
 bgp router-id %Hub2_GRE_IP%&lt;br /&gt;
 bgp deterministic-med&lt;br /&gt;
 network %GRE_NETWORK%/%MASK_BITS%&lt;br /&gt;
 neighbor hub peer-group&lt;br /&gt;
 neighbor hub next-hop-self&lt;br /&gt;
 neighbor hub route-map CORE-IN in&lt;br /&gt;
 neighbor spoke peer-group&lt;br /&gt;
 neighbor spoke passive&lt;br /&gt;
 neighbor spoke next-hop-self&lt;br /&gt;
 neighbor %Spoke1_GRE_IP% remote-as 65001&lt;br /&gt;
 neighbor %Spoke1_GRE_IP% peer-group spoke&lt;br /&gt;
 neighbor %Spoke1_GRE_IP% prefix-list net-65001-in in&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
 neighbor hub remote-as 65000&lt;br /&gt;
 neighbor %Hub1_GRE_IP% peer-group core&lt;br /&gt;
&lt;br /&gt;
 ip prefix-list net-65001-in seq 5 permit 10.1.0.0/16 le 26&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
 route-map CORE-IN permit 10&lt;br /&gt;
 set metric +100&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Add the lines &amp;lt;code&amp;gt;neighbor %Spoke1_GRE_IP%...&amp;lt;/code&amp;gt; for each spoke node you have. Do the same on Hub 1, changing the relevant data for Hub 2.&lt;br /&gt;
&lt;br /&gt;
= Troubleshooting the DMVPN =&lt;br /&gt;
== Broken [http://en.wikipedia.org/wiki/Path_MTU_Discovery Path MTU Discovery (PMTUD)] ==&lt;br /&gt;
ISPs afraid of ICMP (which is somehow legitimate) often just blindly add &amp;lt;code&amp;gt;no ip unreachables&amp;lt;/code&amp;gt; in their router interfaces, effectively creating a [http://en.wikipedia.org/wiki/Black_hole_%28networking%29 blackhole router] that breaks PMTUD, since ICMP Type 3 Code 4 packets (Fragmentation Needed) are dropped. PMTUD is needed by ISAKMP that runs on UDP (TCP works because it uses CLAMPMSS).&lt;br /&gt;
&lt;br /&gt;
For technical details see http://packetlife.net/blog/2008/oct/9/disabling-unreachables-breaks-pmtud/&lt;br /&gt;
&lt;br /&gt;
PMTUD could also be broken due to badly configured DSL modem/routers or bugged firmware. Turning off the firewall on modem itself or any VPN passthrough functionality it may help.&lt;br /&gt;
&lt;br /&gt;
You can easily detect which host is the blackhole router by pinging with DF bit set and with packets of standard MTU size, each hop given in your traceroute to destination:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ping -M do -s 1472 %IP%}}&lt;br /&gt;
{{Note|&amp;quot;-M do&amp;quot; requires GNU ping, present in &amp;lt;code&amp;gt;iputils&amp;lt;/code&amp;gt; package}}&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t get a response back (either Echo-Response or Fragmentation-Needed) there&#039;s firewall dropping ICMP packets. If it answers to normal ping packets (DF bit cleared), most likely you have hit a blackhole router.&lt;br /&gt;
&lt;br /&gt;
== Kernel and NHRP Routing Cache Issues ==&lt;br /&gt;
{{Todo|...}}&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Template:Cat&amp;diff=9350</id>
		<title>Template:Cat</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Template:Cat&amp;diff=9350"/>
		<updated>2013-09-05T08:00:22Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Resizing text&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;{{Template}}&lt;br /&gt;
&#039;&#039;&#039;A box displaying file contents.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Template Documentation ==&lt;br /&gt;
See also:&lt;br /&gt;
&lt;br /&gt;
* [[Template:Cmd]]&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;{{Cat|/path/file|Body &#039;&#039;&#039;text&#039;&#039;&#039;&amp;lt;/nowiki&amp;gt; &amp;amp;lt;br /&amp;gt; more&amp;lt;br /&amp;gt;&lt;br /&gt;
Second line.}}&lt;br /&gt;
&lt;br /&gt;
produces:&lt;br /&gt;
&lt;br /&gt;
{{Cat|/path/file|Body &#039;&#039;&#039;text&#039;&#039;&#039; &amp;lt;br /&amp;gt; more&lt;br /&gt;
Second line.}}&lt;br /&gt;
&lt;br /&gt;
You must escape characters as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   = not inside [[..]] use &amp;amp;amp;#61; or {{=}}&lt;br /&gt;
   | not inside [[..]] use &amp;amp;amp;#124; or {{!}}&lt;br /&gt;
   {{                  use &amp;amp;amp;#123; twice or {{lb}}&lt;br /&gt;
   }}                  use &amp;amp;amp;#125; twice or {{rb}}&lt;br /&gt;
   unmatched [[        use &amp;amp;amp;#91; twice&lt;br /&gt;
   unmatched ]]        use &amp;amp;amp;#93; twice&lt;br /&gt;
   #                   use &amp;amp;amp;#35;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&amp;lt;includeonly&amp;gt;&amp;lt;div&amp;gt;&amp;lt;p style=&amp;quot;background-color:#f9f9f9; border:1px solid #2f6fab; border-bottom:0; padding:.2em 1.2em; display:inline;&amp;quot;&amp;gt;&amp;lt;strong&amp;gt;Contents of &amp;lt;/strong&amp;gt;{{Path|{{{1}}}}}&amp;lt;/p&amp;gt;&amp;lt;div style=&amp;quot;background-color:#f9f9f9; border:1px dashed #2f6fab; border-left:1px solid #2f6fab; margin-top:-.2em; line-height:1.1em; padding:1em; font-family:monospace; font-size:10pt; white-space:pre; overflow:auto;&amp;quot;&amp;gt;{{#tag:nowiki|{{{2}}}}}&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Dynamic_Multipoint_VPN_(DMVPN)&amp;diff=9349</id>
		<title>Dynamic Multipoint VPN (DMVPN)</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Dynamic_Multipoint_VPN_(DMVPN)&amp;diff=9349"/>
		<updated>2013-09-05T07:58:01Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Mostly formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
&lt;br /&gt;
http://alpinelinux.org/about under &#039;&#039;&#039;Why the Name Alpine?&#039;&#039;&#039; states: [ref?]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The first open-source implementation of Cisco&#039;s DMVPN, called OpenNHRP, was written for Alpine Linux.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
So the aim of this document is to be the reference Linux DMVPN setup, with all the networking services needed for the clients that will use the DMVPN (DNS, DHCP, firewall, etc.).&lt;br /&gt;
&lt;br /&gt;
= Terminology =&lt;br /&gt;
;NBMA: &#039;&#039;Non-Broadcast Multi-Access&#039;&#039; network as described in [http://tools.ietf.org/html/rfc2332 RFC 2332]&lt;br /&gt;
&lt;br /&gt;
;Hub: the &#039;&#039;Next Hop Server&#039;&#039; (NHS) performing the Next Hop Resolution Protocol service within the NBMA cloud.&lt;br /&gt;
&lt;br /&gt;
;Spoke: the &#039;&#039;Next Hop Resolution Protocol Client&#039;&#039; (NHC) which initiates NHRP requests of various types in order to obtain access to the NHRP service.&lt;br /&gt;
&lt;br /&gt;
{{Tip|At the time of this writing the recommended Alpine version for building a DMVPN should be at minimum 2.4.11. Don&#039;t use 2.5.x, or 2.6.0 since the kernel has in-tunnel IP fragmentation issues. Alpine 2.6.1 or later should be okay instead.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|This document assumes that all Alpine installations are run in [[Installation#Basics|diskless mode]] and that the configuration is saved on USB key}}&lt;br /&gt;
&lt;br /&gt;
= Hardware =&lt;br /&gt;
If you are looking for hundreds of megabits of throughput for your VPN with a limited budget, you should consider using [http://www.via.com.tw/en/initiatives/padlock/hardware.jsp VIA Padlock] engine present in VIA processor C7, Eden, Nano and Quad. If you need gigabits throughput you should go instead for an Intel Xeon processor with [http://software.intel.com/en-us/articles/intel-advanced-encryption-standard-instructions-aes-ni AES-NI] and [http://software.intel.com/en-us/articles/intel-sha-extensions SHA Extensions]&lt;br /&gt;
&lt;br /&gt;
For supporting VIA Padlock engine enable its modules:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|echo -e &amp;quot;padlock_aes\npadlock-sha&amp;quot; &amp;gt;&amp;gt; /etc/modules}}&lt;br /&gt;
&lt;br /&gt;
= Extract Certificates =&lt;br /&gt;
We will use certificates for DMVPN and for OpenVPN (RoadWarrior clients). If you are in need to generate your own certificates, please see [[Generating_SSL_certs_with_ACF]]. You should use a separate machine for this purpose. If you downloaded the certificates on a Windows machine, you may use [http://winscp.net/eng/download.php WinSCP] to copy them on the DMVPN box.&lt;br /&gt;
&lt;br /&gt;
Here are the general purpose instruction for extracting certificates from pfx files:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|openssl pkcs12 -in cert.pfx -cacerts -nokeys -out cacert.pem&lt;br /&gt;
openssl pkcs12 -in cert.pfx -nocerts -nodes -out serverkey.pem&lt;br /&gt;
openssl pkcs12 -in cert.pfx -nokeys -clcerts -out cert.pem&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Set appropriate permission for your certificate files:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|chmod 600 *.pem *.pfx}}&lt;br /&gt;
&lt;br /&gt;
= Spoke Node =&lt;br /&gt;
A local spoke node network has support for multiple ISP connections, along with redundant layer 2 switches.  At least one 802.1q capable switch is required, and a second is optional for redundancy purposes.  The typical spoke node network looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:DMVPN-Spoke.png]]&lt;br /&gt;
&lt;br /&gt;
== Alpine Setup ==&lt;br /&gt;
We will setup the network interfaces as follows:&lt;br /&gt;
&lt;br /&gt;
bond0.3 = Management &#039;&#039;&#039;(not implemented below yet)&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
bond0.8 = LAN&amp;lt;br&amp;gt;&lt;br /&gt;
bond0.64 = DMZ&amp;lt;br&amp;gt;&lt;br /&gt;
bond0.80 = Voice &#039;&#039;&#039;(not implemented below yet)&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
bond0.96 = Internet Access Only (no access to the DMVPN network)&#039;&#039;&#039;(not implemented below yet)&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
bond0.256 = ISP1&amp;lt;br&amp;gt;&lt;br /&gt;
bond0.257 = ISP2&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Boot Alpine in [[Installation#Basics|diskless mode]] and run &amp;lt;code&amp;gt;[[setup-alpine]]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!&#039;&#039;&#039;You will be prompted something like this...&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Suggestion on what you could enter...&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Select keyboard layout [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Type an appropriate layout for you&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Select variant:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Type an appropriate layout for you (if prompted)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter system hostname (short form, e.g. &#039;foo&#039;) [localhost]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter the hostname, e.g.&#039;&#039; &#039;&#039;&#039;vpnc&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Available interfaces are: eth0&amp;lt;br&amp;gt;Enter &#039;?&#039; for help on bridges, bonding and vlans.&amp;lt;br&amp;gt;Which one do you want to initialize? (or &#039;?&#039; done&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter&#039;&#039; &#039;&#039;&#039;bond0.8&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Available bond slaves are: eth0 eth1&amp;lt;br&amp;gt;Which slave(s) do you want to add to bond0? (or &#039;done&#039;) [eth0]&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;&#039;eth0 eth1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IP address for bond0? (or &#039;dhcp&#039;, &#039;none&#039;, &#039;?&#039;) [dhcp]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IP address for bond0.8? (or &#039;dhcp&#039;, &#039;none&#039;, &#039;?&#039;) [dhcp]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter the IP address of your LAN interface, e.g.&#039;&#039; &#039;&#039;&#039;10.1.0.1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Netmask? [255.255.255.0]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;255.255.255.0&#039; or type another appropriate subnet mask&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Gateway? (or &#039;none&#039;) [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Do you want to do any manual network configuration? [no]&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;&#039;yes&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;Make a copy of the bond0.8 configuration for bond0.64, bond0.256 and bond0.257 (optional) interfaces.&amp;lt;br&amp;gt;Don&#039;t forget to add a gateway and a metric value for ISP interfaces when multiple gateways are set.&amp;lt;br&amp;gt;Save and close the file (:wq)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DNS domain name? (e.g. &#039;bar.com&#039;) []:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter the domain name of your intranet, e.g.,&#039;&#039; &#039;&#039;&#039;example.net&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DNS nameservers(s)? []:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;&#039;8.8.8.8 8.8.4.4&#039;&#039;&#039; (we will change them later)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Changing password for root&amp;lt;br&amp;gt;New password:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter a secure password for the console&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Retype password:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Retype the above password&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which timezone are you in? (&#039;?&#039; for list) [UTC]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;UTC&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;HTTP/FTP proxy URL? (e.g. &#039;http://proxy:8080&#039;, or &#039;none&#039;) [none]&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter mirror number (1-9) or URL to add (or r/f/e/done) [f]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Select a mirror close to you and press Enter&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which SSH server? (&#039;openssh&#039;, &#039;dropbear&#039; or &#039;none&#039;) [openssh]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;openssh&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which NTP client to run? (&#039;openntpd&#039;, &#039;chrony&#039; or &#039;none&#039;) [chrony]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;chrony&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which disk(s) would you like to use? (or &#039;?&#039; for help or &#039;none&#039;) [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039; or type &#039;none&#039; if needed&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter where to store configs (&#039;floppy&#039;, &#039;usb&#039; or &#039;none&#039;) [usb]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;usb&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter apk cache directory (or &#039;?&#039; or &#039;none&#039;) [/media/usb/cache]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;/media/usb/cache&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bonding ==&lt;br /&gt;
Update the bonding configuration:&lt;br /&gt;
&lt;br /&gt;
{{cmd|echo bonding mode{{=}}balance-tlb miimon{{=}}100 updelay{{=}}500 &amp;gt;&amp;gt; /etc/modules}}&lt;br /&gt;
&lt;br /&gt;
== Physically install ==&lt;br /&gt;
At this point, you&#039;re ready to connect the VPN Spoke Node to the network if you haven&#039;t already done so.  Please set up an 802.1q capable switch with the VLANs listed in AlpineSetup section.  Once done, tag all of the VLANs on one port.  Connect that port to &amp;lt;code&amp;gt;eth0&amp;lt;/code&amp;gt;.  Then, connect your first ISP&#039;s CPE to a switchport with VLAN 256 untagged.&lt;br /&gt;
&lt;br /&gt;
== SSH ==&lt;br /&gt;
Remove password authentication and DNS reverse lookup:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|sed -i &amp;quot;s/.PasswordAuthentication yes/PasswordAuthentication no/&amp;quot; /etc/ssh/sshd_config&lt;br /&gt;
sed -i &amp;quot;s/.UseDNS yes/UseDNS no/&amp;quot; /etc/ssh/sshd_config}}&lt;br /&gt;
&lt;br /&gt;
== Recursive DNS  ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add -U unbound}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/unbound/unbound.conf&amp;lt;/code&amp;gt; and add the following configuration.  If you have a domain that you want unbound to resolve but is internal to your network only, the stub-zone stanza is present:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/unbound/unbound.conf|&lt;br /&gt;
server:&lt;br /&gt;
        verbosity: 1&lt;br /&gt;
        interface: 10.1.0.1&lt;br /&gt;
        do-ip4: yes&lt;br /&gt;
        do-ip6: no&lt;br /&gt;
        do-udp: yes&lt;br /&gt;
        do-tcp: yes&lt;br /&gt;
        do-daemonize: yes&lt;br /&gt;
        access-control: 10.1.0.0/16 allow&lt;br /&gt;
        access-control: 127.0.0.0/8 allow&lt;br /&gt;
&lt;br /&gt;
do-not-query-localhost: no&lt;br /&gt;
&lt;br /&gt;
root-hints: &amp;quot;/etc/unbound/root.hints&amp;quot;&lt;br /&gt;
&lt;br /&gt;
stub-zone:&lt;br /&gt;
	name: &amp;quot;location1.example.net&amp;quot;&lt;br /&gt;
	stub-addr: 10.1.0.2&lt;br /&gt;
&lt;br /&gt;
stub-zone:&lt;br /&gt;
        name: &amp;quot;example.net&amp;quot;&lt;br /&gt;
        stub-addr: 172.16.255.1&lt;br /&gt;
        stub-addr: 172.16.255.2&lt;br /&gt;
        stub-addr: 172.16.255.3&lt;br /&gt;
        stub-addr: 172.16.255.4&lt;br /&gt;
        stub-addr: 172.16.255.5&lt;br /&gt;
        stub-addr: 172.16.255.7&lt;br /&gt;
&lt;br /&gt;
stub-zone:&lt;br /&gt;
        name: &amp;quot;example2.net&amp;quot;&lt;br /&gt;
        stub-addr: 172.16.255.1&lt;br /&gt;
        stub-addr: 172.16.255.2&lt;br /&gt;
        stub-addr: 172.16.255.3&lt;br /&gt;
        stub-addr: 172.16.255.4&lt;br /&gt;
        stub-addr: 172.16.255.5&lt;br /&gt;
        stub-addr: 172.16.255.7&lt;br /&gt;
&lt;br /&gt;
python:&lt;br /&gt;
remote-control:&lt;br /&gt;
        control-enable: no&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start unbound and start using unbound on this host:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/unbound start&lt;br /&gt;
rc-update add unbound&lt;br /&gt;
echo nameserver 10.1.0.1 &amp;gt; /etc/resolv.conf}}&lt;br /&gt;
&lt;br /&gt;
== Local DNS Zone ==&lt;br /&gt;
If you have a DNS zone that is only resolvable internally to your network, you will need a 2nd IP address on your LAN interface, and use NSD to host the zone.&lt;br /&gt;
&lt;br /&gt;
First, add the following to the end of the &amp;lt;code&amp;gt;bond0.8&amp;lt;/code&amp;gt; stanza:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|&lt;br /&gt;
auto bond0.8&lt;br /&gt;
     ...&lt;br /&gt;
     ...&lt;br /&gt;
     up ip addr add 10.1.0.2/24 dev bond0.8&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add nsd}}&lt;br /&gt;
&lt;br /&gt;
Create &amp;lt;code&amp;gt;/etc/nsd/nsd.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/nsd/nsd.conf|&lt;br /&gt;
server:&lt;br /&gt;
        ip-address: 10.1.0.2&lt;br /&gt;
        port: 53&lt;br /&gt;
        server-count: 1&lt;br /&gt;
        ip4-only: yes&lt;br /&gt;
        hide-version: yes&lt;br /&gt;
        identity: &amp;quot;&amp;quot;&lt;br /&gt;
        zonesdir: &amp;quot;/etc/nsd&amp;quot;&lt;br /&gt;
zone:&lt;br /&gt;
        name: location1.example.net&lt;br /&gt;
        zonefile: location1.example.net.zone&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create zonefile in &amp;lt;code&amp;gt;/etc/nsd/location1.example.net.zone&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/nsd/location1.example.net.zone|&lt;br /&gt;
;## location1.example.net authoritative zone&lt;br /&gt;
&lt;br /&gt;
$ORIGIN location1.example.net.&lt;br /&gt;
$TTL 86400&lt;br /&gt;
&lt;br /&gt;
@ IN SOA ns1.location1.example.net. webmaster.location1.example.net. (&lt;br /&gt;
                2013081901      ; serial&lt;br /&gt;
                28800           ; refresh&lt;br /&gt;
                7200            ; retry&lt;br /&gt;
                86400           ; expire&lt;br /&gt;
                86400           ; min TTL&lt;br /&gt;
                )&lt;br /&gt;
&lt;br /&gt;
                NS              ns1.location1.example.net.&lt;br /&gt;
                MX      10      mail.location1.example.net.&lt;br /&gt;
ns              IN      A       10.1.0.2&lt;br /&gt;
mail            IN      A       10.1.0.4&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Check configuration then start:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|nsd-checkconf /etc/nsd/nsd.conf&lt;br /&gt;
nsdc rebuild&lt;br /&gt;
/etc/init.d/nsd start&lt;br /&gt;
rc-update add nsd}}&lt;br /&gt;
&lt;br /&gt;
== GRE Tunnel ==&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; and add the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/network/interfaces|&lt;br /&gt;
auto gre1&lt;br /&gt;
iface gre1 inet static&lt;br /&gt;
      pre-up ip tunnel add $IFACE mode gre ttl 64 tos inherit key 12.34.56.78 || true&lt;br /&gt;
      address 172.16.1.1&lt;br /&gt;
      netmask 255.255.0.0&lt;br /&gt;
      post-down ip tunnel del $IFACE || true&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Bring up the new &amp;lt;code&amp;gt;gre1&amp;lt;/code&amp;gt; interface:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ifup gre1}}&lt;br /&gt;
&lt;br /&gt;
== IPSEC ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add ipsec-tools}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor create &amp;lt;code&amp;gt;/etc/ipsec.conf&amp;lt;/code&amp;gt; and set the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/ipsec.conf|&lt;br /&gt;
spdflush;&lt;br /&gt;
spdadd 0.0.0.0/0 0.0.0.0/0 gre -P out	ipsec esp/transport//require;&lt;br /&gt;
spdadd 0.0.0.0/0 0.0.0.0/0 gre -P in 	ipsec esp/transport//require;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Create missing directory:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|mkdir /etc/racoon/}}&lt;br /&gt;
&lt;br /&gt;
Extract your pfx into &amp;lt;code&amp;gt;/etc/racoon&amp;lt;/code&amp;gt;, using the filenames &#039;&#039;&#039;&amp;lt;code&amp;gt;ca.pem&amp;lt;/code&amp;gt;&#039;&#039;&#039;, &#039;&#039;&#039;&amp;lt;code&amp;gt;cert.pem&amp;lt;/code&amp;gt;&#039;&#039;&#039;, and &#039;&#039;&#039;&amp;lt;code&amp;gt;key.pem&amp;lt;/code&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor create &amp;lt;code&amp;gt;/etc/racoon/racoon.conf&amp;lt;/code&amp;gt; and set the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/racoon/racoon.conf|&lt;br /&gt;
path certificate &amp;quot;/etc/racoon/&amp;quot;;&lt;br /&gt;
remote anonymous {&lt;br /&gt;
	exchange_mode main;&lt;br /&gt;
	lifetime time 2 hour;&lt;br /&gt;
	certificate_type x509 &amp;quot;/etc/racoon/cert.pem&amp;quot; &amp;quot;/etc/racoon/key.pem&amp;quot;;&lt;br /&gt;
	ca_type x509 &amp;quot;/etc/racoon/ca.pem&amp;quot;;&lt;br /&gt;
	my_identifier asn1dn;&lt;br /&gt;
	nat_traversal on;&lt;br /&gt;
        script &amp;quot;/etc/opennhrp/racoon-ph1dead.sh&amp;quot; phase1_dead;&lt;br /&gt;
	dpd_delay 120;&lt;br /&gt;
	proposal {&lt;br /&gt;
		encryption_algorithm aes 256;&lt;br /&gt;
		hash_algorithm sha1;&lt;br /&gt;
		authentication_method rsasig;&lt;br /&gt;
		dh_group modp4096;&lt;br /&gt;
	}&lt;br /&gt;
	proposal {&lt;br /&gt;
		encryption_algorithm aes 256;&lt;br /&gt;
		hash_algorithm sha1;&lt;br /&gt;
		authentication_method rsasig;&lt;br /&gt;
		dh_group 2;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sainfo anonymous {&lt;br /&gt;
	pfs_group 2;&lt;br /&gt;
	lifetime time 2 hour;&lt;br /&gt;
	encryption_algorithm aes 256;&lt;br /&gt;
	authentication_algorithm hmac_sha1;&lt;br /&gt;
	compression_algorithm deflate;&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;/etc/conf.d/racoon&amp;lt;/code&amp;gt; and unset &amp;lt;code&amp;gt;RACOON_PSK_FILE&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/conf.d/racoon|&lt;br /&gt;
...&lt;br /&gt;
RACOON_PSK_FILE{{=}}&lt;br /&gt;
...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/racoon start&lt;br /&gt;
rc-update add racoon}}&lt;br /&gt;
&lt;br /&gt;
== Next Hop Resolution Protocol (NHRP) ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add opennhrp}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp.conf&amp;lt;/code&amp;gt; and change the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/opennhrp/opennhrp.conf|&lt;br /&gt;
interface gre1&lt;br /&gt;
	dynamic-map 172.16.0.0/16 hub.example.com&lt;br /&gt;
	shortcut&lt;br /&gt;
	redirect&lt;br /&gt;
	non-caching&lt;br /&gt;
&lt;br /&gt;
interface bond0.8&lt;br /&gt;
	shortcut-destination&lt;br /&gt;
&lt;br /&gt;
interface bond0.64&lt;br /&gt;
	shortcut-destination&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
You must have a DNS A record &#039;&#039;&amp;lt;code&amp;gt;hub.example.com&amp;lt;/code&amp;gt;&#039;&#039; for each hub node IP address.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp-script&amp;lt;/code&amp;gt; and change the content to the following:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/opennhrp/opennhrp-script|&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
MYAS=$(sed -n &#039;s/router bgp \(\d*\)/\1/p&#039; &amp;lt; /etc/quagga/bgpd.conf)&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
interface-up)&lt;br /&gt;
    echo &amp;quot;Interface $NHRP_INTERFACE is up&amp;quot;&lt;br /&gt;
    if [ &amp;quot;$NHRP_INTERFACE&amp;quot; = &amp;quot;gre1&amp;quot; ]; then&lt;br /&gt;
        ip route flush proto 42 dev $NHRP_INTERFACE&lt;br /&gt;
        ip neigh flush dev $NHRP_INTERFACE&lt;br /&gt;
&lt;br /&gt;
        vtysh -d bgpd \&lt;br /&gt;
            -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
            -c &amp;quot;router bgp $MYAS&amp;quot; \&lt;br /&gt;
            -c &amp;quot;no neighbor core&amp;quot; \&lt;br /&gt;
            -c &amp;quot;neighbor core peer-group&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    ;;&lt;br /&gt;
peer-register)&lt;br /&gt;
    ;;&lt;br /&gt;
peer-up)&lt;br /&gt;
    if [ -n &amp;quot;$NHRP_DESTMTU&amp;quot; ]; then&lt;br /&gt;
        ARGS=`ip route get $NHRP_DESTNBMA from $NHRP_SRCNBMA | head -1`&lt;br /&gt;
        ip route add $ARGS proto 42 mtu $NHRP_DESTMTU&lt;br /&gt;
    fi&lt;br /&gt;
    echo &amp;quot;Create link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
    racoonctl establish-sa -w isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA || exit 1&lt;br /&gt;
    racoonctl establish-sa -w esp inet $NHRP_SRCNBMA $NHRP_DESTNBMA gre || exit 1&lt;br /&gt;
    ;;&lt;br /&gt;
peer-down)&lt;br /&gt;
    echo &amp;quot;Delete link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
    racoonctl delete-sa isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA&lt;br /&gt;
    ip route del $NHRP_DESTNBMA src $NHRP_SRCNBMA proto 42&lt;br /&gt;
    ;;&lt;br /&gt;
nhs-up)&lt;br /&gt;
    echo &amp;quot;NHS UP $NHRP_DESTADDR&amp;quot;&lt;br /&gt;
    (&lt;br /&gt;
        flock -x 200&lt;br /&gt;
        vtysh -d bgpd \&lt;br /&gt;
            -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
            -c &amp;quot;router bgp $MYAS&amp;quot; \&lt;br /&gt;
            -c &amp;quot;neighbor $NHRP_DESTADDR remote-as 65000&amp;quot; \&lt;br /&gt;
            -c &amp;quot;neighbor $NHRP_DESTADDR peer-group core&amp;quot; \&lt;br /&gt;
            -c &amp;quot;exit&amp;quot; \&lt;br /&gt;
            -c &amp;quot;exit&amp;quot; \&lt;br /&gt;
            -c &amp;quot;clear bgp $NHRP_DESTADDR&amp;quot;&lt;br /&gt;
    ) 200&amp;gt;/var/lock/opennhrp-script.lock&lt;br /&gt;
    ;;&lt;br /&gt;
nhs-down)&lt;br /&gt;
    (&lt;br /&gt;
        flock -x 200&lt;br /&gt;
        vtysh -d bgpd \&lt;br /&gt;
            -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
            -c &amp;quot;router bgp $MYAS&amp;quot; \&lt;br /&gt;
            -c &amp;quot;no neighbor $NHRP_DESTADDR&amp;quot;&lt;br /&gt;
    ) 200&amp;gt;/var/lock/opennhrp-script.lock&lt;br /&gt;
    ;;&lt;br /&gt;
route-up)&lt;br /&gt;
    echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is up&amp;quot;&lt;br /&gt;
    ip route replace $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42 via $NHRP_NEXTHOP dev $NHRP_INTERFACE&lt;br /&gt;
    ip route flush cache&lt;br /&gt;
    ;;&lt;br /&gt;
route-down)&lt;br /&gt;
    echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is down&amp;quot;&lt;br /&gt;
    ip route del $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42&lt;br /&gt;
    ip route flush cache&lt;br /&gt;
    ;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Make it executable and start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|chmod +x /etc/opennhrp/opennhrp-script&lt;br /&gt;
/etc/init.d/opennhrp start&lt;br /&gt;
rc-update add opennhrp}}&lt;br /&gt;
&lt;br /&gt;
== BGP ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add quagga&lt;br /&gt;
touch /etc/quagga/zebra.conf}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/quagga/bgpd.conf&amp;lt;/code&amp;gt; and change the content to the following (replace &amp;lt;code&amp;gt;strongpassword&amp;lt;/code&amp;gt; with a password of your choice and &amp;lt;code&amp;gt;%HUB_GRE_IP%&amp;lt;/code&amp;gt; with the &#039;&#039;&#039;Hub&#039;&#039;&#039; node GRE IP address):&lt;br /&gt;
* Add the line &amp;lt;code&amp;gt;neighbor %HUB_GRE_IP% remote-as 65000&amp;lt;/code&amp;gt; for each &#039;&#039;&#039;Hub&#039;&#039;&#039; host you have in your NBMA cloud.&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/quagga/bgpd.conf|&lt;br /&gt;
password strongpassword&lt;br /&gt;
enable password strongpassword&lt;br /&gt;
log syslog&lt;br /&gt;
&lt;br /&gt;
access-list 1 remark Command line access authorized IP&lt;br /&gt;
access-list 1 permit 127.0.0.1&lt;br /&gt;
line vty&lt;br /&gt;
 access-class 1&lt;br /&gt;
&lt;br /&gt;
hostname vpnc.example.net&lt;br /&gt;
&lt;br /&gt;
router bgp 65001&lt;br /&gt;
	bgp router-id 172.16.1.1&lt;br /&gt;
	network 10.1.0.0/16&lt;br /&gt;
	neighbor %HUB_GRE_IP% remote-as 65000&lt;br /&gt;
	neighbor %HUB_GRE_IP% remote-as 65000&lt;br /&gt;
        ...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/bgpd start&lt;br /&gt;
rc-update add bgpd}}&lt;br /&gt;
&lt;br /&gt;
== OpenVPN ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|echo tun &amp;gt;&amp;gt; /etc/modules&lt;br /&gt;
modprobe tun&lt;br /&gt;
apk add openvpn openssl&lt;br /&gt;
openssl dhparam -out /etc/openvpn/dh1024.pem 1024}}&lt;br /&gt;
&lt;br /&gt;
Configure openvpn:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/openvpn/openvpn.conf|&lt;br /&gt;
dev tun&lt;br /&gt;
proto udp&lt;br /&gt;
port 1194&lt;br /&gt;
&lt;br /&gt;
server 10.1.128.0 255.255.255.0&lt;br /&gt;
push &amp;quot;route 10.0.0.0 255.0.0.0&amp;quot;&lt;br /&gt;
push &amp;quot;dhcp-option DNS 10.1.0.1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
tls-server&lt;br /&gt;
ca /etc/openvpn/cacert.pem&lt;br /&gt;
cert /etc/openvpn/servercert.pem&lt;br /&gt;
key /etc/openvpn/serverkey.pem&lt;br /&gt;
&lt;br /&gt;
crl-verify /etc/openvpn/crl.pem&lt;br /&gt;
&lt;br /&gt;
dh /etc/openvpn/dh1024.pem&lt;br /&gt;
&lt;br /&gt;
persist-key&lt;br /&gt;
persist-tun&lt;br /&gt;
&lt;br /&gt;
keepalive 10 120&lt;br /&gt;
&lt;br /&gt;
comp-lzo&lt;br /&gt;
&lt;br /&gt;
status /var/log/openvpn.status&lt;br /&gt;
mute 20&lt;br /&gt;
verb 3&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/openvpn start&lt;br /&gt;
rc-update add openvpn}}&lt;br /&gt;
&lt;br /&gt;
== Firewall ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add awall}}&lt;br /&gt;
&lt;br /&gt;
Enable IP forwarding:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|sysctl -w net.ipv4.ip_forward{{=}}1&lt;br /&gt;
sed -i &#039;s/.*net\.ipv4\.ip_forward.*$/net.ipv4.ip_forward {{=}} 1/g&#039; /etc/sysctl.conf}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor, edit the following files and set their contents as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/params.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;params&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;B_IF&amp;quot; {{=}} &amp;quot;bond0.8&amp;quot;,&lt;br /&gt;
    &amp;quot;C_IF&amp;quot; {{=}} &amp;quot;bond0.64&amp;quot;,&lt;br /&gt;
    &amp;quot;ISP1_IF&amp;quot; {{=}} &amp;quot;bond0.256&amp;quot;,&lt;br /&gt;
    &amp;quot;ISP2_IF&amp;quot; {{=}} &amp;quot;bond0.257&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/internet-host.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Internet host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;params&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;E&amp;quot;: { &amp;quot;iface&amp;quot;: [ &amp;quot;$ISP1_IF&amp;quot;, &amp;quot;$ISP2_IF&amp;quot; ] },&lt;br /&gt;
    &amp;quot;ISP1&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$ISP1_IF&amp;quot; },&lt;br /&gt;
    &amp;quot;ISP2&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$ISP2_IF&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ping&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;,&lt;br /&gt;
      &amp;quot;flow-limit&amp;quot;: { &amp;quot;count&amp;quot;: 10, &amp;quot;interval&amp;quot;: 6 }&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ssh&amp;quot;, &amp;quot;https&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;,&lt;br /&gt;
      &amp;quot;conn-limit&amp;quot;: { &amp;quot;count&amp;quot;: 3, &amp;quot;interval&amp;quot;: 60 }&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;dns&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;ntp&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ping&amp;quot;, &amp;quot;ssh&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/openvpn.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;OpenVPN support&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;internet-host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;service&amp;quot;: { &lt;br /&gt;
     &amp;quot;openvpn&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;udp&amp;quot;, &amp;quot;port&amp;quot;: 1194 }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [ &lt;br /&gt;
     { &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;openvpn&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
    ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/clampmss.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Deal with ISPs afraid of ICMP&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;internet-host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;clamp-mss&amp;quot;: [ { &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot; } ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/mark.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Mark traffic based on ISP&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: [ &amp;quot;params&amp;quot;, &amp;quot;internet-host&amp;quot; ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;route-track&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;ISP1&amp;quot;, &amp;quot;mark&amp;quot;: 1 },&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;ISP2&amp;quot;, &amp;quot;mark&amp;quot;: 2 }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/dmvpn.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;DMVPN router&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;internet-host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;A_ADDR&amp;quot;: [ &amp;quot;10.0.0.0/8&amp;quot;, &amp;quot;172.16.0.0/16&amp;quot; ]&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;A&amp;quot;: { &amp;quot;addr&amp;quot;: &amp;quot;$A_ADDR&amp;quot;, &amp;quot;iface&amp;quot;: &amp;quot;gre1&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;ipsec&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;ipsec&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;ipsec&amp;quot;: &amp;quot;in&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;gre&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;ipsec&amp;quot;: &amp;quot;out&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;gre&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;bgp&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;bgp&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;},&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;dest&amp;quot;: &amp;quot;$A_ADDR&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;reject&amp;quot; }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/awall/optional/vpnc.json|&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;VPNc&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: [ &amp;quot;params&amp;quot;, &amp;quot;internet-host&amp;quot;, &amp;quot;dmvpn&amp;quot; ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;B&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$B_IF&amp;quot; },&lt;br /&gt;
    &amp;quot;C&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$C_IF&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;policy&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;B&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;C&amp;quot;, &amp;quot;out&amp;quot;: [ &amp;quot;A&amp;quot;, &amp;quot;E&amp;quot; ], &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;drop&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;snat&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;A&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ping&amp;quot;, &amp;quot;ssh&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;https&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: [ &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot; ],&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;dns&amp;quot;, &amp;quot;ntp&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;https&amp;quot;, &amp;quot;ssh&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: [ &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot; ],&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;dns&amp;quot;, &amp;quot;ntp&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    { &lt;br /&gt;
      &amp;quot;in&amp;quot;: [ &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot; ],&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;proto&amp;quot;: &amp;quot;icmp&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Activate the firewall:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|modprobe ip_tables&lt;br /&gt;
modprobe iptable_nat &lt;br /&gt;
awall enable clampmss&lt;br /&gt;
awall enable openvpn&lt;br /&gt;
awall enable vpnc&lt;br /&gt;
awall activate&lt;br /&gt;
rc-update add iptables}}&lt;br /&gt;
&lt;br /&gt;
== ISP Failover ==&lt;br /&gt;
Install package(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add pingu&lt;br /&gt;
echo -e &amp;quot;1\tisp1&amp;quot;&amp;gt;&amp;gt; /etc/iproute2/rt_tables&lt;br /&gt;
echo -e &amp;quot;2\tisp2&amp;quot;&amp;gt;&amp;gt; /etc/iproute2/rt_tables}}&lt;br /&gt;
&lt;br /&gt;
Configure pingu to monitor our &amp;lt;code&amp;gt;bond0.256&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;bond0.257&amp;lt;/code&amp;gt; interfaces in &amp;lt;code&amp;gt;/etc/pingu/pingu.conf&amp;lt;/code&amp;gt;.  Add the hosts to monitor for ISP failover to &amp;lt;code&amp;gt;/etc/pingu/pingu.conf&amp;lt;/code&amp;gt; and bind to primary ISP. We also set the ping timeout to 4 seconds.:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/pingu/pingu.conf|&lt;br /&gt;
timeout 4&lt;br /&gt;
required 2&lt;br /&gt;
retry 11&lt;br /&gt;
&lt;br /&gt;
interface bond0.256 { &lt;br /&gt;
  # route-table must correspond with mark in /etc/awall/optional/mark.json&lt;br /&gt;
  route-table 1&lt;br /&gt;
  fwmark 1&lt;br /&gt;
  rule-priority 20000&lt;br /&gt;
  # google dns&lt;br /&gt;
  ping 8.8.8.8&lt;br /&gt;
  # opendns&lt;br /&gt;
  ping 208.67.222.222&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface bond0.257 {&lt;br /&gt;
  # route-table must correspond with mark in /etc/awall/optional/mark.json&lt;br /&gt;
  route-table 2&lt;br /&gt;
  fwmark 2&lt;br /&gt;
  rule-priority 20000&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Make sure we can reach the public IP from our LAN by adding static route rules for our private net(s). Edit &amp;lt;code&amp;gt;/etc/pingu/route-rules&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/pingu/route-rules|&lt;br /&gt;
to 10.0.0.0/8 table main prio 1000&lt;br /&gt;
to 172.16.0.0/12 table main prio 1000&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Start service(s):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/pingu start&lt;br /&gt;
rc-update add pingu}}&lt;br /&gt;
&lt;br /&gt;
Now, if both hosts stop responding to pings, ISP-1 will be considered down and all gateways via bond0.256 will be removed from main route table. Note that the gateway will not be removed from the route table &#039;1&#039;. This is so we can continue try ping via &amp;lt;code&amp;gt;bond0.256&amp;lt;/code&amp;gt; so we can detect that the ISP is back online. When ISP starts working again, the gateways will be added back to main route table again.&lt;br /&gt;
&lt;br /&gt;
== Commit Configuration ==&lt;br /&gt;
Commit configuration:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|lbu ci}}&lt;br /&gt;
&lt;br /&gt;
= Hub Node =&lt;br /&gt;
We will document only what changes from the Spoke node setup.&lt;br /&gt;
&lt;br /&gt;
== Routing Tables ==&lt;br /&gt;
{{Todo|Would we need to change this command - or add some description on why it&#039;s documented?}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|echo -e &amp;quot;42\tnhrp_shortcut\n43\tnhrp_mtu\n44\tquagga\n}}&lt;br /&gt;
&lt;br /&gt;
== NHRP ==&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp.conf&amp;lt;/code&amp;gt; on Hub 2 and set the content as follows:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/opennhrp/opennhrp.conf|&lt;br /&gt;
interface gre1&lt;br /&gt;
  map %Hub1_GRE_IP%/%MaskBit% hub1.example.org&lt;br /&gt;
  route-table 44&lt;br /&gt;
  shortcut&lt;br /&gt;
  redirect&lt;br /&gt;
  non-caching&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Do the same on Hub 1 adding the data relative to Hub 2.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp-script&amp;lt;/code&amp;gt; and set the content as follows:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/opennhrp/opennhrp-script|&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
interface-up)&lt;br /&gt;
	ip route flush proto 42 dev $NHRP_INTERFACE&lt;br /&gt;
	ip neigh flush dev $NHRP_INTERFACE&lt;br /&gt;
	;;&lt;br /&gt;
peer-register)&lt;br /&gt;
	CERT=`racoonctl get-cert inet $NHRP_SRCNBMA $NHRP_DESTNBMA | openssl x509 -inform der -text -noout | egrep -o &amp;quot;/OU=[^/]*(/[0-9]+)?&amp;quot; | cut -b 5-`&lt;br /&gt;
	if [ -z &amp;quot;`echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^GRE=$NHRP_DESTADDR&amp;quot;`&amp;quot; ]; then&lt;br /&gt;
		logger -t opennhrp-script -p auth.err &amp;quot;GRE registration of $NHRP_DESTADDR to $NHRP_DESTNBMA DENIED&amp;quot;&lt;br /&gt;
		exit 1&lt;br /&gt;
	fi&lt;br /&gt;
	logger -t opennhrp-script -p auth.info &amp;quot;GRE registration of $NHRP_DESTADDR to $NHRP_DESTNBMA authenticated&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	(&lt;br /&gt;
		flock -x 200&lt;br /&gt;
		&lt;br /&gt;
		AS=`echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^AS=&amp;quot; | cut -b 4-`&lt;br /&gt;
		vtysh -d bgpd -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
			-c &amp;quot;router bgp 65000&amp;quot; \&lt;br /&gt;
			-c &amp;quot;neighbor $NHRP_DESTADDR remote-as $AS&amp;quot; \&lt;br /&gt;
			-c &amp;quot;neighbor $NHRP_DESTADDR peer-group leaf&amp;quot; \&lt;br /&gt;
			-c &amp;quot;neighbor $NHRP_DESTADDR prefix-list net-$AS-in in&amp;quot;&lt;br /&gt;
&lt;br /&gt;
		SEQ=5&lt;br /&gt;
		(echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^NET=&amp;quot; | cut -b 5-) | while read NET; do&lt;br /&gt;
			vtysh -d bgpd -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
				-c &amp;quot;ip prefix-list net-$AS-in seq $SEQ permit $NET le 26&amp;quot;&lt;br /&gt;
			SEQ=$(($SEQ+5))&lt;br /&gt;
		done&lt;br /&gt;
	) 200&amp;gt;/var/lock/opennhrp-script.lock&lt;br /&gt;
	;;&lt;br /&gt;
peer-up)&lt;br /&gt;
	echo &amp;quot;Create link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
	racoonctl establish-sa -w isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA || exit 1&lt;br /&gt;
	racoonctl establish-sa -w esp inet $NHRP_SRCNBMA $NHRP_DESTNBMA gre || exit 1 &lt;br /&gt;
&lt;br /&gt;
	CERT=`racoonctl get-cert inet $NHRP_SRCNBMA $NHRP_DESTNBMA | openssl x509 -inform der -text -noout | egrep -o &amp;quot;/OU=[^/]*(/[0-9]+)?&amp;quot; | cut -b 5-`&lt;br /&gt;
	if [ -z &amp;quot;`echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^GRE=$NHRP_DESTADDR&amp;quot;`&amp;quot; ]; then&lt;br /&gt;
		logger -p daemon.err &amp;quot;GRE mapping of $NHRP_DESTADDR to $NHRP_DESTNBMA DENIED&amp;quot;&lt;br /&gt;
		exit 1&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	if [ -n &amp;quot;$NHRP_DESTMTU&amp;quot; ]; then&lt;br /&gt;
		ARGS=`ip route get $NHRP_DESTNBMA from $NHRP_SRCNBMA | head -1`&lt;br /&gt;
		ip route add $ARGS proto 42 mtu $NHRP_DESTMTU table nhrp_mtu&lt;br /&gt;
	fi&lt;br /&gt;
	;;&lt;br /&gt;
peer-down)&lt;br /&gt;
	echo &amp;quot;Delete link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
	if [ &amp;quot;$NHRP_PEER_DOWN_REASON&amp;quot; != &amp;quot;lower-down&amp;quot; ]; then&lt;br /&gt;
		racoonctl delete-sa isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA&lt;br /&gt;
	fi&lt;br /&gt;
	ip route del $NHRP_DESTNBMA src $NHRP_SRCNBMA proto 42 table nhrp_mtu&lt;br /&gt;
	;;&lt;br /&gt;
route-up)&lt;br /&gt;
	echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is up&amp;quot;&lt;br /&gt;
	ip route replace $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42 via $NHRP_NEXTHOP dev $NHRP_INTERFACE table nhrp_shortcut&lt;br /&gt;
	ip route flush cache&lt;br /&gt;
	;;&lt;br /&gt;
route-down)&lt;br /&gt;
	echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is down&amp;quot;&lt;br /&gt;
	ip route del $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42 table nhrp_shortcut&lt;br /&gt;
	ip route flush cache&lt;br /&gt;
	;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== BGP ==&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/quagga/bgpd.conf&amp;lt;/code&amp;gt; on Hub 2 and set the content as follows:&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/quagga/bgpd.conf|&lt;br /&gt;
password zebra&lt;br /&gt;
enable password zebra&lt;br /&gt;
log syslog&lt;br /&gt;
&lt;br /&gt;
router bgp 65000&lt;br /&gt;
 bgp router-id %Hub2_GRE_IP%&lt;br /&gt;
 bgp deterministic-med&lt;br /&gt;
 network %GRE_NETWORK%/%MASK_BITS%&lt;br /&gt;
 neighbor hub peer-group&lt;br /&gt;
 neighbor hub next-hop-self&lt;br /&gt;
 neighbor hub route-map CORE-IN in&lt;br /&gt;
 neighbor spoke peer-group&lt;br /&gt;
 neighbor spoke passive&lt;br /&gt;
 neighbor spoke next-hop-self&lt;br /&gt;
 neighbor %Spoke1_GRE_IP% remote-as 65001&lt;br /&gt;
 neighbor %Spoke1_GRE_IP% peer-group spoke&lt;br /&gt;
 neighbor %Spoke1_GRE_IP% prefix-list net-65001-in in&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
 neighbor hub remote-as 65000&lt;br /&gt;
 neighbor %Hub1_GRE_IP% peer-group core&lt;br /&gt;
&lt;br /&gt;
 ip prefix-list net-65001-in seq 5 permit 10.1.0.0/16 le 26&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
 route-map CORE-IN permit 10&lt;br /&gt;
 set metric +100&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Add the lines &amp;lt;code&amp;gt;neighbor %Spoke1_GRE_IP%...&amp;lt;/code&amp;gt; for each spoke node you have. Do the same on Hub 1, changing the relevant data for Hub 2.&lt;br /&gt;
&lt;br /&gt;
= Troubleshooting the DMVPN =&lt;br /&gt;
== Broken [http://en.wikipedia.org/wiki/Path_MTU_Discovery Path MTU Discovery (PMTUD)] ==&lt;br /&gt;
ISPs afraid of ICMP (which is somehow legitimate) often just blindly add &amp;lt;code&amp;gt;no ip unreachables&amp;lt;/code&amp;gt; in their router interfaces, effectively creating a [http://en.wikipedia.org/wiki/Black_hole_%28networking%29 blackhole router] that breaks PMTUD, since ICMP Type 3 Code 4 packets (Fragmentation Needed) are dropped. PMTUD is needed by ISAKMP that runs on UDP (TCP works because it uses CLAMPMSS).&lt;br /&gt;
&lt;br /&gt;
For technical details see http://packetlife.net/blog/2008/oct/9/disabling-unreachables-breaks-pmtud/&lt;br /&gt;
&lt;br /&gt;
PMTUD could also be broken due to badly configured DSL modem/routers or bugged firmware. Turning off the firewall on modem itself or any VPN passthrough functionality it may help.&lt;br /&gt;
&lt;br /&gt;
You can easily detect which host is the blackhole router by pinging with DF bit set and with packets of standard MTU size, each hop given in your traceroute to destination:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ping -M do -s 1472 %IP%}}&lt;br /&gt;
{{Note|&amp;quot;-M do&amp;quot; requires GNU ping, present in &amp;lt;code&amp;gt;iputils&amp;lt;/code&amp;gt; package}}&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t get a response back (either Echo-Response or Fragmentation-Needed) there&#039;s firewall dropping ICMP packets. If it answers to normal ping packets (DF bit cleared), most likely you have hit a blackhole router.&lt;br /&gt;
&lt;br /&gt;
== Kernel and NHRP Routing Cache Issues ==&lt;br /&gt;
{{Todo|...}}&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Dynamic_Multipoint_VPN_(DMVPN)&amp;diff=9348</id>
		<title>Dynamic Multipoint VPN (DMVPN)</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Dynamic_Multipoint_VPN_(DMVPN)&amp;diff=9348"/>
		<updated>2013-09-05T07:05:31Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Enable IP forwarding&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
&lt;br /&gt;
http://alpinelinux.org/about under &#039;&#039;&#039;Why the Name Alpine?&#039;&#039;&#039; states: [ref?]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The first open-source implementation of Cisco&#039;s DMVPN, called OpenNHRP, was written for Alpine Linux.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
So the aim of this document is to be the reference Linux DMVPN setup, with all the networking services needed for the clients that will use the DMVPN (DNS, DHCP, firewall, etc.).&lt;br /&gt;
&lt;br /&gt;
= Terminology =&lt;br /&gt;
&#039;&#039;&#039;NBMA&#039;&#039;&#039;: &#039;&#039;Non-Broadcast Multi-Access&#039;&#039; network as described in [http://tools.ietf.org/html/rfc2332 RFC 2332]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hub&#039;&#039;&#039;: the &#039;&#039;Next Hop Server&#039;&#039; (NHS) performing the Next Hop Resolution Protocol service within the NBMA cloud.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Spoke&#039;&#039;&#039;: the &#039;&#039;Next Hop Resolution Protocol Client&#039;&#039; (NHC) which initiates NHRP requests of various types in order to obtain access to the NHRP service.&lt;br /&gt;
&lt;br /&gt;
{{Tip|At the time of this writing the recommended Alpine version for building a DMVPN should be at minimum 2.4.11. Don&#039;t use 2.5.x, or 2.6.0 since the kernel has in-tunnel IP fragmentation issues. Alpine 2.6.1 or later should be okay instead.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|This document assumes that all Alpine installations are run in [[Installation#Basics|diskless mode]] and that the configuration is saved on USB key}}&lt;br /&gt;
&lt;br /&gt;
= Hardware =&lt;br /&gt;
If you are looking for hundreds of megabits of throughput for your VPN with a limited budget, you should consider using [http://www.via.com.tw/en/initiatives/padlock/hardware.jsp VIA Padlock] engine present in VIA processor C7, Eden, Nano and Quad. If you need gigabits throughput you should go instead for an Intel Xeon processor with [http://software.intel.com/en-us/articles/intel-advanced-encryption-standard-instructions-aes-ni AES-NI] and [http://software.intel.com/en-us/articles/intel-sha-extensions SHA Extensions]&lt;br /&gt;
&lt;br /&gt;
For supporting VIA Padlock engine do the following:&lt;br /&gt;
{{Cmd|echo -e &amp;quot;padlock_aes\npadlock-sha&amp;quot; &amp;gt;&amp;gt; /etc/modules}}&lt;br /&gt;
&lt;br /&gt;
= Extract Certificates =&lt;br /&gt;
We will use certificates for DMVPN and for OpenVPN (RoadWarrior clients). If you are in need to generate your own certificates, please see [[Generating_SSL_certs_with_ACF]]. You should use a separate machine for this purpose. If you downloaded the certificates on a Windows machine, you may use [http://winscp.net/eng/download.php WinSCP] to copy them on the DMVPN box.&lt;br /&gt;
&lt;br /&gt;
Here are the general purpose instruction for extracting certificates from pfx files:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|openssl pkcs12 -in cert.pfx -cacerts -nokeys -out cacert.pem&lt;br /&gt;
openssl pkcs12 -in cert.pfx -nocerts -nodes -out serverkey.pem&lt;br /&gt;
openssl pkcs12 -in cert.pfx -nokeys -clcerts -out cert.pem&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Remember to set appropriate permission for your certificate files:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|chmod 600 *.pem *.pfx}}&lt;br /&gt;
&lt;br /&gt;
= Spoke Node =&lt;br /&gt;
A local spoke node network has support for multiple ISP connections, along with redundant layer 2 switches.  At least one 802.1q capable switch is required, and a second is optional for redundancy purposes.  The typical spoke node network looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:DMVPN-Spoke.png]]&lt;br /&gt;
&lt;br /&gt;
== Alpine Setup ==&lt;br /&gt;
We will setup the network interfaces as follows:&lt;br /&gt;
&lt;br /&gt;
bond0.3 = Management &#039;&#039;&#039;(not implemented below yet)&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
bond0.8 = LAN&amp;lt;br&amp;gt;&lt;br /&gt;
bond0.64 = DMZ&amp;lt;br&amp;gt;&lt;br /&gt;
bond0.80 = Voice &#039;&#039;&#039;(not implemented below yet)&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
bond0.96 = Internet Access Only (no access to the DMVPN network)&#039;&#039;&#039;(not implemented below yet)&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
bond0.256 = ISP1&amp;lt;br&amp;gt;&lt;br /&gt;
bond0.257 = ISP2&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Boot Alpine in [[Installation#Basics|diskless mode]] and run &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!&#039;&#039;&#039;You will be prompted something like this...&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Suggestion on what you could enter...&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Select keyboard layout [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Type an appropriate layout for you&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Select variant:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Type an appropriate layout for you (if prompted)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter system hostname (short form, e.g. &#039;foo&#039;) [localhost]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter the hostname, e.g.&#039;&#039; &#039;&#039;&#039;vpnc&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Available interfaces are: eth0&amp;lt;br&amp;gt;Enter &#039;?&#039; for help on bridges, bonding and vlans.&amp;lt;br&amp;gt;Which one do you want to initialize? (or &#039;?&#039; done&#039;)&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter&#039;&#039; &#039;&#039;&#039;bond0.8&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Available bond slaves are: eth0 eth1&amp;lt;br&amp;gt;Which slave(s) do you want to add to bond0? (or &#039;done&#039;) [eth0]&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;&#039;eth0 eth1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IP address for bond0? (or &#039;dhcp&#039;, &#039;none&#039;, &#039;?&#039;) [dhcp]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IP address for bond0.8? (or &#039;dhcp&#039;, &#039;none&#039;, &#039;?&#039;) [dhcp]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter the IP address of your LAN interface, e.g.&#039;&#039; &#039;&#039;&#039;10.1.0.1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Netmask? [255.255.255.0]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;255.255.255.0&#039; or type another appropriate subnet mask&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Gateway? (or &#039;none&#039;) [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Do you want to do any manual network configuration? [no]&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;&#039;yes&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;Make a copy of the bond0.8 configuration for bond0.64, bond0.256 and bond0.257 (optional) interfaces.&amp;lt;br&amp;gt;Don&#039;t forget to add a gateway and a metric value for ISP interfaces when multiple gateways are set.&amp;lt;br&amp;gt;Save and close the file (:wq)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DNS domain name? (e.g. &#039;bar.com&#039;) []:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter the domain name of your intranet, e.g.,&#039;&#039; &#039;&#039;&#039;example.net&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DNS nameservers(s)? []:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;&#039;8.8.8.8 8.8.4.4&#039;&#039;&#039; (we will change them later)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Changing password for root&amp;lt;br&amp;gt;New password:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Enter a secure password for the console&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Retype password:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Retype the above password&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which timezone are you in? (&#039;?&#039; for list) [UTC]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;UTC&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;HTTP/FTP proxy URL? (e.g. &#039;http://proxy:8080&#039;, or &#039;none&#039;) [none]&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter mirror number (1-9) or URL to add (or r/f/e/done) [f]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Select a mirror close to you and press Enter&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which SSH server? (&#039;openssh&#039;, &#039;dropbear&#039; or &#039;none&#039;) [openssh]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;openssh&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which NTP client to run? (&#039;openntpd&#039;, &#039;chrony&#039; or &#039;none&#039;) [chrony]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;chrony&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Which disk(s) would you like to use? (or &#039;?&#039; for help or &#039;none&#039;) [none]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;none&#039; or type &#039;none&#039; if needed&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter where to store configs (&#039;floppy&#039;, &#039;usb&#039; or &#039;none&#039;) [usb]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;usb&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;Enter apk cache directory (or &#039;?&#039; or &#039;none&#039;) [/media/usb/cache]:&amp;lt;/code&amp;gt;&lt;br /&gt;
|&#039;&#039;Press Enter confirming &#039;/media/usb/cache&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bonding ==&lt;br /&gt;
Update the bonding configuration:&lt;br /&gt;
&lt;br /&gt;
 echo bonding mode=balance-tlb miimon=100 updelay=500 &amp;gt;&amp;gt; /etc/modules&lt;br /&gt;
&lt;br /&gt;
== Physically install ==&lt;br /&gt;
At this point, you&#039;re ready to connect the VPN Spoke Node to the network if you haven&#039;t already done so.  Please set up an 802.1q capable switch with the VLANs listed in AlpineSetup section.  Once done, tag all of the VLANs on one port.  Connect that port to eth0.  Then, connect your first ISP&#039;s CPE to a switchport with VLAN 256 untagged.&lt;br /&gt;
&lt;br /&gt;
== SSH ==&lt;br /&gt;
Remove password authentication and DNS reverse lookup:&lt;br /&gt;
{{Cmd|sed -i &amp;quot;s/.PasswordAuthentication yes/PasswordAuthentication no/&amp;quot; /etc/ssh/sshd_config&lt;br /&gt;
sed -i &amp;quot;s/.UseDNS yes/UseDNS no/&amp;quot; /etc/ssh/sshd_config}}&lt;br /&gt;
&lt;br /&gt;
== Recursive DNS  ==&lt;br /&gt;
{{Cmd|apk add -U unbound}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/unbound/unbound.conf&amp;lt;/code&amp;gt; and add the following configuration.  If you have a domain that you want unbound to resolve but is internal to your network only, the stub-zone stanza is present:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
server:&lt;br /&gt;
        verbosity: 1&lt;br /&gt;
        interface: 10.1.0.1&lt;br /&gt;
        do-ip4: yes&lt;br /&gt;
        do-ip6: no&lt;br /&gt;
        do-udp: yes&lt;br /&gt;
        do-tcp: yes&lt;br /&gt;
        do-daemonize: yes&lt;br /&gt;
        access-control: 10.1.0.0/16 allow&lt;br /&gt;
        access-control: 127.0.0.0/8 allow&lt;br /&gt;
&lt;br /&gt;
do-not-query-localhost: no&lt;br /&gt;
&lt;br /&gt;
root-hints: &amp;quot;/etc/unbound/root.hints&amp;quot;&lt;br /&gt;
&lt;br /&gt;
stub-zone:&lt;br /&gt;
	name: &amp;quot;location1.example.net&amp;quot;&lt;br /&gt;
	stub-addr: 10.1.0.2&lt;br /&gt;
&lt;br /&gt;
stub-zone:&lt;br /&gt;
        name: &amp;quot;example.net&amp;quot;&lt;br /&gt;
        stub-addr: 172.16.255.1&lt;br /&gt;
        stub-addr: 172.16.255.2&lt;br /&gt;
        stub-addr: 172.16.255.3&lt;br /&gt;
        stub-addr: 172.16.255.4&lt;br /&gt;
        stub-addr: 172.16.255.5&lt;br /&gt;
        stub-addr: 172.16.255.7&lt;br /&gt;
&lt;br /&gt;
stub-zone:&lt;br /&gt;
        name: &amp;quot;example2.net&amp;quot;&lt;br /&gt;
        stub-addr: 172.16.255.1&lt;br /&gt;
        stub-addr: 172.16.255.2&lt;br /&gt;
        stub-addr: 172.16.255.3&lt;br /&gt;
        stub-addr: 172.16.255.4&lt;br /&gt;
        stub-addr: 172.16.255.5&lt;br /&gt;
        stub-addr: 172.16.255.7&lt;br /&gt;
&lt;br /&gt;
python:&lt;br /&gt;
remote-control:&lt;br /&gt;
        control-enable: no&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start unbound:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/unbound start&lt;br /&gt;
rc-update add unbound&lt;br /&gt;
echo nameserver 10.1.0.1 &amp;gt; /etc/resolv.conf}}&lt;br /&gt;
&lt;br /&gt;
== Local DNS Zone ==&lt;br /&gt;
If you have a DNS zone that is only resolvable internally to your network, you will need a 2nd IP address on your LAN interface, and use NSD to host the zone.&lt;br /&gt;
&lt;br /&gt;
First, add the following to the end of the bond0.8 stanza in /etc/network/interfaces:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto bond0.8&lt;br /&gt;
     ...&lt;br /&gt;
     ...&lt;br /&gt;
     up ip addr add 10.1.0.2/24 dev bond0.8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, install nsd:&lt;br /&gt;
{{Cmd|apk add nsd}}&lt;br /&gt;
&lt;br /&gt;
Create /etc/nsd/nsd.conf:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
server:&lt;br /&gt;
        ip-address: 10.1.0.2&lt;br /&gt;
        port: 53&lt;br /&gt;
        server-count: 1&lt;br /&gt;
        ip4-only: yes&lt;br /&gt;
        hide-version: yes&lt;br /&gt;
        identity: &amp;quot;&amp;quot;&lt;br /&gt;
        zonesdir: &amp;quot;/etc/nsd&amp;quot;&lt;br /&gt;
zone:&lt;br /&gt;
        name: location1.example.net&lt;br /&gt;
        zonefile: location1.example.net.zone&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create zonefile in /etc/nsd/location1.example.net.zone:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
;## location1.example.net authoritative zone&lt;br /&gt;
&lt;br /&gt;
$ORIGIN location1.example.net.&lt;br /&gt;
$TTL 86400&lt;br /&gt;
&lt;br /&gt;
@ IN SOA ns1.location1.example.net. webmaster.location1.example.net. (&lt;br /&gt;
                2013081901      ; serial&lt;br /&gt;
                28800           ; refresh&lt;br /&gt;
                7200            ; retry&lt;br /&gt;
                86400           ; expire&lt;br /&gt;
                86400           ; min TTL&lt;br /&gt;
                )&lt;br /&gt;
&lt;br /&gt;
                NS              ns1.location1.example.net.&lt;br /&gt;
                MX      10      mail.location1.example.net.&lt;br /&gt;
ns              IN      A       10.1.0.2&lt;br /&gt;
mail            IN      A       10.1.0.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check configuration then start:&lt;br /&gt;
{{Cmd|nsd-checkconf /etc/nsd/nsd.conf&lt;br /&gt;
nsdc rebuild&lt;br /&gt;
/etc/init.d/nsd start&lt;br /&gt;
rc-update add nsd}}&lt;br /&gt;
&lt;br /&gt;
== GRE Tunnel ==&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; and add the following:&lt;br /&gt;
&lt;br /&gt;
 auto gre1&lt;br /&gt;
 iface gre1 inet static&lt;br /&gt;
       pre-up ip tunnel add $IFACE mode gre ttl 64 tos inherit key 12.34.56.78 || true&lt;br /&gt;
       address 172.16.1.1&lt;br /&gt;
       netmask 255.255.0.0&lt;br /&gt;
       post-down ip tunnel del $IFACE || true&lt;br /&gt;
&lt;br /&gt;
Save and close the file.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ifup gre1}}&lt;br /&gt;
&lt;br /&gt;
== IPSEC ==&lt;br /&gt;
{{Cmd|apk add ipsec-tools}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor create &amp;lt;code&amp;gt;/etc/ipsec.conf&amp;lt;/code&amp;gt; and set the content to the following:&lt;br /&gt;
&lt;br /&gt;
 spdflush;&lt;br /&gt;
 spdadd 0.0.0.0/0 0.0.0.0/0 gre -P out	ipsec esp/transport//require;&lt;br /&gt;
 spdadd 0.0.0.0/0 0.0.0.0/0 gre -P in 	ipsec esp/transport//require;&lt;br /&gt;
&lt;br /&gt;
{{Cmd|mkdir /etc/racoon/}}&lt;br /&gt;
&lt;br /&gt;
Extract your pfx into /etc/racoon, using the filenames &#039;&#039;&#039;ca.pem&#039;&#039;&#039;, &#039;&#039;&#039;cert.pem&#039;&#039;&#039;, and &#039;&#039;&#039;key.pem&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor create &amp;lt;code&amp;gt;/etc/racoon/racoon.conf&amp;lt;/code&amp;gt; and set the content to the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
path certificate &amp;quot;/etc/racoon/&amp;quot;;&lt;br /&gt;
remote anonymous {&lt;br /&gt;
	exchange_mode main;&lt;br /&gt;
	lifetime time 2 hour;&lt;br /&gt;
	certificate_type x509 &amp;quot;/etc/racoon/cert.pem&amp;quot; &amp;quot;/etc/racoon/key.pem&amp;quot;;&lt;br /&gt;
	ca_type x509 &amp;quot;/etc/racoon/ca.pem&amp;quot;;&lt;br /&gt;
	my_identifier asn1dn;&lt;br /&gt;
	nat_traversal on;&lt;br /&gt;
        script &amp;quot;/etc/opennhrp/racoon-ph1dead.sh&amp;quot; phase1_dead;&lt;br /&gt;
	dpd_delay 120;&lt;br /&gt;
	proposal {&lt;br /&gt;
		encryption_algorithm aes 256;&lt;br /&gt;
		hash_algorithm sha1;&lt;br /&gt;
		authentication_method rsasig;&lt;br /&gt;
		dh_group modp4096;&lt;br /&gt;
	}&lt;br /&gt;
	proposal {&lt;br /&gt;
		encryption_algorithm aes 256;&lt;br /&gt;
		hash_algorithm sha1;&lt;br /&gt;
		authentication_method rsasig;&lt;br /&gt;
		dh_group 2;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sainfo anonymous {&lt;br /&gt;
	pfs_group 2;&lt;br /&gt;
	lifetime time 2 hour;&lt;br /&gt;
	encryption_algorithm aes 256;&lt;br /&gt;
	authentication_algorithm hmac_sha1;&lt;br /&gt;
	compression_algorithm deflate;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit /etc/conf.d/racoon and unset RACOON_PSK_FILE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
RACOON_PSK_FILE=&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and close the file.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/racoon start&lt;br /&gt;
rc-update add racoon}}&lt;br /&gt;
&lt;br /&gt;
== Next Hop Resolution Protocol (NHRP) ==&lt;br /&gt;
{{Cmd|apk add opennhrp}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp.conf&amp;lt;/code&amp;gt; and change the content to the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface gre1&lt;br /&gt;
	dynamic-map 172.16.0.0/16 hub.example.com&lt;br /&gt;
	shortcut&lt;br /&gt;
	redirect&lt;br /&gt;
	non-caching&lt;br /&gt;
&lt;br /&gt;
interface bond0.8&lt;br /&gt;
	shortcut-destination&lt;br /&gt;
&lt;br /&gt;
interface bond0.64&lt;br /&gt;
	shortcut-destination&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must have a DNS A record &#039;&#039;hub.example.com&#039;&#039; for each hub node IP address.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp-script&amp;lt;/code&amp;gt; and change the content to the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
MYAS=$(sed -n &#039;s/router bgp \(\d*\)/\1/p&#039; &amp;lt; /etc/quagga/bgpd.conf)&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
interface-up)&lt;br /&gt;
    echo &amp;quot;Interface $NHRP_INTERFACE is up&amp;quot;&lt;br /&gt;
    if [ &amp;quot;$NHRP_INTERFACE&amp;quot; = &amp;quot;gre1&amp;quot; ]; then&lt;br /&gt;
        ip route flush proto 42 dev $NHRP_INTERFACE&lt;br /&gt;
        ip neigh flush dev $NHRP_INTERFACE&lt;br /&gt;
&lt;br /&gt;
        vtysh -d bgpd \&lt;br /&gt;
            -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
            -c &amp;quot;router bgp $MYAS&amp;quot; \&lt;br /&gt;
            -c &amp;quot;no neighbor core&amp;quot; \&lt;br /&gt;
            -c &amp;quot;neighbor core peer-group&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
    ;;&lt;br /&gt;
peer-register)&lt;br /&gt;
    ;;&lt;br /&gt;
peer-up)&lt;br /&gt;
    if [ -n &amp;quot;$NHRP_DESTMTU&amp;quot; ]; then&lt;br /&gt;
        ARGS=`ip route get $NHRP_DESTNBMA from $NHRP_SRCNBMA | head -1`&lt;br /&gt;
        ip route add $ARGS proto 42 mtu $NHRP_DESTMTU&lt;br /&gt;
    fi&lt;br /&gt;
    echo &amp;quot;Create link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
    racoonctl establish-sa -w isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA || exit 1&lt;br /&gt;
    racoonctl establish-sa -w esp inet $NHRP_SRCNBMA $NHRP_DESTNBMA gre || exit 1&lt;br /&gt;
    ;;&lt;br /&gt;
peer-down)&lt;br /&gt;
    echo &amp;quot;Delete link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
    racoonctl delete-sa isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA&lt;br /&gt;
    ip route del $NHRP_DESTNBMA src $NHRP_SRCNBMA proto 42&lt;br /&gt;
    ;;&lt;br /&gt;
nhs-up)&lt;br /&gt;
    echo &amp;quot;NHS UP $NHRP_DESTADDR&amp;quot;&lt;br /&gt;
    (&lt;br /&gt;
        flock -x 200&lt;br /&gt;
        vtysh -d bgpd \&lt;br /&gt;
            -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
            -c &amp;quot;router bgp $MYAS&amp;quot; \&lt;br /&gt;
            -c &amp;quot;neighbor $NHRP_DESTADDR remote-as 65000&amp;quot; \&lt;br /&gt;
            -c &amp;quot;neighbor $NHRP_DESTADDR peer-group core&amp;quot; \&lt;br /&gt;
            -c &amp;quot;exit&amp;quot; \&lt;br /&gt;
            -c &amp;quot;exit&amp;quot; \&lt;br /&gt;
            -c &amp;quot;clear bgp $NHRP_DESTADDR&amp;quot;&lt;br /&gt;
    ) 200&amp;gt;/var/lock/opennhrp-script.lock&lt;br /&gt;
    ;;&lt;br /&gt;
nhs-down)&lt;br /&gt;
    (&lt;br /&gt;
        flock -x 200&lt;br /&gt;
        vtysh -d bgpd \&lt;br /&gt;
            -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
            -c &amp;quot;router bgp $MYAS&amp;quot; \&lt;br /&gt;
            -c &amp;quot;no neighbor $NHRP_DESTADDR&amp;quot;&lt;br /&gt;
    ) 200&amp;gt;/var/lock/opennhrp-script.lock&lt;br /&gt;
    ;;&lt;br /&gt;
route-up)&lt;br /&gt;
    echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is up&amp;quot;&lt;br /&gt;
    ip route replace $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42 via $NHRP_NEXTHOP dev $NHRP_INTERFACE&lt;br /&gt;
    ip route flush cache&lt;br /&gt;
    ;;&lt;br /&gt;
route-down)&lt;br /&gt;
    echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is down&amp;quot;&lt;br /&gt;
    ip route del $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42&lt;br /&gt;
    ip route flush cache&lt;br /&gt;
    ;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and close the file. Make it executable:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|chmod +x /etc/opennhrp/opennhrp-script&lt;br /&gt;
/etc/init.d/opennhrp start&lt;br /&gt;
rc-update add opennhrp}}&lt;br /&gt;
&lt;br /&gt;
== BGP ==&lt;br /&gt;
{{Cmd|apk add quagga&lt;br /&gt;
touch /etc/quagga/zebra.conf}}&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/quagga/bgpd.conf&amp;lt;/code&amp;gt; and change the content to the following (replace &amp;lt;code&amp;gt;strongpassword&amp;lt;/code&amp;gt; with a password of your choice and %HUB_GRE_IP% with the &#039;&#039;&#039;Hub&#039;&#039;&#039; node GRE IP address):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
password strongpassword&lt;br /&gt;
enable password strongpassword&lt;br /&gt;
log syslog&lt;br /&gt;
&lt;br /&gt;
access-list 1 remark Command line access authorized IP&lt;br /&gt;
access-list 1 permit 127.0.0.1&lt;br /&gt;
line vty&lt;br /&gt;
 access-class 1&lt;br /&gt;
&lt;br /&gt;
hostname vpnc.example.net&lt;br /&gt;
&lt;br /&gt;
router bgp 65001&lt;br /&gt;
	bgp router-id 172.16.1.1&lt;br /&gt;
	network 10.1.0.0/16&lt;br /&gt;
	neighbor %HUB_GRE_IP% remote-as 65000&lt;br /&gt;
	neighbor %HUB_GRE_IP% remote-as 65000&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the line &amp;lt;code&amp;gt;neighbor %HUB_GRE_IP% remote-as 65000&amp;lt;/code&amp;gt; for each &#039;&#039;&#039;Hub&#039;&#039;&#039; host you have in your NBMA cloud.&lt;br /&gt;
&lt;br /&gt;
Save and close the file.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/bgpd start&lt;br /&gt;
rc-update add bgpd}}&lt;br /&gt;
&lt;br /&gt;
== OpenVPN ==&lt;br /&gt;
{{Cmd|echo tun &amp;gt;&amp;gt; /etc/modules&lt;br /&gt;
modprobe tun&lt;br /&gt;
apk add openvpn openssl&lt;br /&gt;
openssl dhparam -out /etc/openvpn/dh1024.pem 1024}}&lt;br /&gt;
&lt;br /&gt;
Set up the config in /etc/openvpn/openvpn.conf&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dev tun&lt;br /&gt;
proto udp&lt;br /&gt;
port 1194&lt;br /&gt;
&lt;br /&gt;
server 10.1.128.0 255.255.255.0&lt;br /&gt;
push &amp;quot;route 10.0.0.0 255.0.0.0&amp;quot;&lt;br /&gt;
push &amp;quot;dhcp-option DNS 10.1.0.1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
tls-server&lt;br /&gt;
ca /etc/openvpn/cacert.pem&lt;br /&gt;
cert /etc/openvpn/servercert.pem&lt;br /&gt;
key /etc/openvpn/serverkey.pem&lt;br /&gt;
&lt;br /&gt;
crl-verify /etc/openvpn/crl.pem&lt;br /&gt;
&lt;br /&gt;
dh /etc/openvpn/dh1024.pem&lt;br /&gt;
&lt;br /&gt;
persist-key&lt;br /&gt;
persist-tun&lt;br /&gt;
&lt;br /&gt;
keepalive 10 120&lt;br /&gt;
&lt;br /&gt;
comp-lzo&lt;br /&gt;
&lt;br /&gt;
status /var/log/openvpn.status&lt;br /&gt;
mute 20&lt;br /&gt;
verb 3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/openvpn start&lt;br /&gt;
rc-update add openvpn}}&lt;br /&gt;
&lt;br /&gt;
== Firewall ==&lt;br /&gt;
{{Cmd|apk add awall}}&lt;br /&gt;
&lt;br /&gt;
Enable IP forwarding&lt;br /&gt;
{{Cmd|sysctl -w net.ipv4.ip_forward{{=}}1&lt;br /&gt;
sed -i &#039;s/.*net\.ipv4\.ip_forward.*$/net.ipv4.ip_forward {{=}} 1/g&#039; /etc/sysctl.conf}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With your favorite editor, edit the following files and set their contents as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;/etc/awall/optional/params.json&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;params&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;B_IF&amp;quot; = &amp;quot;bond0.8&amp;quot;,&lt;br /&gt;
    &amp;quot;C_IF&amp;quot; = &amp;quot;bond0.64&amp;quot;,&lt;br /&gt;
    &amp;quot;ISP1_IF&amp;quot; = &amp;quot;bond0.256&amp;quot;,&lt;br /&gt;
    &amp;quot;ISP2_IF&amp;quot; = &amp;quot;bond0.257&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;/etc/awall/optional/internet-host.json&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Internet host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;params&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;E&amp;quot;: { &amp;quot;iface&amp;quot;: [ &amp;quot;$ISP1_IF&amp;quot;, &amp;quot;$ISP2_IF&amp;quot; ] },&lt;br /&gt;
    &amp;quot;ISP1&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$ISP1_IF&amp;quot; },&lt;br /&gt;
    &amp;quot;ISP2&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$ISP2_IF&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;ping&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;,&lt;br /&gt;
      &amp;quot;flow-limit&amp;quot;: { &amp;quot;count&amp;quot;: 10, &amp;quot;interval&amp;quot;: 6 }&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ssh&amp;quot;, &amp;quot;https&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;,&lt;br /&gt;
      &amp;quot;conn-limit&amp;quot;: { &amp;quot;count&amp;quot;: 3, &amp;quot;interval&amp;quot;: 60 }&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;dns&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;ntp&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ping&amp;quot;, &amp;quot;ssh&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;/etc/awall/optional/openvpn.json&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;OpenVPN support&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;internet-host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;service&amp;quot;: { &lt;br /&gt;
     &amp;quot;openvpn&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;udp&amp;quot;, &amp;quot;port&amp;quot;: 1194 }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [ &lt;br /&gt;
     { &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;openvpn&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
    ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;/etc/awall/optional/clampmss.json&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Deal with ISPs afraid of ICMP&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;internet-host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;clamp-mss&amp;quot;: [ { &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot; } ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;/etc/awall/optional/mark.json&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Mark traffic based on ISP&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: [ &amp;quot;params&amp;quot;, &amp;quot;internet-host&amp;quot; ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;route-track&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;ISP1&amp;quot;, &amp;quot;mark&amp;quot;: 1 },&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;ISP2&amp;quot;, &amp;quot;mark&amp;quot;: 2 }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;/etc/awall/optional/dmvpn.json&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;DMVPN router&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: &amp;quot;internet-host&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;A_ADDR&amp;quot;: [ &amp;quot;10.0.0.0/8&amp;quot;, &amp;quot;172.16.0.0/16&amp;quot; ]&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;A&amp;quot;: { &amp;quot;addr&amp;quot;: &amp;quot;$A_ADDR&amp;quot;, &amp;quot;iface&amp;quot;: &amp;quot;gre1&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;ipsec&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;ipsec&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;ipsec&amp;quot;: &amp;quot;in&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;gre&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;,&lt;br /&gt;
      &amp;quot;ipsec&amp;quot;: &amp;quot;out&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;gre&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;bgp&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;service&amp;quot;: &amp;quot;bgp&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;},&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;dest&amp;quot;: &amp;quot;$A_ADDR&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;reject&amp;quot; }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&#039;&#039;&#039;/etc/awall/optional/vpnc.json&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;VPNc&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;import&amp;quot;: [ &amp;quot;params&amp;quot;, &amp;quot;internet-host&amp;quot;, &amp;quot;dmvpn&amp;quot; ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;B&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$B_IF&amp;quot; },&lt;br /&gt;
    &amp;quot;C&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;$C_IF&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;policy&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;B&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;C&amp;quot;, &amp;quot;out&amp;quot;: [ &amp;quot;A&amp;quot;, &amp;quot;E&amp;quot; ], &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;E&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;drop&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;A&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;snat&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;E&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;A&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;ping&amp;quot;, &amp;quot;ssh&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;https&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: [ &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot; ],&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;dns&amp;quot;, &amp;quot;ntp&amp;quot;, &amp;quot;http&amp;quot;, &amp;quot;https&amp;quot;, &amp;quot;ssh&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;out&amp;quot;: [ &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot; ],&lt;br /&gt;
      &amp;quot;service&amp;quot;: [ &amp;quot;dns&amp;quot;, &amp;quot;ntp&amp;quot; ],&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
    { &lt;br /&gt;
      &amp;quot;in&amp;quot;: [ &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot; ],&lt;br /&gt;
      &amp;quot;out&amp;quot;: &amp;quot;_fw&amp;quot;,&lt;br /&gt;
      &amp;quot;proto&amp;quot;: &amp;quot;icmp&amp;quot;,&lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Cmd|modprobe ip_tables&lt;br /&gt;
modprobe iptable_nat &lt;br /&gt;
awall enable clampmss&lt;br /&gt;
awall enable openvpn&lt;br /&gt;
awall enable vpnc&lt;br /&gt;
awall activate&lt;br /&gt;
rc-update add iptables}}&lt;br /&gt;
&lt;br /&gt;
== ISP Failover ==&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add pingu&lt;br /&gt;
echo -e &amp;quot;1\tisp1&amp;quot;&amp;gt;&amp;gt; /etc/iproute2/rt_tables&lt;br /&gt;
echo -e &amp;quot;2\tisp2&amp;quot;&amp;gt;&amp;gt; /etc/iproute2/rt_tables}}&lt;br /&gt;
&lt;br /&gt;
Configure pingu to monitor our bond0.256 and bond0.257 interfaces in &amp;lt;code&amp;gt;/etc/pingu/pingu.conf&amp;lt;/code&amp;gt;.  Add the hosts to monitor for ISP failover to &amp;lt;code&amp;gt;/etc/pingu/pingu.conf&amp;lt;/code&amp;gt; and bind to primary ISP. We also set the ping timeout to 4 seconds.:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timeout 4&lt;br /&gt;
required 2&lt;br /&gt;
retry 11&lt;br /&gt;
&lt;br /&gt;
interface bond0.256 { &lt;br /&gt;
  # route-table must correspond with mark in /etc/awall/optional/mark.json&lt;br /&gt;
  route-table 1&lt;br /&gt;
  fwmark 1&lt;br /&gt;
  rule-priority 20000&lt;br /&gt;
  # google dns&lt;br /&gt;
  ping 8.8.8.8&lt;br /&gt;
  # opendns&lt;br /&gt;
  ping 208.67.222.222&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
interface bond0.257 {&lt;br /&gt;
  # route-table must correspond with mark in /etc/awall/optional/mark.json&lt;br /&gt;
  route-table 2&lt;br /&gt;
  fwmark 2&lt;br /&gt;
  rule-priority 20000&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure we can reach the public IP from our LAN by adding static route rules for our private net(s). Edit &amp;lt;code&amp;gt;/etc/pingu/route-rules&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
to 10.0.0.0/8 table main prio 1000&lt;br /&gt;
to 172.16.0.0/12 table main prio 1000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start pingu:&lt;br /&gt;
{{Cmd|/etc/init.d/pingu start&lt;br /&gt;
rc-update add pingu}}&lt;br /&gt;
&lt;br /&gt;
Now, if both hosts stop responding to pings, ISP-1 will be considered down and all gateways via bond0.256 will be removed from main route table. Note that the gateway will not be removed from the route table &#039;1&#039;. This is so we can continue try ping via bond0.256 so we can detect that the ISP is back online. When ISP starts working again, the gateways will be added back to main route table again.&lt;br /&gt;
&lt;br /&gt;
== Commit Configuration ==&lt;br /&gt;
{{Cmd|lbu ci}}&lt;br /&gt;
&lt;br /&gt;
= Hub Node =&lt;br /&gt;
We will document only what changes from the Spoke node setup.&lt;br /&gt;
&lt;br /&gt;
== Routing Tables ==&lt;br /&gt;
{{Cmd|echo -e &amp;quot;42\tnhrp_shortcut\n43\tnhrp_mtu\n44\tquagga\n}}&lt;br /&gt;
&lt;br /&gt;
== NHRP ==&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp.conf&amp;lt;/code&amp;gt; on Hub 2 and set the content as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface gre1&lt;br /&gt;
  map %Hub1_GRE_IP%/%MaskBit% hub1.example.org&lt;br /&gt;
  route-table 44&lt;br /&gt;
  shortcut&lt;br /&gt;
  redirect&lt;br /&gt;
  non-caching&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Do the same on Hub 1 adding the data relative to Hub 2.&lt;br /&gt;
&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/opennhrp/opennhrp-script&amp;lt;/code&amp;gt; and set the content as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
interface-up)&lt;br /&gt;
	ip route flush proto 42 dev $NHRP_INTERFACE&lt;br /&gt;
	ip neigh flush dev $NHRP_INTERFACE&lt;br /&gt;
	;;&lt;br /&gt;
peer-register)&lt;br /&gt;
	CERT=`racoonctl get-cert inet $NHRP_SRCNBMA $NHRP_DESTNBMA | openssl x509 -inform der -text -noout | egrep -o &amp;quot;/OU=[^/]*(/[0-9]+)?&amp;quot; | cut -b 5-`&lt;br /&gt;
	if [ -z &amp;quot;`echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^GRE=$NHRP_DESTADDR&amp;quot;`&amp;quot; ]; then&lt;br /&gt;
		logger -t opennhrp-script -p auth.err &amp;quot;GRE registration of $NHRP_DESTADDR to $NHRP_DESTNBMA DENIED&amp;quot;&lt;br /&gt;
		exit 1&lt;br /&gt;
	fi&lt;br /&gt;
	logger -t opennhrp-script -p auth.info &amp;quot;GRE registration of $NHRP_DESTADDR to $NHRP_DESTNBMA authenticated&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	(&lt;br /&gt;
		flock -x 200&lt;br /&gt;
		&lt;br /&gt;
		AS=`echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^AS=&amp;quot; | cut -b 4-`&lt;br /&gt;
		vtysh -d bgpd -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
			-c &amp;quot;router bgp 65000&amp;quot; \&lt;br /&gt;
			-c &amp;quot;neighbor $NHRP_DESTADDR remote-as $AS&amp;quot; \&lt;br /&gt;
			-c &amp;quot;neighbor $NHRP_DESTADDR peer-group leaf&amp;quot; \&lt;br /&gt;
			-c &amp;quot;neighbor $NHRP_DESTADDR prefix-list net-$AS-in in&amp;quot;&lt;br /&gt;
&lt;br /&gt;
		SEQ=5&lt;br /&gt;
		(echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^NET=&amp;quot; | cut -b 5-) | while read NET; do&lt;br /&gt;
			vtysh -d bgpd -c &amp;quot;configure terminal&amp;quot; \&lt;br /&gt;
				-c &amp;quot;ip prefix-list net-$AS-in seq $SEQ permit $NET le 26&amp;quot;&lt;br /&gt;
			SEQ=$(($SEQ+5))&lt;br /&gt;
		done&lt;br /&gt;
	) 200&amp;gt;/var/lock/opennhrp-script.lock&lt;br /&gt;
	;;&lt;br /&gt;
peer-up)&lt;br /&gt;
	echo &amp;quot;Create link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
	racoonctl establish-sa -w isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA || exit 1&lt;br /&gt;
	racoonctl establish-sa -w esp inet $NHRP_SRCNBMA $NHRP_DESTNBMA gre || exit 1 &lt;br /&gt;
&lt;br /&gt;
	CERT=`racoonctl get-cert inet $NHRP_SRCNBMA $NHRP_DESTNBMA | openssl x509 -inform der -text -noout | egrep -o &amp;quot;/OU=[^/]*(/[0-9]+)?&amp;quot; | cut -b 5-`&lt;br /&gt;
	if [ -z &amp;quot;`echo &amp;quot;$CERT&amp;quot; | grep &amp;quot;^GRE=$NHRP_DESTADDR&amp;quot;`&amp;quot; ]; then&lt;br /&gt;
		logger -p daemon.err &amp;quot;GRE mapping of $NHRP_DESTADDR to $NHRP_DESTNBMA DENIED&amp;quot;&lt;br /&gt;
		exit 1&lt;br /&gt;
	fi&lt;br /&gt;
&lt;br /&gt;
	if [ -n &amp;quot;$NHRP_DESTMTU&amp;quot; ]; then&lt;br /&gt;
		ARGS=`ip route get $NHRP_DESTNBMA from $NHRP_SRCNBMA | head -1`&lt;br /&gt;
		ip route add $ARGS proto 42 mtu $NHRP_DESTMTU table nhrp_mtu&lt;br /&gt;
	fi&lt;br /&gt;
	;;&lt;br /&gt;
peer-down)&lt;br /&gt;
	echo &amp;quot;Delete link from $NHRP_SRCADDR ($NHRP_SRCNBMA) to $NHRP_DESTADDR ($NHRP_DESTNBMA)&amp;quot;&lt;br /&gt;
	if [ &amp;quot;$NHRP_PEER_DOWN_REASON&amp;quot; != &amp;quot;lower-down&amp;quot; ]; then&lt;br /&gt;
		racoonctl delete-sa isakmp inet $NHRP_SRCNBMA $NHRP_DESTNBMA&lt;br /&gt;
	fi&lt;br /&gt;
	ip route del $NHRP_DESTNBMA src $NHRP_SRCNBMA proto 42 table nhrp_mtu&lt;br /&gt;
	;;&lt;br /&gt;
route-up)&lt;br /&gt;
	echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is up&amp;quot;&lt;br /&gt;
	ip route replace $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42 via $NHRP_NEXTHOP dev $NHRP_INTERFACE table nhrp_shortcut&lt;br /&gt;
	ip route flush cache&lt;br /&gt;
	;;&lt;br /&gt;
route-down)&lt;br /&gt;
	echo &amp;quot;Route $NHRP_DESTADDR/$NHRP_DESTPREFIX is down&amp;quot;&lt;br /&gt;
	ip route del $NHRP_DESTADDR/$NHRP_DESTPREFIX proto 42 table nhrp_shortcut&lt;br /&gt;
	ip route flush cache&lt;br /&gt;
	;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== BGP ==&lt;br /&gt;
With your favorite editor open &amp;lt;code&amp;gt;/etc/quagga/bgpd.conf&amp;lt;/code&amp;gt; on Hub 2 and set the content as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
password zebra&lt;br /&gt;
enable password zebra&lt;br /&gt;
log syslog&lt;br /&gt;
&lt;br /&gt;
router bgp 65000&lt;br /&gt;
 bgp router-id %Hub2_GRE_IP%&lt;br /&gt;
 bgp deterministic-med&lt;br /&gt;
 network %GRE_NETWORK%/%MASK_BITS%&lt;br /&gt;
 neighbor hub peer-group&lt;br /&gt;
 neighbor hub next-hop-self&lt;br /&gt;
 neighbor hub route-map CORE-IN in&lt;br /&gt;
 neighbor spoke peer-group&lt;br /&gt;
 neighbor spoke passive&lt;br /&gt;
 neighbor spoke next-hop-self&lt;br /&gt;
 neighbor %Spoke1_GRE_IP% remote-as 65001&lt;br /&gt;
 neighbor %Spoke1_GRE_IP% peer-group spoke&lt;br /&gt;
 neighbor %Spoke1_GRE_IP% prefix-list net-65001-in in&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
 neighbor hub remote-as 65000&lt;br /&gt;
 neighbor %Hub1_GRE_IP% peer-group core&lt;br /&gt;
&lt;br /&gt;
 ip prefix-list net-65001-in seq 5 permit 10.1.0.0/16 le 26&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
 route-map CORE-IN permit 10&lt;br /&gt;
 set metric +100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the lines &amp;lt;code&amp;gt;neighbor %Spoke1_GRE_IP%...&amp;lt;/code&amp;gt; for each spoke node you have. Do the same on Hub 1, changing the relevant data for Hub 2.&lt;br /&gt;
&lt;br /&gt;
= Troubleshooting the DMVPN =&lt;br /&gt;
== Broken [http://en.wikipedia.org/wiki/Path_MTU_Discovery Path MTU Discovery (PMTUD)] ==&lt;br /&gt;
ISPs afraid of ICMP (which is somehow legitimate) often just blindly add &amp;lt;code&amp;gt;no ip unreachables&amp;lt;/code&amp;gt; in their router interfaces, effectively creating a [http://en.wikipedia.org/wiki/Black_hole_%28networking%29 blackhole router] that breaks PMTUD, since ICMP Type 3 Code 4 packets (Fragmentation Needed) are dropped. PMTUD is needed by ISAKMP that runs on UDP (TCP works because it uses CLAMPMSS).&lt;br /&gt;
&lt;br /&gt;
For technical details see http://packetlife.net/blog/2008/oct/9/disabling-unreachables-breaks-pmtud/&lt;br /&gt;
&lt;br /&gt;
PMTUD could also be broken due to badly configured DSL modem/routers or bugged firmware. Turning off the firewall on modem itself or any VPN passthrough functionality it may help.&lt;br /&gt;
&lt;br /&gt;
You can easily detect which host is the blackhole router by pinging with DF bit set and with packets of standard MTU size, each hop given in your traceroute to destination:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ping -M do -s 1472 %IP%}}&lt;br /&gt;
{{Note|&amp;quot;-M do&amp;quot; requires GNU ping, present in &amp;lt;code&amp;gt;iputils&amp;lt;/code&amp;gt; package}}&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t get a response back (either Echo-Response or Fragmentation-Needed) there&#039;s firewall dropping ICMP packets. If it answers to normal ping packets (DF bit cleared), most likely you have hit a blackhole router.&lt;br /&gt;
&lt;br /&gt;
== Kernel and NHRP Routing Cache Issues ==&lt;br /&gt;
TODO&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Create_a_Bootable_Device&amp;diff=9285</id>
		<title>Create a Bootable Device</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Create_a_Bootable_Device&amp;diff=9285"/>
		<updated>2013-08-22T06:56:23Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: /* Creating a bootable Alpine Linux USB Stick with UNetbootin */ Updated link to download page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Creating a bootable Alpine Linux USB Stick with UNetbootin ==&lt;br /&gt;
&lt;br /&gt;
UNetbootin is a graphical tool that allows you to create bootable Live USB drives for Ubuntu, Fedora, and other Linux distributions without burning a CD. UNetbootin is available for many distributions and Windows. This process applies to all versions of Alpine Linux, and results in a &#039;&#039;&#039;run-from-ram&#039;&#039;&#039; style installation.&lt;br /&gt;
&lt;br /&gt;
=== Requirements ===&lt;br /&gt;
To create a bootable Alpine Linux USB drive, you will need:&lt;br /&gt;
&lt;br /&gt;
* An Alpine Linux ISO image file ([http://alpinelinux.org/downloads Download])&lt;br /&gt;
* A partitioned and formatted USB drive&lt;br /&gt;
* [http://unetbootin.sourceforge.net/ UNetbootin]&lt;br /&gt;
&lt;br /&gt;
=== Process ===&lt;br /&gt;
&lt;br /&gt;
After the launch of UNetbootin, click the &#039;&#039;&#039;Diskimage&#039;&#039;&#039; radio button, and then the &#039;&#039;&#039;...&#039;&#039;&#039; button to select the Alpine ISO image.&lt;br /&gt;
&lt;br /&gt;
[[File:Unetbootin.png|size=400]]&lt;br /&gt;
&lt;br /&gt;
When you selected your USB device under &#039;&#039;&#039;Device&#039;&#039; and press &#039;&#039;&#039;OK&#039;&#039;&#039; to proceed. When UNetbootin is done, your USB drive is ready to use.&lt;br /&gt;
&lt;br /&gt;
== Creating a bootable Alpine Linux USB Stick from the command line ==&lt;br /&gt;
&lt;br /&gt;
This process applies to Alpine Linux 1.9.0 or later, and results in a &#039;&#039;&#039;run-from-ram&#039;&#039;&#039; style installation. &lt;br /&gt;
&lt;br /&gt;
=== Requirements ===&lt;br /&gt;
In order to follow this document, you will need:&lt;br /&gt;
* Alpine Linux CD-ROM ([[Downloads|Download]] a .iso file containing an Alpine release.)&lt;br /&gt;
* A USB drive (flash, external HD, card reader, etc.)&lt;br /&gt;
&lt;br /&gt;
{{:Include:Copying Alpine to Flash|USB stick}}&lt;br /&gt;
=== Slow USB Devices ===&lt;br /&gt;
Specifying the &#039;waitusb=X&#039; option at the end of the syslinux.cfg line might help with certain USB devices that take a bit longer to register. X stands for the amount of seconds kernel will wait before looking for the installation media.&lt;br /&gt;
 append initrd=/boot/grsec.gz alpine_dev=usbdisk:vfat modules=loop,cramfs,sd-mod,usb-storage quiet &#039;&#039;&#039;waitusb=3&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
{{:Include:Installing_Alpine_see_also}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=FaxServer_using_Asterisk&amp;diff=9163</id>
		<title>FaxServer using Asterisk</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=FaxServer_using_Asterisk&amp;diff=9163"/>
		<updated>2013-07-31T06:17:10Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: How to send faxes (e.g. for testing)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|This is a experimental page to see if this could replace a more complex setup using Asterisk+IAXmodem+hylafax}}&lt;br /&gt;
This document aims to create a as simple as possible to setup fax server to send and receive faxes using {{pkg|asterisk}} and {{pkg|asterisk-fax}}.&lt;br /&gt;
__NOTOC__&lt;br /&gt;
= Installation =&lt;br /&gt;
This wiki-doc is based on [http://www.alpinelinux.org/downloads Alpine Linux 2.6] &#039;&#039;(but might also work on version 2.1.3 or higher)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Start by [[Installation|setting up]] a Alpine Linux base system &#039;&#039;(you will most likely want to run &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; to setup the most basic settings)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Firewall ===&lt;br /&gt;
You might want to setup a firewall to protect your system. We will not address this task in this document. Some firewall alternatives in Alpine Linux are&lt;br /&gt;
* [[How-To_Alpine_Wall|AWall]]&lt;br /&gt;
* Shorewall&lt;br /&gt;
* iptables&lt;br /&gt;
&lt;br /&gt;
= Configure email =&lt;br /&gt;
=== Install required packages ===&lt;br /&gt;
We will use the package {{pkg|email}} to send the faxes by email to various recipients. Lets start by installing the package&lt;br /&gt;
{{cmd|apk add email}}&lt;br /&gt;
&lt;br /&gt;
==== General configuration ====&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/email/email.conf}}&lt;br /&gt;
{{tip|Work with your SMTP provider to set the appropriate settings. Most likely you will want to&lt;br /&gt;
* Change the variables &amp;lt;code&amp;gt;SMTP_SERVER&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;SMTP_PORT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MY_NAME&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MY_EMAIL&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ADDRESS_BOOK&amp;lt;/code&amp;gt;&lt;br /&gt;
* Comment out the variable &amp;lt;code&amp;gt;SIGNATURE_FILE&amp;lt;/code&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Address book ====&lt;br /&gt;
* Edit the appropriate file &#039;&#039;(In this example we assume you did not change the value of &amp;lt;code&amp;gt;ADDRESS_BOOK&amp;lt;/code&amp;gt; variable).&lt;br /&gt;
{{cmd|vi /etc/email/email.address.template}}&lt;br /&gt;
* Define some email addresses that suits your needs.&amp;lt;BR&amp;gt;The upcoming {{pkg|asterisk}} config assumes that you have some predefined records in this address book. Example:&lt;br /&gt;
{{cat|/etc/email/email.address.template|# Individual email addresses&lt;br /&gt;
single:joe          {{=}} joe@foo.bar&lt;br /&gt;
single:jeff         {{=}} jeff@foo.bar&lt;br /&gt;
single:jill         {{=}} jill@foo.bar&lt;br /&gt;
&lt;br /&gt;
# Group that will receive error reports&lt;br /&gt;
group: grp-support  {{=}} joe, jeff&lt;br /&gt;
&lt;br /&gt;
# Group that will receive faxes originated to extension 12345&lt;br /&gt;
group: grp-12345    {{=}} joe, jill&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Test functionality ====&lt;br /&gt;
When you done your {{pkg|email}} configuration you can test this by running commands like this:&lt;br /&gt;
{{cmd|email -s &amp;quot;testmail&amp;quot; -b jeff}}&lt;br /&gt;
&lt;br /&gt;
= Configure Asterisk =&lt;br /&gt;
There are multiple ways to configure Asterisk. This document only describes a very basic setup which you might want to modify based on your needs. But by following this document, you should have a fully functional fax-server using only {{pkg|asterisk}} and {{pkg|asterisk-fax}}.&lt;br /&gt;
&lt;br /&gt;
=== Install required packages ===&lt;br /&gt;
At this stage your Alpine Linux only holds some basic packages for base functionallity. We will need to install some extra packages in order to get the fax functionallity.&lt;br /&gt;
{{cmd|apk add asterisk asterisk-fax}}&lt;br /&gt;
&lt;br /&gt;
==== General setup ====&lt;br /&gt;
Set some general settings&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/asterisk/asterisk.conf}}&lt;br /&gt;
&lt;br /&gt;
* Copy this content to the file&lt;br /&gt;
{{cat|/etc/asterisk/asterisk.conf|[global]&lt;br /&gt;
astetcdir {{=}}&amp;gt; /etc/asterisk&lt;br /&gt;
astmoddir {{=}}&amp;gt; /usr/lib/asterisk/modules&lt;br /&gt;
astvarlibdir {{=}}&amp;gt; /var/lib/asterisk&lt;br /&gt;
astspooldir {{=}}&amp;gt; /var/spool/asterisk&lt;br /&gt;
astrundir {{=}}&amp;gt; /var/run/asterisk&lt;br /&gt;
astlogdir {{=}}&amp;gt; /var/log/asterisk&lt;br /&gt;
astdbdir {{=}}&amp;gt; /var/lib/asterisk&lt;br /&gt;
astkeydir {{=}}&amp;gt; /var/lib/asterisk&lt;br /&gt;
astdatadir {{=}}&amp;gt; /var/lib/asterisk&lt;br /&gt;
astagidir {{=}}&amp;gt; /var/lib/asterisk/agi-bin&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Load appropreate modules ====&lt;br /&gt;
Asterisk needs some modules to be able to handle fax.&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/asterisk/modules.conf}}&lt;br /&gt;
&lt;br /&gt;
* Copy this content to the file&lt;br /&gt;
{{cat|/etc/asterisk/modules.conf|[modules]&lt;br /&gt;
autoload{{=}}yes&lt;br /&gt;
}}&lt;br /&gt;
{{todo|Try changing this so we don&#039;t load more modules than we need}}&lt;br /&gt;
&lt;br /&gt;
==== Enable SIP ====&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/asterisk/sip.conf}}&lt;br /&gt;
&lt;br /&gt;
* Copy this content to the file&lt;br /&gt;
{{cat|/etc/asterisk/sip.conf|[general]&lt;br /&gt;
context{{=}}fax_incoming            ; Default context for incoming calls&lt;br /&gt;
allowoverlap{{=}}no                 ; Disable overlap dialing support. (Default is yes)&lt;br /&gt;
bindport{{=}}5060                   ; UDP Port to bind to (SIP standard port is 5060)&lt;br /&gt;
				; bindport is the local UDP port that Asterisk will listen on&lt;br /&gt;
bindaddr{{=}}0.0.0.0                ; IP address to bind to (0.0.0.0 binds to all)&lt;br /&gt;
srvlookup{{=}}no                    ; Enable DNS SRV lookups on outbound calls&lt;br /&gt;
disallow{{=}}all                    ; First disallow all codecs&lt;br /&gt;
allow{{=}}ulaw			; Allow codecs (in order of preference)&lt;br /&gt;
allow{{=}}alaw			; Allow codecs (in order of preference)&lt;br /&gt;
udpbindaddr{{=}}0.0.0.0&lt;br /&gt;
canreinvite{{=}}yes&lt;br /&gt;
t38pt_udptl{{=}}yes,redundancy,maxdatagram{{=}}400&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Enable udptl ====&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/asterisk/udptl.conf}}&lt;br /&gt;
&lt;br /&gt;
* Copy this content to the file&lt;br /&gt;
{{cat|/etc/asterisk/udptl.conf|[general]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Configure fax ====&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/asterisk/res_fax.conf}}&lt;br /&gt;
* Copy this content to the file&lt;br /&gt;
{{cat|/etc/asterisk/res_fax.conf|[general]&lt;br /&gt;
maxrate{{=}}9600&lt;br /&gt;
minrate{{=}}2400&lt;br /&gt;
statusevents{{=}}yes&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Configure dialplan ====&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/asterisk/extensions.lua}}&lt;br /&gt;
&lt;br /&gt;
* Copy this content to the file&lt;br /&gt;
{{cat|/etc/asterisk/extensions.lua|TODO...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Permissions ====&lt;br /&gt;
For {{pkg|asterisk}} to be able to read the new config files, we need to set the correct permissions to the files&lt;br /&gt;
{{cmd|chown -R asterisk:asterisk /etc/asterisk}}&lt;br /&gt;
&lt;br /&gt;
==== Start things up ====&lt;br /&gt;
Now its time to start up the services&lt;br /&gt;
{{cmd|/etc/init.d/asterisk start}}&lt;br /&gt;
Configure {{pkg|asterisk}} to autostart at next reboot&lt;br /&gt;
{{cmd|rc-update add asterisk}}&lt;br /&gt;
&lt;br /&gt;
= Testing =&lt;br /&gt;
== Sending fax ==&lt;br /&gt;
=== Prepare ===&lt;br /&gt;
Save a &#039;&amp;lt;tt&amp;gt;.tiff&amp;lt;/tt&amp;gt;&#039; file into &#039;&amp;lt;tt&amp;gt;/tmp/&amp;lt;/tt&amp;gt;&#039; (in our example we name the file &#039;&amp;lt;tt&amp;gt;/tmp/testfax.tiff&amp;lt;/tt&amp;gt;&#039;).&lt;br /&gt;
&lt;br /&gt;
Create a file that looks something like this &#039;&#039;(modify it for your local needs)&#039;&#039;.&lt;br /&gt;
{{cat|/tmp/testfax.txt|[general]&lt;br /&gt;
Channel: SIP/123@10.20.30.40&lt;br /&gt;
Callerid: &amp;quot;TestFAX&amp;quot;&lt;br /&gt;
WaitTime: 30&lt;br /&gt;
Maxretries:3&lt;br /&gt;
RetryTime: 300&lt;br /&gt;
Account: 1000&lt;br /&gt;
Application: SendFax&lt;br /&gt;
Data: /tmp/testfax.tiff&lt;br /&gt;
}}&lt;br /&gt;
Change permissions on the newly created files&lt;br /&gt;
{{cmd|chown asterisk:asterisk /tmp/testfax*}}&lt;br /&gt;
=== Send the fax ===&lt;br /&gt;
Now copy the &#039;&amp;lt;tt&amp;gt;/tmp/testfax.txt&amp;lt;/tt&amp;gt;&#039; to &#039;&amp;lt;tt&amp;gt;/var/spool/asterisk/outgoing/&amp;lt;/tt&amp;gt;&#039;. The second you do that, {{pkg|asterisk}} will try to send the fax based on what you wrote in the file.&lt;br /&gt;
{{cmd|cp -p /tmp/testfax.txt /var/spool/asterisk/outgoing/}}&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=FaxServer_using_Asterisk&amp;diff=9162</id>
		<title>FaxServer using Asterisk</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=FaxServer_using_Asterisk&amp;diff=9162"/>
		<updated>2013-07-31T06:06:18Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: udptl and sip configuration. Removing dialplan for now, lua version to come&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|This is a experimental page to see if this could replace a more complex setup using Asterisk+IAXmodem+hylafax}}&lt;br /&gt;
This document aims to create a as simple as possible to setup fax server to send and receive faxes using {{pkg|asterisk}} and {{pkg|asterisk-fax}}.&lt;br /&gt;
__NOTOC__&lt;br /&gt;
= Installation =&lt;br /&gt;
This wiki-doc is based on [http://www.alpinelinux.org/downloads Alpine Linux 2.6] &#039;&#039;(but might also work on version 2.1.3 or higher)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Start by [[Installation|setting up]] a Alpine Linux base system &#039;&#039;(you will most likely want to run &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; to setup the most basic settings)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Firewall ===&lt;br /&gt;
You might want to setup a firewall to protect your system. We will not address this task in this document. Some firewall alternatives in Alpine Linux are&lt;br /&gt;
* [[How-To_Alpine_Wall|AWall]]&lt;br /&gt;
* Shorewall&lt;br /&gt;
* iptables&lt;br /&gt;
&lt;br /&gt;
= Configure email =&lt;br /&gt;
=== Install required packages ===&lt;br /&gt;
We will use the package {{pkg|email}} to send the faxes by email to various recipients. Lets start by installing the package&lt;br /&gt;
{{cmd|apk add email}}&lt;br /&gt;
&lt;br /&gt;
==== General configuration ====&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/email/email.conf}}&lt;br /&gt;
{{tip|Work with your SMTP provider to set the appropriate settings. Most likely you will want to&lt;br /&gt;
* Change the variables &amp;lt;code&amp;gt;SMTP_SERVER&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;SMTP_PORT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MY_NAME&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MY_EMAIL&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ADDRESS_BOOK&amp;lt;/code&amp;gt;&lt;br /&gt;
* Comment out the variable &amp;lt;code&amp;gt;SIGNATURE_FILE&amp;lt;/code&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Address book ====&lt;br /&gt;
* Edit the appropriate file &#039;&#039;(In this example we assume you did not change the value of &amp;lt;code&amp;gt;ADDRESS_BOOK&amp;lt;/code&amp;gt; variable).&lt;br /&gt;
{{cmd|vi /etc/email/email.address.template}}&lt;br /&gt;
* Define some email addresses that suits your needs.&amp;lt;BR&amp;gt;The upcoming {{pkg|asterisk}} config assumes that you have some predefined records in this address book. Example:&lt;br /&gt;
{{cat|/etc/email/email.address.template|# Individual email addresses&lt;br /&gt;
single:joe          {{=}} joe@foo.bar&lt;br /&gt;
single:jeff         {{=}} jeff@foo.bar&lt;br /&gt;
single:jill         {{=}} jill@foo.bar&lt;br /&gt;
&lt;br /&gt;
# Group that will receive error reports&lt;br /&gt;
group: grp-support  {{=}} joe, jeff&lt;br /&gt;
&lt;br /&gt;
# Group that will receive faxes originated to extension 12345&lt;br /&gt;
group: grp-12345    {{=}} joe, jill&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Test functionality ====&lt;br /&gt;
When you done your {{pkg|email}} configuration you can test this by running commands like this:&lt;br /&gt;
{{cmd|email -s &amp;quot;testmail&amp;quot; -b jeff}}&lt;br /&gt;
&lt;br /&gt;
= Configure Asterisk =&lt;br /&gt;
There are multiple ways to configure Asterisk. This document only describes a very basic setup which you might want to modify based on your needs. But by following this document, you should have a fully functional fax-server using only {{pkg|asterisk}} and {{pkg|asterisk-fax}}.&lt;br /&gt;
&lt;br /&gt;
=== Install required packages ===&lt;br /&gt;
At this stage your Alpine Linux only holds some basic packages for base functionallity. We will need to install some extra packages in order to get the fax functionallity.&lt;br /&gt;
{{cmd|apk add asterisk asterisk-fax}}&lt;br /&gt;
&lt;br /&gt;
==== General setup ====&lt;br /&gt;
Set some general settings&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/asterisk/asterisk.conf}}&lt;br /&gt;
&lt;br /&gt;
* Copy this content to the file&lt;br /&gt;
{{cat|/etc/asterisk/asterisk.conf|[global]&lt;br /&gt;
astetcdir {{=}}&amp;gt; /etc/asterisk&lt;br /&gt;
astmoddir {{=}}&amp;gt; /usr/lib/asterisk/modules&lt;br /&gt;
astvarlibdir {{=}}&amp;gt; /var/lib/asterisk&lt;br /&gt;
astspooldir {{=}}&amp;gt; /var/spool/asterisk&lt;br /&gt;
astrundir {{=}}&amp;gt; /var/run/asterisk&lt;br /&gt;
astlogdir {{=}}&amp;gt; /var/log/asterisk&lt;br /&gt;
astdbdir {{=}}&amp;gt; /var/lib/asterisk&lt;br /&gt;
astkeydir {{=}}&amp;gt; /var/lib/asterisk&lt;br /&gt;
astdatadir {{=}}&amp;gt; /var/lib/asterisk&lt;br /&gt;
astagidir {{=}}&amp;gt; /var/lib/asterisk/agi-bin&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Load appropreate modules ====&lt;br /&gt;
Asterisk needs some modules to be able to handle fax.&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/asterisk/modules.conf}}&lt;br /&gt;
&lt;br /&gt;
* Copy this content to the file&lt;br /&gt;
{{cat|/etc/asterisk/modules.conf|[modules]&lt;br /&gt;
autoload{{=}}yes&lt;br /&gt;
}}&lt;br /&gt;
{{todo|Try changing this so we don&#039;t load more modules than we need}}&lt;br /&gt;
&lt;br /&gt;
==== Enable SIP ====&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/asterisk/sip.conf}}&lt;br /&gt;
&lt;br /&gt;
* Copy this content to the file&lt;br /&gt;
{{cat|/etc/asterisk/sip.conf|[general]&lt;br /&gt;
context{{=}}fax_incoming            ; Default context for incoming calls&lt;br /&gt;
allowoverlap{{=}}no                 ; Disable overlap dialing support. (Default is yes)&lt;br /&gt;
bindport{{=}}5060                   ; UDP Port to bind to (SIP standard port is 5060)&lt;br /&gt;
				; bindport is the local UDP port that Asterisk will listen on&lt;br /&gt;
bindaddr{{=}}0.0.0.0                ; IP address to bind to (0.0.0.0 binds to all)&lt;br /&gt;
srvlookup{{=}}no                    ; Enable DNS SRV lookups on outbound calls&lt;br /&gt;
disallow{{=}}all                    ; First disallow all codecs&lt;br /&gt;
allow{{=}}ulaw			; Allow codecs (in order of preference)&lt;br /&gt;
allow{{=}}alaw			; Allow codecs (in order of preference)&lt;br /&gt;
udpbindaddr{{=}}0.0.0.0&lt;br /&gt;
canreinvite{{=}}yes&lt;br /&gt;
t38pt_udptl{{=}}yes,redundancy,maxdatagram{{=}}400&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Enable udptl ====&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/asterisk/udptl.conf}}&lt;br /&gt;
&lt;br /&gt;
* Copy this content to the file&lt;br /&gt;
{{cat|/etc/asterisk/udptl.conf|[general]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Configure fax ====&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/asterisk/res_fax.conf}}&lt;br /&gt;
* Copy this content to the file&lt;br /&gt;
{{cat|/etc/asterisk/res_fax.conf|[general]&lt;br /&gt;
maxrate{{=}}9600&lt;br /&gt;
minrate{{=}}2400&lt;br /&gt;
statusevents{{=}}yes&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Configure dialplan ====&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/asterisk/extensions.lua}}&lt;br /&gt;
&lt;br /&gt;
* Copy this content to the file&lt;br /&gt;
{{cat|/etc/asterisk/extensions.lua|TODO...&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Permissions ====&lt;br /&gt;
For {{pkg|asterisk}} to be able to read the new config files, we need to set the correct permissions to the files&lt;br /&gt;
{{cmd|chown -R asterisk:asterisk /etc/asterisk}}&lt;br /&gt;
&lt;br /&gt;
==== Start things up ====&lt;br /&gt;
Now its time to start up the services&lt;br /&gt;
{{cmd|/etc/init.d/asterisk start}}&lt;br /&gt;
Configure {{pkg|asterisk}} to autostart at next reboot&lt;br /&gt;
{{cmd|rc-update add asterisk}}&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=FaxServer_using_Asterisk&amp;diff=9146</id>
		<title>FaxServer using Asterisk</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=FaxServer_using_Asterisk&amp;diff=9146"/>
		<updated>2013-07-02T16:11:13Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: /* Configure dialplan */ Using variable for setting path to various files. Adding some debug output&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|This is a experimental page to see if this could replace a more complex setup using Asterisk+IAXmodem+hylafax}}&lt;br /&gt;
This document aims to create a as simple as possible to setup fax server to send and receive faxes using {{pkg|asterisk}} and {{pkg|asterisk-fax}}.&lt;br /&gt;
__NOTOC__&lt;br /&gt;
= Installation =&lt;br /&gt;
This wiki-doc is based on [http://www.alpinelinux.org/downloads Alpine Linux 2.6] &#039;&#039;(but might also work on version 2.1.3 or higher)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Start by [[Installation|setting up]] a Alpine Linux base system &#039;&#039;(you will most likely want to run &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; to setup the most basic settings)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Firewall ===&lt;br /&gt;
You might want to setup a firewall to protect your system. We will not address this task in this document. Some firewall alternatives in Alpine Linux are&lt;br /&gt;
* [[How-To_Alpine_Wall|AWall]]&lt;br /&gt;
* Shorewall&lt;br /&gt;
* iptables&lt;br /&gt;
&lt;br /&gt;
= Configure email =&lt;br /&gt;
=== Install required packages ===&lt;br /&gt;
We will use the package {{pkg|email}} to send the faxes by email to various recipients. Lets start by installing the package&lt;br /&gt;
{{cmd|apk add email}}&lt;br /&gt;
&lt;br /&gt;
==== General configuration ====&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/email/email.conf}}&lt;br /&gt;
{{tip|Work with your SMTP provider to set the appropriate settings. Most likely you will want to&lt;br /&gt;
* Change the variables &amp;lt;code&amp;gt;SMTP_SERVER&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;SMTP_PORT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MY_NAME&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MY_EMAIL&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ADDRESS_BOOK&amp;lt;/code&amp;gt;&lt;br /&gt;
* Comment out the variable &amp;lt;code&amp;gt;SIGNATURE_FILE&amp;lt;/code&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Address book ====&lt;br /&gt;
* Edit the appropriate file &#039;&#039;(In this example we assume you did not change the value of &amp;lt;code&amp;gt;ADDRESS_BOOK&amp;lt;/code&amp;gt; variable).&lt;br /&gt;
{{cmd|vi /etc/email/email.address.template}}&lt;br /&gt;
* Define some email addresses that suits your needs.&amp;lt;BR&amp;gt;The upcoming {{pkg|asterisk}} config assumes that you have some predefined records in this address book. Example:&lt;br /&gt;
{{cat|/etc/email/email.address.template|# Individual email addresses&lt;br /&gt;
single:joe          {{=}} joe@foo.bar&lt;br /&gt;
single:jeff         {{=}} jeff@foo.bar&lt;br /&gt;
single:jill         {{=}} jill@foo.bar&lt;br /&gt;
&lt;br /&gt;
# Group that will receive error reports&lt;br /&gt;
group: grp-support  {{=}} joe, jeff&lt;br /&gt;
&lt;br /&gt;
# Group that will receive faxes originated to extension 12345&lt;br /&gt;
group: grp-12345    {{=}} joe, jill&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Test functionality ====&lt;br /&gt;
When you done your {{pkg|email}} configuration you can test this by running commands like this:&lt;br /&gt;
{{cmd|email -s &amp;quot;testmail&amp;quot; -b jeff}}&lt;br /&gt;
&lt;br /&gt;
= Configure Asterisk =&lt;br /&gt;
There are multiple ways to configure Asterisk. This document only describes a very basic setup which you might want to modify based on your needs. But by following this document, you should have a fully functional fax-server using only {{pkg|asterisk}} and {{pkg|asterisk-fax}}.&lt;br /&gt;
&lt;br /&gt;
=== Install required packages ===&lt;br /&gt;
At this stage your Alpine Linux only holds some basic packages for base functionallity. We will need to install some extra packages in order to get the fax functionallity.&lt;br /&gt;
{{cmd|apk add asterisk asterisk-fax}}&lt;br /&gt;
&lt;br /&gt;
==== General setup ====&lt;br /&gt;
Set some general settings&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/asterisk/asterisk.conf}}&lt;br /&gt;
&lt;br /&gt;
* Copy this content to the file&lt;br /&gt;
{{cat|/etc/asterisk/asterisk.conf|[global]&lt;br /&gt;
astetcdir {{=}}&amp;gt; /etc/asterisk&lt;br /&gt;
astmoddir {{=}}&amp;gt; /usr/lib/asterisk/modules&lt;br /&gt;
astvarlibdir {{=}}&amp;gt; /var/lib/asterisk&lt;br /&gt;
astspooldir {{=}}&amp;gt; /var/spool/asterisk&lt;br /&gt;
astrundir {{=}}&amp;gt; /var/run/asterisk&lt;br /&gt;
astlogdir {{=}}&amp;gt; /var/log/asterisk&lt;br /&gt;
astdbdir {{=}}&amp;gt; /var/lib/asterisk&lt;br /&gt;
astkeydir {{=}}&amp;gt; /var/lib/asterisk&lt;br /&gt;
astdatadir {{=}}&amp;gt; /var/lib/asterisk&lt;br /&gt;
astagidir {{=}}&amp;gt; /var/lib/asterisk/agi-bin&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Load appropreate modules ====&lt;br /&gt;
Asterisk needs some modules to be able to handle fax.&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/asterisk/modules.conf}}&lt;br /&gt;
&lt;br /&gt;
* Copy this content to the file&lt;br /&gt;
{{cat|/etc/asterisk/modules.conf|[modules]&lt;br /&gt;
autoload{{=}}yes&lt;br /&gt;
}}&lt;br /&gt;
{{todo|Try changing this so we don&#039;t load more modules than we need}}&lt;br /&gt;
&lt;br /&gt;
==== Enable SIP ====&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/asterisk/sip.conf}}&lt;br /&gt;
&lt;br /&gt;
* Copy this content to the file&lt;br /&gt;
{{cat|/etc/asterisk/sip.conf|[general]&lt;br /&gt;
context{{=}}fax_incoming            ; Default context for incoming calls&lt;br /&gt;
allowoverlap{{=}}no                 ; Disable overlap dialing support. (Default is yes)&lt;br /&gt;
bindport{{=}}5060                   ; UDP Port to bind to (SIP standard port is 5060)&lt;br /&gt;
				; bindport is the local UDP port that Asterisk will listen on&lt;br /&gt;
bindaddr{{=}}0.0.0.0                ; IP address to bind to (0.0.0.0 binds to all)&lt;br /&gt;
srvlookup{{=}}yes                   ; Enable DNS SRV lookups on outbound calls&lt;br /&gt;
disallow{{=}}all                    ; First disallow all codecs&lt;br /&gt;
allow{{=}}ulaw			; Allow codecs (in order of preference)&lt;br /&gt;
allow{{=}}alaw			; Allow codecs (in order of preference)&lt;br /&gt;
udpbindaddr{{=}}0.0.0.0&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Configure dialplan ====&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/asterisk/extensions.ael}}&lt;br /&gt;
&lt;br /&gt;
* Copy this content to the file&lt;br /&gt;
{{cat|/etc/asterisk/extensions.ael|context fax_incoming {&lt;br /&gt;
  _X. {{=}}&amp;gt; {&lt;br /&gt;
    Set(FAXDATE{{=}}${STRFTIME(,,%Y%m%d%H%M%S)});&lt;br /&gt;
    Set(FAXPATH{{=}}/etc/asterisk/spool);&lt;br /&gt;
    Set(FAXFILE{{=}}${FAXPATH}/fax_incoming_${EXTEN}_${FAXDATE}.tif);&lt;br /&gt;
    Answer();&lt;br /&gt;
    System(/bin/mkdir -p ${FAXPATH});&lt;br /&gt;
    Wait(1);&lt;br /&gt;
    ReceiveFax(${FAXFILE},f);&lt;br /&gt;
    Verbose(3,- Fax receipt completed with status: ${FAXSTATUS});&lt;br /&gt;
    if (&amp;quot;${FAXSTATUS}&amp;quot; {{=}} &amp;quot;FAILED&amp;quot;) {&lt;br /&gt;
      Set(DEBUGINFO{{=}}FAXSTATUS: ${FAXSTATUS}\nFAXERROR: ${FAXERROR}\nLOCALSTATIONID: ${LOCALSTATIONID}\nLOCALHEADERINFO: ${LOCALHEADERINFO}\nREMOTESTATIONID: ${REMOTESTATIONID}\nFAXPAGES: ${FAXPAGES}\nFAXBITRATE: ${FAXBITRATE}\nFAXRESOLUTION: ${FAXRESOLUTION});&lt;br /&gt;
      Verbose(3,- Trying to send a email reporting the failure});&lt;br /&gt;
      System(/bin/echo &amp;quot;${DEBUGINFO}&amp;quot; {{!}} /usr/bin/email -s &amp;quot;Incoming fax for ${EXTEN} failed&amp;quot; grp-support);&lt;br /&gt;
      System(/bin/mkdir -p ${FAXPATH}/fax-failed);&lt;br /&gt;
      System(/bin/mv ${FAXFILE} ${FAXPATH}/fax-failed/);&lt;br /&gt;
      System(/bin/echo &#039;${FAXDATE} - Failed receiving fax originated for ${EXTEN}\n${DEBUGINFO}\n\n&#039; &amp;gt;&amp;gt; ${FAXPATH}/error.log);&lt;br /&gt;
    } else {&lt;br /&gt;
      Verbose(3,- Trying to send a email containing the fax);&lt;br /&gt;
      System(/usr/bin/email -s &amp;quot;Incoming fax for ${EXTEN} failed&amp;quot; -b -a ${FAXFILE} grp-${EXTEN});&lt;br /&gt;
      System(/bin/mkdir -p ${FAXPATH}/fax-processed);&lt;br /&gt;
      System(/bin/mv ${FAXFILE} ${FAXPATH}/fax-processed/);&lt;br /&gt;
      System(/bin/echo &#039;${FAXDATE} - Successfuly received fax originated for ${EXTEN} (${FAXFILE})&#039; &amp;gt;&amp;gt; ${FAXPATH}/success.log);&lt;br /&gt;
    };&lt;br /&gt;
  };&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Permissions ====&lt;br /&gt;
For {{pkg|asterisk}} to be able to read the new config files, we need to set the correct permissions to the files&lt;br /&gt;
{{cmd|chown -R asterisk:asterisk /etc/asterisk}}&lt;br /&gt;
&lt;br /&gt;
==== Start things up ====&lt;br /&gt;
Now its time to start up the services&lt;br /&gt;
{{cmd|/etc/init.d/asterisk start}}&lt;br /&gt;
Configure {{pkg|asterisk}} to autostart at next reboot&lt;br /&gt;
{{cmd|rc-update add asterisk}}&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=FaxServer_using_Asterisk&amp;diff=9145</id>
		<title>FaxServer using Asterisk</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=FaxServer_using_Asterisk&amp;diff=9145"/>
		<updated>2013-07-02T15:00:31Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: More draft notes about asterisk as faxserver&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|This is a experimental page to see if this could replace a more complex setup using Asterisk+IAXmodem+hylafax}}&lt;br /&gt;
This document aims to create a as simple as possible to setup fax server to send and receive faxes using {{pkg|asterisk}} and {{pkg|asterisk-fax}}.&lt;br /&gt;
__NOTOC__&lt;br /&gt;
= Installation =&lt;br /&gt;
This wiki-doc is based on [http://www.alpinelinux.org/downloads Alpine Linux 2.6] &#039;&#039;(but might also work on version 2.1.3 or higher)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Start by [[Installation|setting up]] a Alpine Linux base system &#039;&#039;(you will most likely want to run &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; to setup the most basic settings)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Firewall ===&lt;br /&gt;
You might want to setup a firewall to protect your system. We will not address this task in this document. Some firewall alternatives in Alpine Linux are&lt;br /&gt;
* [[How-To_Alpine_Wall|AWall]]&lt;br /&gt;
* Shorewall&lt;br /&gt;
* iptables&lt;br /&gt;
&lt;br /&gt;
= Configure email =&lt;br /&gt;
=== Install required packages ===&lt;br /&gt;
We will use the package {{pkg|email}} to send the faxes by email to various recipients. Lets start by installing the package&lt;br /&gt;
{{cmd|apk add email}}&lt;br /&gt;
&lt;br /&gt;
==== General configuration ====&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/email/email.conf}}&lt;br /&gt;
{{tip|Work with your SMTP provider to set the appropriate settings. Most likely you will want to&lt;br /&gt;
* Change the variables &amp;lt;code&amp;gt;SMTP_SERVER&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;SMTP_PORT&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MY_NAME&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;MY_EMAIL&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ADDRESS_BOOK&amp;lt;/code&amp;gt;&lt;br /&gt;
* Comment out the variable &amp;lt;code&amp;gt;SIGNATURE_FILE&amp;lt;/code&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Address book ====&lt;br /&gt;
* Edit the appropriate file &#039;&#039;(In this example we assume you did not change the value of &amp;lt;code&amp;gt;ADDRESS_BOOK&amp;lt;/code&amp;gt; variable).&lt;br /&gt;
{{cmd|vi /etc/email/email.address.template}}&lt;br /&gt;
* Define some email addresses that suits your needs.&amp;lt;BR&amp;gt;The upcoming {{pkg|asterisk}} config assumes that you have some predefined records in this address book. Example:&lt;br /&gt;
{{cat|/etc/email/email.address.template|# Individual email addresses&lt;br /&gt;
single:joe          {{=}} joe@foo.bar&lt;br /&gt;
single:jeff         {{=}} jeff@foo.bar&lt;br /&gt;
single:jill         {{=}} jill@foo.bar&lt;br /&gt;
&lt;br /&gt;
# Group that will receive error reports&lt;br /&gt;
group: grp-support  {{=}} joe, jeff&lt;br /&gt;
&lt;br /&gt;
# Group that will receive faxes originated to extension 12345&lt;br /&gt;
group: grp-12345    {{=}} joe, jill&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Test functionality ====&lt;br /&gt;
When you done your {{pkg|email}} configuration you can test this by running commands like this:&lt;br /&gt;
{{cmd|email -s &amp;quot;testmail&amp;quot; -b jeff}}&lt;br /&gt;
&lt;br /&gt;
= Configure Asterisk =&lt;br /&gt;
There are multiple ways to configure Asterisk. This document only describes a very basic setup which you might want to modify based on your needs. But by following this document, you should have a fully functional fax-server using only {{pkg|asterisk}} and {{pkg|asterisk-fax}}.&lt;br /&gt;
&lt;br /&gt;
=== Install required packages ===&lt;br /&gt;
At this stage your Alpine Linux only holds some basic packages for base functionallity. We will need to install some extra packages in order to get the fax functionallity.&lt;br /&gt;
{{cmd|apk add asterisk asterisk-fax}}&lt;br /&gt;
&lt;br /&gt;
==== General setup ====&lt;br /&gt;
Set some general settings&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/asterisk/asterisk.conf}}&lt;br /&gt;
&lt;br /&gt;
* Copy this content to the file&lt;br /&gt;
{{cat|/etc/asterisk/asterisk.conf|[global]&lt;br /&gt;
astetcdir {{=}}&amp;gt; /etc/asterisk&lt;br /&gt;
astmoddir {{=}}&amp;gt; /usr/lib/asterisk/modules&lt;br /&gt;
astvarlibdir {{=}}&amp;gt; /var/lib/asterisk&lt;br /&gt;
astspooldir {{=}}&amp;gt; /var/spool/asterisk&lt;br /&gt;
astrundir {{=}}&amp;gt; /var/run/asterisk&lt;br /&gt;
astlogdir {{=}}&amp;gt; /var/log/asterisk&lt;br /&gt;
astdbdir {{=}}&amp;gt; /var/lib/asterisk&lt;br /&gt;
astkeydir {{=}}&amp;gt; /var/lib/asterisk&lt;br /&gt;
astdatadir {{=}}&amp;gt; /var/lib/asterisk&lt;br /&gt;
astagidir {{=}}&amp;gt; /var/lib/asterisk/agi-bin&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Load appropreate modules ====&lt;br /&gt;
Asterisk needs some modules to be able to handle fax.&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/asterisk/modules.conf}}&lt;br /&gt;
&lt;br /&gt;
* Copy this content to the file&lt;br /&gt;
{{cat|/etc/asterisk/modules.conf|[modules]&lt;br /&gt;
autoload{{=}}yes&lt;br /&gt;
}}&lt;br /&gt;
{{todo|Try changing this so we don&#039;t load more modules than we need}}&lt;br /&gt;
&lt;br /&gt;
==== Enable SIP ====&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/asterisk/sip.conf}}&lt;br /&gt;
&lt;br /&gt;
* Copy this content to the file&lt;br /&gt;
{{cat|/etc/asterisk/sip.conf|[general]&lt;br /&gt;
context{{=}}fax_incoming            ; Default context for incoming calls&lt;br /&gt;
allowoverlap{{=}}no                 ; Disable overlap dialing support. (Default is yes)&lt;br /&gt;
bindport{{=}}5060                   ; UDP Port to bind to (SIP standard port is 5060)&lt;br /&gt;
				; bindport is the local UDP port that Asterisk will listen on&lt;br /&gt;
bindaddr{{=}}0.0.0.0                ; IP address to bind to (0.0.0.0 binds to all)&lt;br /&gt;
srvlookup{{=}}yes                   ; Enable DNS SRV lookups on outbound calls&lt;br /&gt;
disallow{{=}}all                    ; First disallow all codecs&lt;br /&gt;
allow{{=}}ulaw			; Allow codecs (in order of preference)&lt;br /&gt;
allow{{=}}alaw			; Allow codecs (in order of preference)&lt;br /&gt;
udpbindaddr{{=}}0.0.0.0&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Configure dialplan ====&lt;br /&gt;
* Edit the appropriate file&lt;br /&gt;
{{cmd|vi /etc/asterisk/extensions.ael}}&lt;br /&gt;
&lt;br /&gt;
* Copy this content to the file&lt;br /&gt;
{{cat|/etc/asterisk/extensions.ael|context fax_incoming {&lt;br /&gt;
  _X. {{=}}&amp;gt; {&lt;br /&gt;
    Set(FAXDATE{{=}}${STRFTIME(,,%Y%m%d%H%M%S)});&lt;br /&gt;
    Set(FAXFILE{{=}}/tmp/fax_${EXTEN}_${FAXDATE}.tif);&lt;br /&gt;
    Answer();&lt;br /&gt;
    Wait(1);&lt;br /&gt;
    ReceiveFax(${FAXFILE},f);&lt;br /&gt;
    Verbose(3,- Fax receipt completed with status: ${FAXSTATUS});&lt;br /&gt;
    if (&amp;quot;${FAXSTATUS}&amp;quot; {{=}} &amp;quot;FAILED&amp;quot;) {&lt;br /&gt;
      Set(DEBUGINFO\nFAXSTATUS: ${FAXSTATUS}\nFAXERROR: ${FAXERROR}\nLOCALSTATIONID: ${LOCALSTATIONID}\nLOCALHEADERINFO: ${LOCALHEADERINFO}\nREMOTESTATIONID: ${REMOTESTATIONID}\nFAXPAGES: ${FAXPAGES}\nFAXBITRATE: ${FAXBITRATE}\nFAXRESOLUTION: ${FAXRESOLUTION});&lt;br /&gt;
      Verbose(3,- Trying to send a email reporting the failure});&lt;br /&gt;
      System(echo &amp;quot;${DEBUGINFO}&amp;quot; {{!}} /usr/bin/email -s &amp;quot;Incoming fax for ${EXTEN} failed&amp;quot; grp-support);&lt;br /&gt;
      System(/usr/bin/mkdir -p /tmp/fax-failed);&lt;br /&gt;
      System(/usr/bin/mv ${FAXFILE} /tmp/fax-failed/);&lt;br /&gt;
    } else {&lt;br /&gt;
      Verbose(3,- Trying to send a email containing the fax});&lt;br /&gt;
      System(/usr/bin/email -s &amp;quot;Incoming fax for ${EXTEN} failed&amp;quot; -b -a ${FAXFILE} grp-${EXTEN});&lt;br /&gt;
      System(/usr/bin/mkdir -p /tmp/fax-processed);&lt;br /&gt;
      System(/usr/bin/mv ${FAXFILE} /tmp/fax-processed/);&lt;br /&gt;
    };&lt;br /&gt;
  };&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==== Permissions ====&lt;br /&gt;
For {{pkg|asterisk}} to be able to read the new config files, we need to set the correct permissions to the files&lt;br /&gt;
{{cmd|chown -R asterisk:asterisk /etc/asterisk}}&lt;br /&gt;
&lt;br /&gt;
==== Start things up ====&lt;br /&gt;
Now its time to start up the services&lt;br /&gt;
{{cmd|/etc/init.d/asterisk start}}&lt;br /&gt;
Configure {{pkg|asterisk}} to autostart at next reboot&lt;br /&gt;
{{cmd|rc-update add asterisk}}&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=FaxServer_using_Asterisk&amp;diff=9144</id>
		<title>FaxServer using Asterisk</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=FaxServer_using_Asterisk&amp;diff=9144"/>
		<updated>2013-07-02T06:57:06Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Draft notes about fax server&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|This is a experimental page to see if this could replace a more complex setup using Asterisk+IAXmodem+hylafax}}&lt;br /&gt;
This document aims to create a as simple as possible to setup fax server to send and receive faxes using {{pkg|asterisk}} and {{pkg|asterisk-fax}}.&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
This wiki-doc is based on [http://www.alpinelinux.org/downloads Alpine Linux 2.6] &#039;&#039;(but might also work on version 2.1.3 or higher)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Start by [[Installation|setting up]] a Alpine Linux base system &#039;&#039;(you will most likely want to run &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; to setup the most basic settings)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Firewall ===&lt;br /&gt;
You might want to setup a firewall to protect your system. We will not address this task in this document. Some firewall alternatives in Alpine Linux are&lt;br /&gt;
* [[How-To_Alpine_Wall|AWall]]&lt;br /&gt;
* Shorewall&lt;br /&gt;
* iptables&lt;br /&gt;
&lt;br /&gt;
= Configuring Asterisk =&lt;br /&gt;
There are multiple ways to configure Asterisk. This document only describes a very basic setup which you might want to modify based on your needs. But by following this document, you should have a fully functional fax-server using only {{pkg|asterisk}} and {{pkg|asterisk-fax}}.&lt;br /&gt;
&lt;br /&gt;
=== Install required packages ===&lt;br /&gt;
At this stage your Alpine Linux only holds some basic packages for base functionallity. We will need to install some extra packages in order to get the fax functionallity.&lt;br /&gt;
{{cmd|apk add asterisk asterisk-fax}}&lt;br /&gt;
During this wiki doc, we will use ({{pkg|vim}} as the tool to create and edit files, so we need to install it (we will remove the &lt;br /&gt;
&lt;br /&gt;
==== Load appropreate modules ====&lt;br /&gt;
Asterisk needs some modules to be able to handle fax.&lt;br /&gt;
* Edit {{path|/etc/asterisk/modules.conf}} {{cmd|vi /etc/asterisk/modules.conf}}&lt;br /&gt;
* Copy this content to the file&lt;br /&gt;
{{cat|/etc/asterisk/modules.conf|modules&lt;br /&gt;
autoload=yes&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Alpine_Linux:Releases&amp;diff=9137</id>
		<title>Alpine Linux:Releases</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Alpine_Linux:Releases&amp;diff=9137"/>
		<updated>2013-06-10T15:06:15Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Added 2.4.11 release to the list&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are several releases of Alpine Linux available at the same time. There is not fix release cycle but rather every 6 month we make a snapshot of &#039;&#039;&#039;[[Edge|edge]]&#039;&#039;&#039; and make a release. We support each stable release for a certain time, normally for 2 years. We can do security fixes beyond that on request and when patches are available.&lt;br /&gt;
 &lt;br /&gt;
The latest release of Alpine Linux is: &#039;&#039;&#039;2.6.1&#039;&#039;&#039; [http://alpinelinux.org/release-2.6.1 Release notes], [http://git.alpinelinux.org/cgit/aports/log/?h=v2.6.1 git log]&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;5&amp;quot; border=&amp;quot;1&amp;quot; class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Branch&lt;br /&gt;
! Branch Date&lt;br /&gt;
! Latest Release&lt;br /&gt;
! Previous minor releases&lt;br /&gt;
! Directory name&lt;br /&gt;
! Updates&lt;br /&gt;
! End of Support&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;[[edge]]&#039;&#039;&#039;&lt;br /&gt;
| current&lt;br /&gt;
| rolling&lt;br /&gt;
| -&lt;br /&gt;
| [http://nl.alpinelinux.org/alpine/edge/ edge]&lt;br /&gt;
| development&lt;br /&gt;
| n/a&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v2.6&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=2.6-stable 2013-05-17]&lt;br /&gt;
| [http://alpinelinux.org/release-2.6.1 2.6.1]&lt;br /&gt;
| [http://alpinelinux.org/release-2.6.0 2.6.0]&lt;br /&gt;
| [http://nl.alpinelinux.org/alpine/v2.6/ v2.6]&lt;br /&gt;
| bugfixes&lt;br /&gt;
| 2015-05-01&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v2.5&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=2.5-stable 2012-11-07]&lt;br /&gt;
| [http://alpinelinux.org/release-2.5.4 2.5.4]&lt;br /&gt;
| [http://alpinelinux.org/release-2.5.0 2.5.0], [http://alpinelinux.org/release-2.5.1 2.5.1], [http://alpinelinux.org/release-2.5.2 2.5.2], [http://alpinelinux.org/release-2.5.3 2.5.3]&lt;br /&gt;
| [http://nl.alpinelinux.org/alpine/v2.5/ v2.5]&lt;br /&gt;
| security only&lt;br /&gt;
| 2014-11-01&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v2.4&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=2.4-stable 2012-05-02]&lt;br /&gt;
| [http://alpinelinux.org/release-2.4.11 2.4.11]&lt;br /&gt;
| [http://alpinelinux.org/node/13811 2.4.0], [http://alpinelinux.org/node/13812 2.4.1], [http://alpinelinux.org/node/13845 2.4.2], [http://alpinelinux.org/node/13906 2.4.3], [http://alpinelinux.org/release-2.4.4 2.4.4], [http://alpinelinux.org/release-2.4.5 2.4.5], [http://alpinelinux.org/release-2.4.6 2.4.6], [http://alpinelinux.org/release-2.4.7 2.4.7], 2.4.8, [http://alpinelinux.org/node/14664 2.4.9], [http://alpinelinux.org/release-2.4.10 2.4.10]&lt;br /&gt;
| [http://nl.alpinelinux.org/alpine/v2.4/ v2.4]&lt;br /&gt;
| security only&lt;br /&gt;
| 2014-05-01&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v2.3&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=2.3-stable 2011-11-01]&lt;br /&gt;
| [http://alpinelinux.org/node/13503 2.3.6]&lt;br /&gt;
| [http://alpinelinux.org/node/6841 2.3.0], [http://alpinelinux.org/node/6866 2.3.1], [http://alpinelinux.org/node/6911 2.3.2], [http://alpinelinux.org/node/6999 2.3.3], [http://alpinelinux.org/node/13466 2.3.4 &amp;amp; 2.3.5]&lt;br /&gt;
| [http://nl.alpinelinux.org/alpine/v2.3/ v2.3]&lt;br /&gt;
| security only&lt;br /&gt;
| 2013-11-01&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v2.2&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=2.2-stable 2011-05-03]&lt;br /&gt;
| [http://alpinelinux.org/node/6455 2.2.3]&lt;br /&gt;
| [http://alpinelinux.org/node/5237 2.2.0], [http://lists.alpinelinux.org/alpine-devel/1618.html 2.2.1], [http://alpinelinux.org/node/5955 2.2.2]&lt;br /&gt;
| [http://nl.alpinelinux.org/alpine/v2.2/ v2.2]&lt;br /&gt;
| on request only&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;2013-05-01&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v2.1&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=2.1-stable 2010-11-01]&lt;br /&gt;
| [http://alpinelinux.org/node/5236 2.1.6]&lt;br /&gt;
| [[Release_Notes_for_Alpine_2.1.0|2.1.0]], [[Release_Notes_for_Alpine_2.1.1|2.1.1]], [[Release_Notes_for_Alpine_2.1.2|2.1.2]], [[Release_Notes_for_Alpine_2.1.3|2.1.3]], [http://alpinelinux.org/node/5230 2.1.4], [http://alpinelinux.org/node/5235 2.1.5]&lt;br /&gt;
| [http://nl.alpinelinux.org/alpine/v2.1/ v2.1]&lt;br /&gt;
| on request only&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;2012-11-01&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;v2.0&#039;&#039;&#039;&lt;br /&gt;
| [http://git.alpinelinux.org/cgit/aports/log/?h=2.0-stable 2010-08-16]&lt;br /&gt;
| [http://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_2.0.3 2.0.3]&lt;br /&gt;
| [[Release_Notes_for_Alpine_2.0.0|2.0.0]], [[Release_Notes_for_Alpine_2.0.1|2.0.1]], [[Release_Notes_for_Alpine_2.0.2|2.0.2]]&lt;br /&gt;
| [http://nl.alpinelinux.org/alpine/v2.0/ v2.0]&lt;br /&gt;
| on request only&lt;br /&gt;
| &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;2012-04-01&amp;lt;/span&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
An archive for [[older releases]] is also available.&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Setting_up_monitoring_using_rrdtool_(and_rrdcollect)&amp;diff=8813</id>
		<title>Setting up monitoring using rrdtool (and rrdcollect)</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Setting_up_monitoring_using_rrdtool_(and_rrdcollect)&amp;diff=8813"/>
		<updated>2012-11-21T18:21:04Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: This doc is confirmed to work (removing Draft notes)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Install programs ==&lt;br /&gt;
{{Cmd|apk add rrdtool rrdcollect}}&lt;br /&gt;
&lt;br /&gt;
== Create rrd-databases ==&lt;br /&gt;
As we will use rrdcollect to collect our data for us, we will create all databases that the default config for rrdcollect tries to use.&lt;br /&gt;
=== stat.rrd ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rrdtool create /var/lib/rrdtool/stat.rrd \&lt;br /&gt;
--step 60 \&lt;br /&gt;
DS:cpu_user:COUNTER:120:0:U \&lt;br /&gt;
DS:cpu_nice:COUNTER:120:0:U \&lt;br /&gt;
DS:cpu_system:COUNTER:120:0:U \&lt;br /&gt;
DS:cpu_idle:COUNTER:120:0:U \&lt;br /&gt;
DS:cpu_iowait:COUNTER:120:0:U \&lt;br /&gt;
DS:cpu_irq:COUNTER:120:0:U \&lt;br /&gt;
DS:cpu_softirq:COUNTER:120:0:U \&lt;br /&gt;
DS:ctxt:COUNTER:120:0:U \&lt;br /&gt;
DS:page_in:COUNTER:120:0:U \&lt;br /&gt;
DS:page_out:COUNTER:120:0:U \&lt;br /&gt;
DS:processes:COUNTER:120:0:U \&lt;br /&gt;
DS:swap_in:COUNTER:120:0:U \&lt;br /&gt;
DS:swap_out:COUNTER:120:0:U \&lt;br /&gt;
RRA:AVERAGE:0.5:1:360 \&lt;br /&gt;
RRA:AVERAGE:0.5:10:1008 \&lt;br /&gt;
RRA:MAX:0.5:10:1008&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== memory.rrd ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rrdtool create /var/lib/rrdtool/memory.rrd \&lt;br /&gt;
--step 60 \&lt;br /&gt;
DS:mem_total:GAUGE:120:0:U \&lt;br /&gt;
DS:mem_used:GAUGE:120:0:U \&lt;br /&gt;
DS:mem_free:GAUGE:120:0:U \&lt;br /&gt;
DS:mem_shared:GAUGE:120:0:U \&lt;br /&gt;
DS:mem_buffers:GAUGE:120:0:U \&lt;br /&gt;
DS:swap_total:GAUGE:120:0:U \&lt;br /&gt;
DS:swap_used:GAUGE:120:0:U \&lt;br /&gt;
DS:swap_free:GAUGE:120:0:U \&lt;br /&gt;
RRA:AVERAGE:0.5:1:360 \&lt;br /&gt;
RRA:AVERAGE:0.5:10:1008 \&lt;br /&gt;
RRA:MAX:0.5:10:1008&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== eth0.rrd ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rrdtool create /var/lib/rrdtool/eth0.rrd \&lt;br /&gt;
--step 60 \&lt;br /&gt;
DS:bytes_in:COUNTER:120:0:U \&lt;br /&gt;
DS:pkts_in:COUNTER:120:0:U \&lt;br /&gt;
DS:bytes_out:COUNTER:120:0:U \&lt;br /&gt;
DS:pkts_out:COUNTER:120:0:U \&lt;br /&gt;
RRA:AVERAGE:0.5:1:360 \&lt;br /&gt;
RRA:AVERAGE:0.5:10:1008 \&lt;br /&gt;
RRA:MAX:0.5:10:1008&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{note|If you chose to change the &amp;quot;--step 60&amp;quot; &#039;&#039;(which specifies the base interval in seconds with which data will be fed into the RRD)&#039;&#039; then make sure to change the &#039;step&#039; value in /etc/rrdcollect/rrdcollect.conf to reflect your changes above.}}&lt;br /&gt;
{{tip|In the above examples the first RRA in each .rrd is more precise (1min interval), but it holds data for shorter time. (1x360x60) equals 21600s/6h)&amp;lt;BR&amp;gt;&lt;br /&gt;
The second RRA evaluates 10 min interval and holds data for longer period. (10x1008x60 equals 604800s/168h/7d)}}&lt;br /&gt;
&lt;br /&gt;
== Gather information and put it in the RRD ==&lt;br /&gt;
{{cmd|rc-service rrdcollect start}}&lt;br /&gt;
&lt;br /&gt;
== Create graphs based on the rrd&#039;s ==&lt;br /&gt;
In the below examples you will notice that the .png file is exported to &amp;quot;/var/www/localhost/htdocs/&amp;quot;.&amp;lt;BR&amp;gt;&lt;br /&gt;
You would need to either create /var/www/localhost/htdocs/ or change the path for the images.&lt;br /&gt;
=== Stat ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rrdtool graph /var/www/localhost/htdocs/stat.png --start -1800  \&lt;br /&gt;
-a PNG -t &amp;quot;Stat&amp;quot; --vertical-label &amp;quot;bits/s&amp;quot; \&lt;br /&gt;
-w 1260 -h 400 -r \&lt;br /&gt;
DEF:cpu_user=/var/lib/rrdtool/stat.rrd:cpu_user:AVERAGE \&lt;br /&gt;
DEF:cpu_nice=/var/lib/rrdtool/stat.rrd:cpu_nice:AVERAGE \&lt;br /&gt;
DEF:cpu_system=/var/lib/rrdtool/stat.rrd:cpu_system:AVERAGE \&lt;br /&gt;
DEF:cpu_idle=/var/lib/rrdtool/stat.rrd:cpu_idle:AVERAGE \&lt;br /&gt;
DEF:cpu_iowait=/var/lib/rrdtool/stat.rrd:cpu_iowait:AVERAGE \&lt;br /&gt;
DEF:cpu_irq=/var/lib/rrdtool/stat.rrd:cpu_irq:AVERAGE \&lt;br /&gt;
DEF:cpu_softirq=/var/lib/rrdtool/stat.rrd:cpu_softirq:AVERAGE \&lt;br /&gt;
DEF:ctxt=/var/lib/rrdtool/stat.rrd:ctxt:AVERAGE \&lt;br /&gt;
DEF:page_in=/var/lib/rrdtool/stat.rrd:page_in:AVERAGE \&lt;br /&gt;
DEF:page_out=/var/lib/rrdtool/stat.rrd:page_out:AVERAGE \&lt;br /&gt;
DEF:processes=/var/lib/rrdtool/stat.rrd:processes:AVERAGE \&lt;br /&gt;
DEF:swap_in=/var/lib/rrdtool/stat.rrd:swap_in:AVERAGE \&lt;br /&gt;
DEF:swap_out=/var/lib/rrdtool/stat.rrd:swap_out:AVERAGE \&lt;br /&gt;
AREA:cpu_user#D7CC00:cpu_user \&lt;br /&gt;
AREA:cpu_nice#D7CC00:cpu_nice \&lt;br /&gt;
LINE2:cpu_system#D73600:cpu_system \&lt;br /&gt;
LINE2:cpu_idle#D73600:cpu_idle \&lt;br /&gt;
LINE2:ctxt#0101D6:ctxt \&lt;br /&gt;
LINE2:page_in#0101D6:page_in \&lt;br /&gt;
LINE2:page_out#D73600:page_out \&lt;br /&gt;
LINE2:processes#D73600:processes \&lt;br /&gt;
LINE2:swap_in#D73600:swap_in \&lt;br /&gt;
LINE2:swap_out#D73600:swap_out &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Memory ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rrdtool graph /var/www/localhost/htdocs/memory.png --start -1800  \&lt;br /&gt;
-a PNG -t &amp;quot;Memory&amp;quot; --vertical-label &amp;quot;&amp;quot; \&lt;br /&gt;
-w 1260 -h 400 -r \&lt;br /&gt;
DEF:mem_total=/var/lib/rrdtool/memory.rrd:mem_total:AVERAGE \&lt;br /&gt;
DEF:mem_used=/var/lib/rrdtool/memory.rrd:mem_used:AVERAGE \&lt;br /&gt;
DEF:mem_free=/var/lib/rrdtool/memory.rrd:mem_free:AVERAGE \&lt;br /&gt;
DEF:mem_shared=/var/lib/rrdtool/memory.rrd:mem_shared:AVERAGE \&lt;br /&gt;
DEF:mem_buffers=/var/lib/rrdtool/memory.rrd:mem_buffers:AVERAGE \&lt;br /&gt;
DEF:swap_total=/var/lib/rrdtool/memory.rrd:swap_total:AVERAGE \&lt;br /&gt;
DEF:swap_used=/var/lib/rrdtool/memory.rrd:swap_used:AVERAGE \&lt;br /&gt;
DEF:swap_free=/var/lib/rrdtool/memory.rrd:swap_free:AVERAGE \&lt;br /&gt;
CDEF:mem_total_x=mem_total,1024,\* \&lt;br /&gt;
CDEF:mem_used_x=mem_used,1024,\* \&lt;br /&gt;
CDEF:mem_free_x=mem_free,1024,\* \&lt;br /&gt;
CDEF:mem_shared_x=mem_shared,1024,\* \&lt;br /&gt;
CDEF:mem_buffers_x=mem_buffers,1024,\* \&lt;br /&gt;
CDEF:swap_total_x=swap_total,1024,\* \&lt;br /&gt;
CDEF:swap_used_x=swap_used,1024,\* \&lt;br /&gt;
CDEF:swap_free_x=swap_free,1024,\* \&lt;br /&gt;
LINE1:mem_total_x#000000:mem_total \&lt;br /&gt;
LINE2:mem_used_x#D7CC00:mem_used \&lt;br /&gt;
LINE2:mem_free_x#00CC00:mem_free \&lt;br /&gt;
LINE2:mem_shared_x#D73600:mem_shared \&lt;br /&gt;
LINE2:mem_buffers_x#D73600:mem_buffers \&lt;br /&gt;
LINE2:swap_total_x#000000:swap_total \&lt;br /&gt;
LINE2:swap_used_x#0101D6:swap_used \&lt;br /&gt;
LINE2:swap_free_x#0101D6:swap_free&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== eth0 ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rrdtool graph /var/www/localhost/htdocs/eth0.png --start -1h  \&lt;br /&gt;
-a PNG -t &amp;quot;eth0&amp;quot; --vertical-label &amp;quot;bits/s&amp;quot; \&lt;br /&gt;
-w 1260 -h 400 -r \&lt;br /&gt;
DEF:bytes_in=/var/lib/rrdtool/eth0.rrd:bytes_in:AVERAGE \&lt;br /&gt;
DEF:bytes_out=/var/lib/rrdtool/eth0.rrd:bytes_out:AVERAGE \&lt;br /&gt;
CDEF:bits_in=bytes_in,8,\* \&lt;br /&gt;
CDEF:bits_out=bytes_out,-8,\* \&lt;br /&gt;
AREA:bits_in#339933:bits_in \&lt;br /&gt;
AREA:bits_out#aa3333:bits_out \&lt;br /&gt;
HRULE:0#000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rrdtool graph /var/www/localhost/htdocs/eth0pkt.png --start -1800  \&lt;br /&gt;
-a PNG -t &amp;quot;eth0&amp;quot; --vertical-label &amp;quot;packets&amp;quot; \&lt;br /&gt;
-w 1260 -h 400 -r \&lt;br /&gt;
DEF:pkts_in=/var/lib/rrdtool/eth0.rrd:pkts_in:AVERAGE \&lt;br /&gt;
DEF:pkts_out=/var/lib/rrdtool/eth0.rrd:pkts_out:AVERAGE \&lt;br /&gt;
CDEF:pkts_out_negative=pkts_out,-1,\* \&lt;br /&gt;
LINE2:pkts_in#006600:pkts_in \&lt;br /&gt;
LINE2:pkts_out_negative#D73600:pkts_out \&lt;br /&gt;
HRULE:0#000000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Monitoring]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=8811</id>
		<title>OwnCloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=8811"/>
		<updated>2012-11-19T12:31:26Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: webdav functionallity is fixed ( https://bugs.alpinelinux.org/issues/1470 ). Simplifying webserver installation notes. Clarifying hardening for config.php&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://owncloud.org/ ownCloud] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. You can have your ownCloud instance up and running in 5 minutes with Alpine!&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|ownCloud}} is available from Alpine 2.5 and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
=== sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add owncloud-sqlite}}&lt;br /&gt;
{{warning|{{pkg|sqlite}}+{{pkg|owncould}} is known to have some problem, so do not expect it work. This note should be removed when {{pkg|sqlite}}+{{pkg|owncould}} works. &amp;lt;br&amp;gt;&#039;&#039;(Still a problem at 2012-11-15)&#039;&#039;}}&lt;br /&gt;
=== postgresql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-pgsql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, and temporary grant CREATEDB privilege.&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
CREATE USER mycloud WITH PASSWORD &#039;test123&#039;;&lt;br /&gt;
ALTER ROLE mycloud CREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
=== mysql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-mysql mysql-client}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
{{Note|Remember the usernames/passwords that you set using the wizard, you will need them later.}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|mysql -u root -p&lt;br /&gt;
CREATE DATABASE owncloud;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost.localdomain&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
EXIT}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
{{pkg|mysql-client}} is not needed anymore. Let&#039;s uninstall it:&lt;br /&gt;
{{cmd|apk del mysql-client}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. In this example we will install {{pkg|lighttpd}} but you are free to install any other webserver of your choise as long as it supports php and FastCGI.&lt;br /&gt;
&lt;br /&gt;
=== lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
{{tip|You might want to follow the [http://wiki.alpinelinux.org/wiki/Lighttpd_Https_access Lighttpd_Https_access] doc in order to configure lighttpd to use https &#039;&#039;(securing your connections to your owncloud server)&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
=== Publish owncloud ===&lt;br /&gt;
Link {{pkg|owncloud}} installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/owncloud /var/www/localhost/htdocs/owncloud}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider updating the variable &amp;lt;code&amp;gt;url.access-deny&amp;lt;/code&amp;gt; in {{path|/etc/lighttpd/lighttpd.conf}} for additional security. Add &amp;lt;code&amp;gt;&amp;quot;config.php&amp;quot;&amp;lt;/code&amp;gt; to the variable &#039;&#039;(that&#039;s where the database is stored)&#039;&#039; so it looks something like this:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;~&amp;quot;, &amp;quot;.inc&amp;quot;, &amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
Restart {{pkg|lighttpd}} to activate the changes&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd restart}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as texteditor and videoviewer are in separate package:&lt;br /&gt;
{{cmd|apk add owncloud-texteditor owncloud-videoviewer}}&lt;br /&gt;
&lt;br /&gt;
=== Folder permissions ===&lt;br /&gt;
The web server user needs to have ownership on some dirs. This is fixed by running the following commands:&lt;br /&gt;
{{cmd|chown -R lighttpd.lighttpd /etc/owncloud&lt;br /&gt;
chown -R lighttpd.lighttpd /usr/share/webapps/owncloud/apps&lt;br /&gt;
chown -R lighttpd.lighttpd /var/lib/owncloud/data}}&lt;br /&gt;
{{note|Each time you upgrade {{pkg|owncloud}} you need to remember to fix the permissions as described above.}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use ownCloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://&amp;lt;%MY_SERVER_IP%&amp;gt;/owncloud&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Hardening postgresql ==&lt;br /&gt;
If you have chosen PGSQL backend, revoke CREATEDB privilege from &#039;mycloud&#039; user:&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
ALTER ROLE mycloud NOCREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
&lt;br /&gt;
== Increase upload size ==&lt;br /&gt;
Default configuration for php is limited to 2Mb file size. You might want to increase that size by editing the {{path|/etc/php/php.ini}} and change the following values to something that suits you:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
upload_max_filesize = 2M&lt;br /&gt;
post_max_size = 8M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://owncloud.org/sync-clients/ &#039;&#039;(ownCloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://owncloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=8810</id>
		<title>OwnCloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=8810"/>
		<updated>2012-11-18T20:17:00Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: /* Configure and use ownCloud */ webdav is broken&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://owncloud.org/ ownCloud] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. You can have your ownCloud instance up and running in 5 minutes with Alpine!&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|ownCloud}} is available from Alpine 2.5 and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
=== sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add owncloud-sqlite}}&lt;br /&gt;
{{warning|{{pkg|sqlite}}+{{pkg|owncould}} is known to have some problem, so do not expect it work. This note should be removed when {{pkg|sqlite}}+{{pkg|owncould}} works. &amp;lt;br&amp;gt;&#039;&#039;(Still a problem at 2012-11-15)&#039;&#039;}}&lt;br /&gt;
=== postgresql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-pgsql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, and temporary grant CREATEDB privilege.&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
CREATE USER mycloud WITH PASSWORD &#039;test123&#039;;&lt;br /&gt;
ALTER ROLE mycloud CREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
=== mysql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-mysql mysql-client}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
{{Note|Remember the usernames/passwords that you set using the wizard, you will need them later.}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|mysql -u root -p&lt;br /&gt;
CREATE DATABASE owncloud;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost.localdomain&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
EXIT}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
{{pkg|mysql-client}} is not needed anymore. Let&#039;s uninstall it:&lt;br /&gt;
{{cmd|apk del mysql-client}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. Choose one alternative from below &#039;&#039;(or setup a webserver of your choise)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
{{tip|You might want to follow the [http://wiki.alpinelinux.org/wiki/Lighttpd_Https_access Lighttpd_Https_access] doc in order to configure lighttpd to use https &#039;&#039;(securing your connections to your owncloud server)&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
=== XYZ webserver ===&lt;br /&gt;
You could try installing some other webserver and document it here&lt;br /&gt;
* Apache2&lt;br /&gt;
* cherokee&lt;br /&gt;
* other...&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
Link owncloud installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/owncloud /var/www/localhost/htdocs/owncloud}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider adding the following line for additional security to the owncloud configuration file, where the password database is stored:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as texteditor and videoviewer are in separate package:&lt;br /&gt;
{{cmd|apk add owncloud-texteditor owncloud-videoviewer}}&lt;br /&gt;
&lt;br /&gt;
=== Folder permissions ===&lt;br /&gt;
The web server user needs to have ownership on some dirs. This is fixed by running the following commands:&lt;br /&gt;
{{cmd|chown -R lighttpd.lighttpd /etc/owncloud&lt;br /&gt;
chown -R lighttpd.lighttpd /usr/share/webapps/owncloud/apps&lt;br /&gt;
chown -R lighttpd.lighttpd /var/lib/owncloud/data}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use ownCloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://&amp;lt;%MY_SERVER_IP%&amp;gt;/owncloud&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
{{Todo|There is currently a issue with using webDAV to connect to the owncloud server. Looking at ownclouds dependency app, it shows that {{pkg|php-xml}} is missing &#039;&#039;(which is not true)&#039;&#039;.&amp;lt;br&amp;gt;Most likely the Class &#039;DOMDocument&#039; thats missing in {{pkg|php-xml}}. See {{issue|1470}} for more details.}}&lt;br /&gt;
&lt;br /&gt;
== Hardening postgresql ==&lt;br /&gt;
If you have chosen PGSQL backend, revoke CREATEDB privilege from &#039;mycloud&#039; user:&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
ALTER ROLE mycloud NOCREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
&lt;br /&gt;
== Increase upload size ==&lt;br /&gt;
Default configuration for php is limited to 2Mb file size. You might want to increase that size by editing the {{path|/etc/php/php.ini}} and change the following values to something that suits you:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
upload_max_filesize = ?M&lt;br /&gt;
post_max_size = ?M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://owncloud.org/sync-clients/ &#039;&#039;(ownCloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://owncloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=8809</id>
		<title>OwnCloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=8809"/>
		<updated>2012-11-18T20:07:52Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: /* Configure and use ownCloud */ Configure php to accept bigger upload size&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://owncloud.org/ ownCloud] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. You can have your ownCloud instance up and running in 5 minutes with Alpine!&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|ownCloud}} is available from Alpine 2.5 and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
=== sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add owncloud-sqlite}}&lt;br /&gt;
{{warning|{{pkg|sqlite}}+{{pkg|owncould}} is known to have some problem, so do not expect it work. This note should be removed when {{pkg|sqlite}}+{{pkg|owncould}} works. &amp;lt;br&amp;gt;&#039;&#039;(Still a problem at 2012-11-15)&#039;&#039;}}&lt;br /&gt;
=== postgresql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-pgsql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, and temporary grant CREATEDB privilege.&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
CREATE USER mycloud WITH PASSWORD &#039;test123&#039;;&lt;br /&gt;
ALTER ROLE mycloud CREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
=== mysql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-mysql mysql-client}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
{{Note|Remember the usernames/passwords that you set using the wizard, you will need them later.}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|mysql -u root -p&lt;br /&gt;
CREATE DATABASE owncloud;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost.localdomain&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
EXIT}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
{{pkg|mysql-client}} is not needed anymore. Let&#039;s uninstall it:&lt;br /&gt;
{{cmd|apk del mysql-client}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. Choose one alternative from below &#039;&#039;(or setup a webserver of your choise)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
{{tip|You might want to follow the [http://wiki.alpinelinux.org/wiki/Lighttpd_Https_access Lighttpd_Https_access] doc in order to configure lighttpd to use https &#039;&#039;(securing your connections to your owncloud server)&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
=== XYZ webserver ===&lt;br /&gt;
You could try installing some other webserver and document it here&lt;br /&gt;
* Apache2&lt;br /&gt;
* cherokee&lt;br /&gt;
* other...&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
Link owncloud installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/owncloud /var/www/localhost/htdocs/owncloud}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider adding the following line for additional security to the owncloud configuration file, where the password database is stored:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as texteditor and videoviewer are in separate package:&lt;br /&gt;
{{cmd|apk add owncloud-texteditor owncloud-videoviewer}}&lt;br /&gt;
&lt;br /&gt;
=== Folder permissions ===&lt;br /&gt;
The web server user needs to have ownership on some dirs. This is fixed by running the following commands:&lt;br /&gt;
{{cmd|chown -R lighttpd.lighttpd /etc/owncloud&lt;br /&gt;
chown -R lighttpd.lighttpd /usr/share/webapps/owncloud/apps&lt;br /&gt;
chown -R lighttpd.lighttpd /var/lib/owncloud/data}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use ownCloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://&amp;lt;%MY_SERVER_IP%&amp;gt;/owncloud&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Hardening postgresql ==&lt;br /&gt;
If you have chosen PGSQL backend, revoke CREATEDB privilege from &#039;mycloud&#039; user:&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
ALTER ROLE mycloud NOCREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
&lt;br /&gt;
== Increase upload size ==&lt;br /&gt;
Default configuration for php is limited to 2Mb file size. You might want to increase that size by editing the {{path|/etc/php/php.ini}} and change the following values to something that suits you:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
upload_max_filesize = ?M&lt;br /&gt;
post_max_size = ?M&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://owncloud.org/sync-clients/ &#039;&#039;(ownCloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://owncloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=8808</id>
		<title>OwnCloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=8808"/>
		<updated>2012-11-18T20:01:25Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Suggest using https&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://owncloud.org/ ownCloud] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. You can have your ownCloud instance up and running in 5 minutes with Alpine!&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|ownCloud}} is available from Alpine 2.5 and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
=== sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add owncloud-sqlite}}&lt;br /&gt;
{{warning|{{pkg|sqlite}}+{{pkg|owncould}} is known to have some problem, so do not expect it work. This note should be removed when {{pkg|sqlite}}+{{pkg|owncould}} works. &amp;lt;br&amp;gt;&#039;&#039;(Still a problem at 2012-11-15)&#039;&#039;}}&lt;br /&gt;
=== postgresql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-pgsql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, and temporary grant CREATEDB privilege.&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
CREATE USER mycloud WITH PASSWORD &#039;test123&#039;;&lt;br /&gt;
ALTER ROLE mycloud CREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
=== mysql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-mysql mysql-client}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
{{Note|Remember the usernames/passwords that you set using the wizard, you will need them later.}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|mysql -u root -p&lt;br /&gt;
CREATE DATABASE owncloud;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost.localdomain&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
EXIT}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
{{pkg|mysql-client}} is not needed anymore. Let&#039;s uninstall it:&lt;br /&gt;
{{cmd|apk del mysql-client}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. Choose one alternative from below &#039;&#039;(or setup a webserver of your choise)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
{{tip|You might want to follow the [http://wiki.alpinelinux.org/wiki/Lighttpd_Https_access Lighttpd_Https_access] doc in order to configure lighttpd to use https &#039;&#039;(securing your connections to your owncloud server)&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
=== XYZ webserver ===&lt;br /&gt;
You could try installing some other webserver and document it here&lt;br /&gt;
* Apache2&lt;br /&gt;
* cherokee&lt;br /&gt;
* other...&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
Link owncloud installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/owncloud /var/www/localhost/htdocs/owncloud}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider adding the following line for additional security to the owncloud configuration file, where the password database is stored:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as texteditor and videoviewer are in separate package:&lt;br /&gt;
{{cmd|apk add owncloud-texteditor owncloud-videoviewer}}&lt;br /&gt;
&lt;br /&gt;
=== Folder permissions ===&lt;br /&gt;
The web server user needs to have ownership on some dirs. This is fixed by running the following commands:&lt;br /&gt;
{{cmd|chown -R lighttpd.lighttpd /etc/owncloud&lt;br /&gt;
chown -R lighttpd.lighttpd /usr/share/webapps/owncloud/apps&lt;br /&gt;
chown -R lighttpd.lighttpd /var/lib/owncloud/data}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use ownCloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://&amp;lt;%MY_SERVER_IP%&amp;gt;/owncloud&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Hardening postgresql ==&lt;br /&gt;
If you have chosen PGSQL backend, revoke CREATEDB privilege from &#039;mycloud&#039; user:&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
ALTER ROLE mycloud NOCREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://owncloud.org/sync-clients/ &#039;&#039;(ownCloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://owncloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=8806</id>
		<title>OwnCloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=8806"/>
		<updated>2012-11-15T15:50:31Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: I think owncloud-mysql works now (better than the others)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{draft}}&lt;br /&gt;
[http://owncloud.org/ ownCloud] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. You can have your ownCloud instance up and running in 5 minutes with Alpine!&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|ownCloud}} is available from Alpine 2.5 and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
=== sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add owncloud-sqlite}}&lt;br /&gt;
{{warning|{{pkg|sqlite}}+{{pkg|owncould}} is known to have some problem, so do not expect it work. This note should be removed when {{pkg|sqlite}}+{{pkg|owncould}} works. &amp;lt;br&amp;gt;&#039;&#039;(Still a problem at 2012-11-15)&#039;&#039;}}&lt;br /&gt;
=== postgresql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-pgsql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, and temporary grant CREATEDB privilege.&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
CREATE USER mycloud WITH PASSWORD &#039;test123&#039;;&lt;br /&gt;
ALTER ROLE mycloud CREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
=== mysql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-mysql mysql-client}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
{{Note|Remember the usernames/passwords that you set using the wizard, you will need them later.}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|mysql -u root -p&lt;br /&gt;
CREATE DATABASE owncloud;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
GRANT ALL ON owncloud.* TO &#039;mycloud&#039;@&#039;localhost.localdomain&#039; IDENTIFIED BY &#039;test123&#039;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
EXIT}}&lt;br /&gt;
{{Note|Replace the above username &#039;mycloud&#039; and password &#039;test123&#039; to something secure. Remember these settings, you will need them later when setting up owncloud.}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. Choose one alternative from below &#039;&#039;(or setup a webserver of your choise)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
=== XYZ webserver ===&lt;br /&gt;
You could try installing some other webserver and document it here&lt;br /&gt;
* Apache2&lt;br /&gt;
* cherokee&lt;br /&gt;
* other...&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
Link owncloud installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/owncloud /var/www/localhost/htdocs/owncloud}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider adding the following line for additional security to the owncloud configuration file, where the password database is stored:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as texteditor and videoviewer are in separate package:&lt;br /&gt;
{{cmd|apk add owncloud-texteditor owncloud-videoviewer}}&lt;br /&gt;
&lt;br /&gt;
=== Folder permissions ===&lt;br /&gt;
The web server user needs to have ownership on some dirs. This is fixed by running the following commands:&lt;br /&gt;
{{cmd|chown -R lighttpd.lighttpd /etc/owncloud&lt;br /&gt;
chown -R lighttpd.lighttpd /usr/share/webapps/owncloud/apps&lt;br /&gt;
chown -R lighttpd.lighttpd /var/lib/owncloud/data}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use ownCloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://&amp;lt;%MY_SERVER_IP%&amp;gt;/owncloud&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Hardening postgresql ==&lt;br /&gt;
If you have chosen PGSQL backend, revoke CREATEDB privilege from &#039;mycloud&#039; user:&lt;br /&gt;
{{cmd|psql -U postgres&lt;br /&gt;
ALTER ROLE mycloud NOCREATEDB;&lt;br /&gt;
\q}}&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://owncloud.org/sync-clients/ &#039;&#039;(ownCloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://owncloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=8801</id>
		<title>OwnCloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=8801"/>
		<updated>2012-11-15T10:43:31Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: /* mysql */ Additional mysql notes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{draft}}&lt;br /&gt;
[http://owncloud.org/ ownCloud] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. You can have your ownCloud instance up and running in 5 minutes with Alpine!&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|ownCloud}} is available from Alpine 2.5 and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
=== sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add owncloud-sqlite}}&lt;br /&gt;
{{warning|{{pkg|sqlite}}+{{pkg|owncould}} is known to have some problem, so do not expect it work. This note should be removed when {{pkg|sqlite}}+{{pkg|owncould}} works. &amp;lt;br&amp;gt;&#039;&#039;(Still a problem at 2012-11-15)&#039;&#039;}}&lt;br /&gt;
=== postgresql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-psql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|# psql -U postgres&lt;br /&gt;
postgres{{=}}# CREATE USER owncloud WITH PASSWORD &#039;&amp;lt;%STRONG_PASSWORD%&amp;gt;&#039;;&lt;br /&gt;
postgres{{=}}# CREATE DATABASE owncloud;&lt;br /&gt;
postgres{{=}}# GRANT ALL ON DATABASE owncloud TO owncloud;&lt;br /&gt;
postgres{{=}}# \q}}&lt;br /&gt;
{{note|The above commands creates the user &#039;owncloud&#039; with a password you provide and the database &#039;owncloud&#039;. Remember these settings, you will need them later when setting up owncloud}}&lt;br /&gt;
&lt;br /&gt;
=== mysql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-mysql mysql-client}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
{{Note|Remember the usernames/passwords that you set using the wizard, you will need them later.}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|mysql -u root -p&lt;br /&gt;
CREATE DATABASE owncloud;&lt;br /&gt;
GRANT ALL PRIVILEGES ON owncloud.* TO &amp;quot;mycloud&amp;quot;@&amp;quot;localhost&amp;quot; IDENTIFIED BY &amp;quot;mypassword&amp;quot;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
EXIT}}&lt;br /&gt;
{{Note|Replace the above &#039;mycloud&#039; and &#039;mypassword&#039; to something secure}}&lt;br /&gt;
&lt;br /&gt;
{{todo|The mysql setup is not yet tested and verified. Please update/bugfix the mysql-notes above and remove this note when verified that it works.}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. Choose one alternative from below &#039;&#039;(or setup a webserver of your choise)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
=== XYZ webserver ===&lt;br /&gt;
You could try installing some other webserver and document it here&lt;br /&gt;
* Apache2&lt;br /&gt;
* cherokee&lt;br /&gt;
* other...&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
Link owncloud installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/owncloud /var/www/localhost/htdocs/owncloud}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider adding the following line for additional security to the owncloud configuration file, where the password database is stored:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
=== Folder permissions ===&lt;br /&gt;
The web server user needs to have ownership on some dirs. This is fixed by running the following commands:&lt;br /&gt;
{{cmd|chown -R lighttpd.lighttpd /etc/owncloud&lt;br /&gt;
chown -R lighttpd.lighttpd /usr/share/webapps/owncloud/apps&lt;br /&gt;
chown -R lighttpd.lighttpd /var/lib/owncloud/data}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as texteditor and videoviewer are in separate package:&lt;br /&gt;
{{cmd|apk add owncloud-texteditor owncloud-videoviewer}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use ownCloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://&amp;lt;%MY_SERVER_IP%&amp;gt;/owncloud&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://owncloud.org/sync-clients/ &#039;&#039;(ownCloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://owncloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=8800</id>
		<title>OwnCloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=8800"/>
		<updated>2012-11-15T10:33:13Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: /* mysql */ Configure mysql&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{draft}}&lt;br /&gt;
[http://owncloud.org/ ownCloud] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. You can have your ownCloud instance up and running in 5 minutes with Alpine!&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|ownCloud}} is available from Alpine 2.5 and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
=== sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add owncloud-sqlite}}&lt;br /&gt;
{{warning|{{pkg|sqlite}}+{{pkg|owncould}} is known to have some problem, so do not expect it work. This note should be removed when {{pkg|sqlite}}+{{pkg|owncould}} works. &amp;lt;br&amp;gt;&#039;&#039;(Still a problem at 2012-11-15)&#039;&#039;}}&lt;br /&gt;
=== postgresql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-psql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|# psql -U postgres&lt;br /&gt;
postgres{{=}}# CREATE USER owncloud WITH PASSWORD &#039;&amp;lt;%STRONG_PASSWORD%&amp;gt;&#039;;&lt;br /&gt;
postgres{{=}}# CREATE DATABASE owncloud;&lt;br /&gt;
postgres{{=}}# GRANT ALL ON DATABASE owncloud TO owncloud;&lt;br /&gt;
postgres{{=}}# \q}}&lt;br /&gt;
{{note|The above commands creates the user &#039;owncloud&#039; with a password you provide and the database &#039;owncloud&#039;. Remember these settings, you will need them later when setting up owncloud}}&lt;br /&gt;
&lt;br /&gt;
=== mysql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-mysql}}&lt;br /&gt;
&lt;br /&gt;
Now configure and start {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup&lt;br /&gt;
/etc/init.d/mysql start&lt;br /&gt;
/usr/bin/mysql_secure_installation}}&lt;br /&gt;
Follow the wizard to setup passwords etc.&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. Choose one alternative from below &#039;&#039;(or setup a webserver of your choise)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
=== XYZ webserver ===&lt;br /&gt;
You could try installing some other webserver and document it here&lt;br /&gt;
* Apache2&lt;br /&gt;
* cherokee&lt;br /&gt;
* other...&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
Link owncloud installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/owncloud /var/www/localhost/htdocs/owncloud}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider adding the following line for additional security to the owncloud configuration file, where the password database is stored:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
=== Folder permissions ===&lt;br /&gt;
The web server user needs to have ownership on some dirs. This is fixed by running the following commands:&lt;br /&gt;
{{cmd|chown -R lighttpd.lighttpd /etc/owncloud&lt;br /&gt;
chown -R lighttpd.lighttpd /usr/share/webapps/owncloud/apps&lt;br /&gt;
chown -R lighttpd.lighttpd /var/lib/owncloud/data}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as texteditor and videoviewer are in separate package:&lt;br /&gt;
{{cmd|apk add owncloud-texteditor owncloud-videoviewer}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use ownCloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://&amp;lt;%MY_SERVER_IP%&amp;gt;/owncloud&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://owncloud.org/sync-clients/ &#039;&#039;(ownCloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://owncloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=8797</id>
		<title>OwnCloud</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OwnCloud&amp;diff=8797"/>
		<updated>2012-11-15T09:26:32Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Restructuring page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{draft}}&lt;br /&gt;
[http://owncloud.org/ ownCloud] is WedDAV-based solution for storing and sharing on-line your data, files, images, video, music, calendars and contacts. You can have your ownCloud instance up and running in 5 minutes with Alpine!&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
{{pkg|ownCloud}} is available from Alpine 2.5 and greater.&lt;br /&gt;
&lt;br /&gt;
Before you start installing anything, make sure you have latest packages available. Make sure you are using a &#039;http&#039; repository in your {{path|/etc/apk/repositories}} and then run:&lt;br /&gt;
{{cmd|apk update}}&lt;br /&gt;
{{tip|Detailed information is found in [[Include:Upgrading_to_latest_release|this]] doc.}}&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
First you have to decide which database to use. Follow one of the below database alternatives.&lt;br /&gt;
=== sqlite ===&lt;br /&gt;
All you need to do is to install the package&lt;br /&gt;
{{cmd|apk add owncloud-sqlite}}&lt;br /&gt;
{{warning|{{pkg|sqlite}}+{{pkg|owncould}} is known to have some problem, so do not expect it work. This note should be removed when {{pkg|sqlite}}+{{pkg|owncould}} works. &amp;lt;br&amp;gt;&#039;&#039;(Still a problem at 2012-11-15)&#039;&#039;}}&lt;br /&gt;
=== postgresql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-psql}}&lt;br /&gt;
&lt;br /&gt;
Next thing is to configure and start the database&lt;br /&gt;
{{cmd|/etc/init.d/postgresql setup&lt;br /&gt;
/etc/init.d/postgresql start}}&lt;br /&gt;
&lt;br /&gt;
Next you need to create a user, database and set permissions.&lt;br /&gt;
{{cmd|# psql -U postgres&lt;br /&gt;
postgres{{=}}# CREATE USER owncloud WITH PASSWORD &#039;&amp;lt;%STRONG_PASSWORD%&amp;gt;&#039;;&lt;br /&gt;
postgres{{=}}# CREATE DATABASE owncloud;&lt;br /&gt;
postgres{{=}}# GRANT ALL ON DATABASE owncloud TO owncloud;&lt;br /&gt;
postgres{{=}}# \q}}&lt;br /&gt;
{{note|The above commands creates the user &#039;owncloud&#039; with a password you provide and the database &#039;owncloud&#039;. Remember these settings, you will need them later when setting up owncloud}}&lt;br /&gt;
&lt;br /&gt;
=== mysql ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add owncloud-mysql}}&lt;br /&gt;
&lt;br /&gt;
Now configure {{pkg|mysql}}&lt;br /&gt;
{{cmd|/etc/init.d/mysql setup}}&lt;br /&gt;
{{note|When you configure {{pkg|mysql}} for first time, you will see some instructions on the console. It is wise to do the actions presented on the screen to enhance security of {{pkg|mysql}} }}&lt;br /&gt;
Next start the database&lt;br /&gt;
{{cmd|/etc/init.d/mysql start}}&lt;br /&gt;
&lt;br /&gt;
== Webserver ==&lt;br /&gt;
Next thing is to choose, install and configure a webserver. Choose one alternative from below &#039;&#039;(or setup a webserver of your choise)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== lighttpd ===&lt;br /&gt;
Install the package&lt;br /&gt;
{{cmd|apk add lighttpd}}&lt;br /&gt;
&lt;br /&gt;
Make sure you have FastCGI enabled in {{pkg|lighttpd}}:&lt;br /&gt;
{{cat|/etc/lighttpd/lighttpd.conf|...&lt;br /&gt;
include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
Start up the webserver&lt;br /&gt;
{{cmd|/etc/init.d/lighttpd start}}&lt;br /&gt;
&lt;br /&gt;
=== XYZ webserver ===&lt;br /&gt;
You could try installing some other webserver and document it here&lt;br /&gt;
* Apache2&lt;br /&gt;
* cherokee&lt;br /&gt;
* other...&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
Link owncloud installation to web server directory:&lt;br /&gt;
{{cmd|ln -s /usr/share/webapps/owncloud /var/www/localhost/htdocs/owncloud}}&lt;br /&gt;
&lt;br /&gt;
== Other settings ==&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
Consider adding the following line for additional security to the owncloud configuration file, where the password database is stored:&lt;br /&gt;
{{cat|/???/???/???|...&lt;br /&gt;
url.access-deny {{=}} (&amp;quot;config.php&amp;quot;)&lt;br /&gt;
...}}&lt;br /&gt;
{{todo|Where should this config go?}}&lt;br /&gt;
&lt;br /&gt;
=== Folder permissions ===&lt;br /&gt;
The web server user needs to have ownership on some dirs. This is fixed by running the following commands:&lt;br /&gt;
{{cmd|chown -R lighttpd.lighttpd /etc/owncloud&lt;br /&gt;
chown -R lighttpd.lighttpd /usr/share/webapps/owncloud/apps&lt;br /&gt;
chown -R lighttpd.lighttpd /var/lib/owncloud/data}}&lt;br /&gt;
&lt;br /&gt;
=== Additional packages ===&lt;br /&gt;
Some large apps, such as texteditor and videoviewer are in separate package:&lt;br /&gt;
{{cmd|apk add owncloud-texteditor owncloud-videoviewer}}&lt;br /&gt;
&lt;br /&gt;
= Configure and use ownCloud =&lt;br /&gt;
== Configure ==&lt;br /&gt;
Point your browser at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://&amp;lt;%MY_SERVER_IP%&amp;gt;/owncloud&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and follow the on-screen instructions to complete the installation, supplying the database user and password created before.&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are clients available for many platforms, Android included:&lt;br /&gt;
* http://owncloud.org/sync-clients/ &#039;&#039;(ownCloud Sync clients)&#039;&#039;&lt;br /&gt;
* http://owncloud.org/support/android/ &#039;&#039;(Android client)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=How-To_Alpine_Wall&amp;diff=8706</id>
		<title>How-To Alpine Wall</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=How-To_Alpine_Wall&amp;diff=8706"/>
		<updated>2012-10-29T16:06:25Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Updating path for Policy files suggesting users to save their Policy files in /etc/awall/optional so we can skip the &amp;#039;lbu inc &amp;amp;&amp;amp; lbu ci&amp;#039; part in this doc (making it simpler to understand).&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
&lt;br /&gt;
= General =&lt;br /&gt;
Purpose of this doc is to illustrate Alpine Wall ({{pkg|AWall}}) by examples.&amp;lt;BR&amp;gt;&lt;br /&gt;
We will explain {{pkg|AWall}} from the viewpoint of a Shorewall user.&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{pkg|AWall}} is available since Alpine v2.4.&amp;lt;BR&amp;gt;&lt;br /&gt;
Please see [[Alpine_Wall_User&#039;s_Guide]] for details about the syntax.&lt;br /&gt;
&lt;br /&gt;
Some of the below features and examples assumes that you are running {{pkg|AWall}} version 0.2.12 or later.&amp;lt;BR&amp;gt;&lt;br /&gt;
Make sure you are running latest version by running the following commands:&lt;br /&gt;
{{cmd|apk update&lt;br /&gt;
apk add -u awall&lt;br /&gt;
apk version awall}}&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
Your {{pkg|AWall}} firewall configuration file(s) goes to {{Path|/etc/awall/optional}}&amp;lt;BR&amp;gt;&lt;br /&gt;
Each such file is called &#039;&#039;Policy&#039;&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
{{note| {{pkg|AWall}} versions prior 0.2.12 will only look for &#039;&#039;Policy&#039;&#039; files in {{Path|/usr/share/awall/optional}}.&amp;lt;BR&amp;gt;From version 0.2.12 and higher, {{pkg|AWall}} will look for &#039;&#039;Policy&#039;&#039; files in both {{Path|/etc/awall/optional}} and {{Path|/usr/share/awall/optional}}}}&lt;br /&gt;
You may have multiple &#039;&#039;Policy&#039;&#039; files &#039;&#039;(it is useful to have separate files for eg. HTTP,FTP and other roles)&#039;&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
The &#039;&#039;Policy(s)&#039;&#039; can be enabled or disabled by using the &amp;quot;awall [enable|disable]&amp;quot; command.&lt;br /&gt;
{{note|{{pkg|AWall}}&#039;s &#039;&#039;Policy&#039;&#039; files are not equivalent to Shorewalls {{Path|/etc/shorewall/policy}} file.}}&lt;br /&gt;
An {{pkg|AWall}} &#039;&#039;Policy&#039;&#039; can contain definitions of:&lt;br /&gt;
* variables &#039;&#039;(like {{Path|/etc/shorewall/params}})&#039;&#039;&lt;br /&gt;
* zones &#039;&#039;(like {{Path|/etc/shorewall/zones}})&#039;&#039;&lt;br /&gt;
* interfaces &#039;&#039;(like {{Path|/etc/shorewall/interfaces}})&#039;&#039;&lt;br /&gt;
* policies &#039;&#039;(like {{Path|/etc/shorewall/policy}})&#039;&#039;&lt;br /&gt;
* filters and NAT rules &#039;&#039;(like {{Path|/etc/shorewall/rules}})&#039;&#039;&lt;br /&gt;
* services &#039;&#039;(like {{Path|/usr/share/shorewall/macro.HTTP}})&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
After installing {{pkg|AWall}}, you need to load the following iptables modules:&lt;br /&gt;
{{cmd|modprobe ip_tables&lt;br /&gt;
modprobe iptable_nat    #if NAT is used}}&lt;br /&gt;
&lt;br /&gt;
This is needed only the first time, after {{pkg|AWall}} installation.&lt;br /&gt;
&lt;br /&gt;
Make the firewall autostart at boot and autoload the needed modules:&lt;br /&gt;
{{cmd|rc-update add iptables}}&lt;br /&gt;
&lt;br /&gt;
= A Basic Home Firewall =&lt;br /&gt;
We will give a example on how you can convert a &amp;quot;Basic home firewall&amp;quot; from Shorewall to {{pkg|AWall}}.&lt;br /&gt;
&lt;br /&gt;
== Example firewall using Shorewall ==&lt;br /&gt;
Let&#039;s suppose you have the following Shorewall configuration:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/zones&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inet  ipv4&lt;br /&gt;
loc   ipv4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/interfaces&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inet  eth0&lt;br /&gt;
loc   eth1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/policy&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fw   all  ACCEPT&lt;br /&gt;
loc  inet ACCEPT&lt;br /&gt;
all  all  DROP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/masq&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
eth0  0.0.0.0/0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example firewall using AWall ==&lt;br /&gt;
Now we will configure {{pkg|AWall}} to do the same thing as we just did with the above Shorewall example.&lt;br /&gt;
&lt;br /&gt;
Create a new file called {{Path|/etc/awall/optional/test-policy.json}} and add the following content to the file.&amp;lt;BR&amp;gt;&lt;br /&gt;
{{Tip|You could call it something else as long as you save it in {{Path|/etc/awall/optional/}} and name it {{Path|???&#039;&#039;&#039;.json&#039;&#039;&#039;}})}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Home firewall&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;inet&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;eth0&amp;quot; },&lt;br /&gt;
    &amp;quot;loc&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;eth1&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;policy&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;loc&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;snat&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;inet&amp;quot; }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above configuration will:&lt;br /&gt;
* Create a description of your &#039;&#039;Policy&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;zones&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;policy&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;snat&#039;&#039; &#039;&#039;(to masqurade the outgoing traffic)&#039;&#039;&lt;br /&gt;
{{Note|&#039;&#039;snat&#039;&#039; means &amp;quot;source NAT&amp;quot;. It does &amp;lt;u&amp;gt;not&amp;lt;/u&amp;gt; mean &amp;quot;static NAT&amp;quot;.}}&lt;br /&gt;
{{Tip| {{pkg|AWall}} has a built-in zone named &amp;quot;_fw&amp;quot; which is the &amp;quot;firewall itself&amp;quot;. This corresponds to the Shorewall &amp;quot;fw&amp;quot; zone.}}&lt;br /&gt;
&lt;br /&gt;
=== Activating/Applying a Policy ===&lt;br /&gt;
After saving the &#039;&#039;Policy&#039;&#039; you can run the following commands to activate your firewall settings:&lt;br /&gt;
{{cmd|awall list                  # Listing available &#039;Policy(s)&#039; (This step is optional)&lt;br /&gt;
awall enable test-policy    # Enables the &#039;Policy&#039;&lt;br /&gt;
awall activate              # Genereates firewall configuration from the &#039;Policy&#039; files and enables it (starts the firewall)}}&lt;br /&gt;
&lt;br /&gt;
If you have multiple policies, after enabling or disabling them, you need to always run &#039;&#039;awall activate&#039;&#039; in order to update the iptables rules.&lt;br /&gt;
&lt;br /&gt;
= Advanced Firewall settings =&lt;br /&gt;
Assuming you have your {{Path|/etc/awall/optional/test-policy.json}} with your &amp;quot;Basic home firewall&amp;quot; settings, you could choose to modify that file to test the below examples.&lt;br /&gt;
{{tip|You could create new files in {{Path|/etc/awall/optional/}} for testing some of the below examples}}&lt;br /&gt;
&lt;br /&gt;
== Logging ==&lt;br /&gt;
{{pkg|AWall}} will &#039;&#039;(since v0.2.7)&#039;&#039; automatically log dropped packets.&amp;lt;BR&amp;gt;&lt;br /&gt;
You could add the following row to the &amp;quot;policy&amp;quot; section in your &#039;&#039;Policy&#039;&#039; file in order to see the dropped packets.&lt;br /&gt;
&amp;lt;pre&amp;gt;{ &amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;loc&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;drop&amp;quot; }&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note|If you are using Alpine 2.4 repository ({{pkg|AWall}} v0.2.5 or below), you should use &amp;lt;code&amp;gt;&amp;quot;action&amp;quot;: &amp;quot;logdrop&amp;quot;&amp;lt;/code&amp;gt; in order to log dropped packets .}}&lt;br /&gt;
{{Note|If you are adding the above content to an already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
&lt;br /&gt;
== Port-Forwarding ==&lt;br /&gt;
Let&#039;s suppose you have a local web server (192.168.1.10) that you want to make accessible from the &amp;quot;inet&amp;quot;.&amp;lt;BR&amp;gt;&lt;br /&gt;
With Shorewall you would have a rule like this in your {{Path|/etc/shorewall/rules}}:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#ACTION  SOURCE  DEST               PROTO  DEST    SOURCE    ORIGINAL&lt;br /&gt;
#                                          PORT(S) PORT(S)   DEST&lt;br /&gt;
DNAT     inet     loc:192.168.1.10  tcp    80&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lets configure our {{pkg|AWall}} &#039;&#039;Policy&#039;&#039; file likewise by adding the following content.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;APACHE&amp;quot;: &amp;quot;192.168.1.10&amp;quot;,&lt;br /&gt;
    &amp;quot;STATIC_IP&amp;quot;: &amp;quot;1.2.3.4&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;$STATIC_IP&amp;quot;, &lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;http&amp;quot;, &lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;, &lt;br /&gt;
      &amp;quot;dnat&amp;quot;: &amp;quot;$APACHE&amp;quot; &lt;br /&gt;
      }&lt;br /&gt;
    ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see in the above example, we create a&lt;br /&gt;
* &amp;quot;variable&amp;quot; section where we specify some IP-addresses&lt;br /&gt;
* &amp;quot;filter&amp;quot; section where we do the actual port-forwarding (using the variables we just created and using some preexisting &amp;quot;services&amp;quot; definitions)&lt;br /&gt;
{{Note|If you are adding the above content to a already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
{{Tip|{{pkg|AWall}} already has a &amp;quot;service&amp;quot; definition list for several services like HTTP, FTP, SNMP, etc. &#039;&#039;(see {{Path|/usr/share/awall/mandatory/services.json}})&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
== Create your own service definitions ==&lt;br /&gt;
You can add your own service definitions into your &#039;&#039;Policy&#039;&#039; files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;service&amp;quot;: {  &lt;br /&gt;
  &amp;quot;openvpn&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;udp&amp;quot;, &amp;quot;port&amp;quot;: 1194 }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note|You can not override a &amp;quot;service&amp;quot; definition that comes from {{Path|/usr/share/awall/mandatory/services.json}} }}&lt;br /&gt;
{{Note|If you are adding the above content to a already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
&lt;br /&gt;
== Inherit services or variables == &lt;br /&gt;
You can import a &#039;&#039;Policy&#039;&#039; into other &#039;&#039;Policy&#039;&#039; files for inheriting services or variables definitions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;import&amp;quot;: &amp;quot;myfirewall&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Specify load order ==&lt;br /&gt;
By default policies are loaded on alphabetical order.&amp;lt;BR&amp;gt;&lt;br /&gt;
You can change the load order with the keywords &amp;quot;before&amp;quot; and &amp;quot;after&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;before&amp;quot;: &amp;quot;myfirewall&amp;quot;&lt;br /&gt;
&amp;quot;after&amp;quot;: &amp;quot;someotherpolicy&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Other =&lt;br /&gt;
== Help and debugging ==&lt;br /&gt;
If you end up in some kind of trouble, you might find some commands useful when debugging:&lt;br /&gt;
{{cmd|awall                 # (With no parameters) Shows some basic help about awall application&lt;br /&gt;
iptables -L -n        # Show what&#039;s in &amp;lt;code&amp;gt;iptables&amp;lt;/code&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Tmux&amp;diff=8615</id>
		<title>Tmux</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Tmux&amp;diff=8615"/>
		<updated>2012-10-24T15:08:03Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: /* Close or kill a session */ Bugfix on how to kill a window&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{pkg|tmux}} is a terminal multiplexer. It&#039;s a good tool for e.g. remote support. It can also be used to start a command you want to keep running after you close your console session (you can later on attach to your running session).&lt;br /&gt;
&lt;br /&gt;
= Install =&lt;br /&gt;
In order to use {{pkg|tmux}} you will have to install it:&lt;br /&gt;
{{cmd|apk add tmux}}&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
== Start a new session ==&lt;br /&gt;
To create a {{pkg|tmux}} session you just enter:&lt;br /&gt;
{{cmd|tmux}}&lt;br /&gt;
&lt;br /&gt;
== List existing sessions ==&lt;br /&gt;
When you have started some session(s) you can list them:&lt;br /&gt;
{{cmd|tmux ls}}&lt;br /&gt;
{{tip|Above command can also be run as &amp;lt;code&amp;gt;tmux list-sessions&amp;lt;/code&amp;gt;}}&lt;br /&gt;
You might get a list that looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: 1 windows (created Wed Oct 24 15:12:12 2012) [126x35]&lt;br /&gt;
1: 1 windows (created Wed Oct 24 15:14:44 2012) [126x35]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Attach to a existing session ==&lt;br /&gt;
Lets say you want to attach to a existing session (e.g. the above &amp;lt;code&amp;gt;1: 1 windows&amp;lt;/code&amp;gt; session).&lt;br /&gt;
{{cmd|tmux attach -t 1}}&lt;br /&gt;
{{tip|If you only have one session you don&#039;t need to specify session. Just run &amp;lt;code&amp;gt;tmux attach&amp;lt;/code&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== Controlling a session ==&lt;br /&gt;
While inside a {{pkg|tmux}} session, you can control it using keyboard shortcuts. We will only describe some of those alternatives.&lt;br /&gt;
&lt;br /&gt;
{{tip|To enter a keyboard shortcut that controls the current {{pkg|tmux}} session, you should click {{key|B}} while holding down {{key|CTRL}}&amp;lt;br&amp;gt;In the below examples this procedure is described as &amp;lt;code&amp;gt;C-b&amp;lt;/code&amp;gt;}}&lt;br /&gt;
=== Get help ===&lt;br /&gt;
One of the most useful commands is the one that gives you &#039;help&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
While in your {{pkg|tmux}} session, click:&lt;br /&gt;
{{cmd|C-b ?}}&lt;br /&gt;
&#039;&#039;(Do not press/hold {{key|CTRL}} when clicking {{key|?}})&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Detach from a session ===&lt;br /&gt;
Sometimes it&#039;s useful to just detach from a session without killing it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{cmd|C-b d}}&lt;br /&gt;
{{tip|Try starting &amp;lt;code&amp;gt;ping 127.0.0.1&amp;lt;/code&amp;gt; while inside a session and then detach from the session.&amp;lt;br&amp;gt;After some while re-connect to the session using &amp;lt;code&amp;gt;tmux attach&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;Note that the &amp;quot;seq&amp;quot; value indicates that ping had continued running while you where detached from the session.}}&lt;br /&gt;
&lt;br /&gt;
=== Close or kill a session ===&lt;br /&gt;
To &#039;kill&#039; a session:&lt;br /&gt;
{{cmd|C-b &amp;amp;}}&lt;br /&gt;
Confirm by clicking {{key|y}} when prompted.&lt;br /&gt;
&lt;br /&gt;
You can also &#039;kill&#039; your session by entering:&lt;br /&gt;
{{cmd|exit}}&lt;br /&gt;
&lt;br /&gt;
= Other terminal multiplexers =&lt;br /&gt;
A similar tool is {{pkg|screen}} which is documented [[Screen_on_console|here]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Shell]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Screen_terminal_multiplexer&amp;diff=8614</id>
		<title>Screen terminal multiplexer</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Screen_terminal_multiplexer&amp;diff=8614"/>
		<updated>2012-10-24T15:07:41Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: /* Close or kill a session */ Fixed typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{pkg|screen}} is a terminal multiplexer. It&#039;s a good tool for e.g. remote support. It can also be used to start a command you want to keep running after you close your console session (you can later on attach to your running session). When you enter a {{pkg|screen}} session you will not notice too much.&amp;lt;BR&amp;gt;&lt;br /&gt;
To know if you are inside a {{pkg|screen}} session, use the notes in &#039;[[#Get_help|get help]]&#039; section mentioned below.&lt;br /&gt;
&lt;br /&gt;
= Install =&lt;br /&gt;
In order to use {{pkg|screen}} you will have to install it:&lt;br /&gt;
{{cmd|apk add screen}}&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
== Start a new session ==&lt;br /&gt;
To enter a {{pkg|screen}} session you just enter:&lt;br /&gt;
{{cmd|screen}}&lt;br /&gt;
&lt;br /&gt;
== List existing sessions ==&lt;br /&gt;
When you have started some session(s) you can list them:&lt;br /&gt;
{{cmd|screen -list}}&lt;br /&gt;
You might get a list that looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
There are screens on:&lt;br /&gt;
        11151.pts-1.mhlab01     (Attached)&lt;br /&gt;
        11131.pts-3.mhlab01     (Attached)&lt;br /&gt;
2 Sockets in /var/run/screen/S-root.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Attach to a existing session ==&lt;br /&gt;
Lets say you want to attach to a existing session (e.g. the above &amp;lt;code&amp;gt;11131.pts-3.mhlab01&amp;lt;/code&amp;gt; session).&lt;br /&gt;
{{cmd|screen -x 11131}}&lt;br /&gt;
or&lt;br /&gt;
{{cmd|screen -x pts-3}}&lt;br /&gt;
{{tip|If you see &amp;lt;code&amp;gt;Attaching from inside of screen?&amp;lt;/code&amp;gt;, you are already inside a screen session.}}&lt;br /&gt;
&lt;br /&gt;
== Controlling a screen session ==&lt;br /&gt;
While inside a {{pkg|screen}} session, you can control it using keyboard shortcuts. We will only describe some of those alternatives.&lt;br /&gt;
&lt;br /&gt;
{{tip|To enter a keyboard shortcut that controls the current {{pkg|screen}} session, you should click {{key|A}} while holding down {{key|CTRL}}&amp;lt;br&amp;gt;In the below examples this procedure is described as &amp;lt;code&amp;gt;^A&amp;lt;/code&amp;gt;}}&lt;br /&gt;
=== Get help ===&lt;br /&gt;
One of the most useful commands is the one that gives you &#039;help&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
While in your {{pkg|screen}} session, click:&lt;br /&gt;
{{cmd|^A ?}}&lt;br /&gt;
&#039;&#039;(Do not press/hold {{key|CTRL}} when clicking {{key|?}})&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Detach from a session ===&lt;br /&gt;
Sometimes it&#039;s useful to just detach from a session without killing it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{cmd|^A d}}&lt;br /&gt;
{{tip|Try starting &amp;lt;code&amp;gt;ping 127.0.0.1&amp;lt;/code&amp;gt; while inside a screen session and then detach from the session.&amp;lt;br&amp;gt;After some while re-connect to the session using &amp;lt;code&amp;gt;screen -x&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;Note that the &amp;quot;seq&amp;quot; value indicates that ping had continued running while you where detached from the session.}}&lt;br /&gt;
&lt;br /&gt;
=== Close or kill a session ===&lt;br /&gt;
To &#039;kill&#039; a session:&lt;br /&gt;
{{cmd|^A k}}&lt;br /&gt;
Confirm by clicking {{key|y}} when prompted.&lt;br /&gt;
&lt;br /&gt;
You can also &#039;kill&#039; your session by entering:&lt;br /&gt;
{{cmd|exit}}&lt;br /&gt;
&lt;br /&gt;
= Extra =&lt;br /&gt;
== Connect to serial console ==&lt;br /&gt;
{{pkg|screen}} is a good tool when you need to connect to a serial console &#039;&#039;(e.g. if you want to configure a switch using it&#039;s serial port)&#039;&#039;. Connecting to a serial console could look like this:&lt;br /&gt;
{{cmd|screen /dev/ttyS0 9600}}&lt;br /&gt;
&lt;br /&gt;
== Force console users into a screen session ==&lt;br /&gt;
In some cases you might want to force only console users into a screen session.&amp;lt;BR&amp;gt;&lt;br /&gt;
Note that the this configuration will not force SSH-users into a screen.&amp;lt;BR&amp;gt;&lt;br /&gt;
Edit {{path|/etc/profile}} and add the following code to it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [ -n &amp;quot;$PS1&amp;quot; ] &amp;amp;&amp;amp; [ -z &amp;quot;$STARTED_SCREEN&amp;quot; ] &amp;amp;&amp;amp; [ -z &amp;quot;$SSH_TTY&amp;quot; ]; then&lt;br /&gt;
  STARTED_SCREEN=1 ; export STARTED_SCREEN&lt;br /&gt;
  screen -RR &amp;amp;&amp;amp; exit 0&lt;br /&gt;
  echo &amp;quot;Screen failed! continuing with normal bash startup&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Force console and SSH users into a screen session ==&lt;br /&gt;
The above example holds the if-statement:&lt;br /&gt;
 &amp;amp;&amp;amp; [ -z &amp;quot;$SSH_TTY&amp;quot; ]&lt;br /&gt;
Remove this part from above configuration to force SSH sessions into a screen session.&amp;lt;BR&amp;gt;&lt;br /&gt;
{{Note|Console users will also be forced into a screen session when folowing these instructions}}&lt;br /&gt;
&lt;br /&gt;
= Other terminal multiplexers =&lt;br /&gt;
A similar tool is {{pkg|tmux}} which is documented [[Tmux_terminal_multiplexer|here]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Shell]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Screen_on_console&amp;diff=8613</id>
		<title>Screen on console</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Screen_on_console&amp;diff=8613"/>
		<updated>2012-10-24T14:23:26Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Mhavela moved page Screen on console to Screen terminal multiplexer: The previous name could be misunderstood.
This new name specifies that this is a terminal multiplexer.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Screen terminal multiplexer]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Screen_terminal_multiplexer&amp;diff=8612</id>
		<title>Screen terminal multiplexer</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Screen_terminal_multiplexer&amp;diff=8612"/>
		<updated>2012-10-24T14:23:26Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Mhavela moved page Screen on console to Screen terminal multiplexer: The previous name could be misunderstood.
This new name specifies that this is a terminal multiplexer.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{pkg|screen}} is a terminal multiplexer. It&#039;s a good tool for e.g. remote support. It can also be used to start a command you want to keep running after you close your console session (you can later on attach to your running session). When you enter a {{pkg|screen}} session you will not notice too much.&amp;lt;BR&amp;gt;&lt;br /&gt;
To know if you are inside a {{pkg|screen}} session, use the notes in &#039;[[#Get_help|get help]]&#039; section mentioned below.&lt;br /&gt;
&lt;br /&gt;
= Install =&lt;br /&gt;
In order to use {{pkg|screen}} you will have to install it:&lt;br /&gt;
{{cmd|apk add screen}}&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
== Start a new session ==&lt;br /&gt;
To enter a {{pkg|screen}} session you just enter:&lt;br /&gt;
{{cmd|screen}}&lt;br /&gt;
&lt;br /&gt;
== List existing sessions ==&lt;br /&gt;
When you have started some session(s) you can list them:&lt;br /&gt;
{{cmd|screen -list}}&lt;br /&gt;
You might get a list that looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
There are screens on:&lt;br /&gt;
        11151.pts-1.mhlab01     (Attached)&lt;br /&gt;
        11131.pts-3.mhlab01     (Attached)&lt;br /&gt;
2 Sockets in /var/run/screen/S-root.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Attach to a existing session ==&lt;br /&gt;
Lets say you want to attach to a existing session (e.g. the above &amp;lt;code&amp;gt;11131.pts-3.mhlab01&amp;lt;/code&amp;gt; session).&lt;br /&gt;
{{cmd|screen -x 11131}}&lt;br /&gt;
or&lt;br /&gt;
{{cmd|screen -x pts-3}}&lt;br /&gt;
{{tip|If you see &amp;lt;code&amp;gt;Attaching from inside of screen?&amp;lt;/code&amp;gt;, you are already inside a screen session.}}&lt;br /&gt;
&lt;br /&gt;
== Controlling a screen session ==&lt;br /&gt;
While inside a {{pkg|screen}} session, you can control it using keyboard shortcuts. We will only describe some of those alternatives.&lt;br /&gt;
&lt;br /&gt;
{{tip|To enter a keyboard shortcut that controls the current {{pkg|screen}} session, you should click {{key|A}} while holding down {{key|CTRL}}&amp;lt;br&amp;gt;In the below examples this procedure is described as &amp;lt;code&amp;gt;^A&amp;lt;/code&amp;gt;}}&lt;br /&gt;
=== Get help ===&lt;br /&gt;
One of the most useful commands is the one that gives you &#039;help&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
While in your {{pkg|screen}} session, click:&lt;br /&gt;
{{cmd|^A ?}}&lt;br /&gt;
&#039;&#039;(Do not press/hold {{key|CTRL}} when clicking {{key|?}})&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Detach from a session ===&lt;br /&gt;
Sometimes it&#039;s useful to just detach from a session without killing it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{cmd|^A d}}&lt;br /&gt;
{{tip|Try starting &amp;lt;code&amp;gt;ping 127.0.0.1&amp;lt;/code&amp;gt; while inside a screen session and then detach from the session.&amp;lt;br&amp;gt;After some while re-connect to the session using &amp;lt;code&amp;gt;screen -x&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;Note that the &amp;quot;seq&amp;quot; value indicates that ping had continued running while you where detached from the session.}}&lt;br /&gt;
&lt;br /&gt;
=== Close or kill a session ===&lt;br /&gt;
To &#039;kill&#039; a session:&lt;br /&gt;
{{cmd|^A k}}&lt;br /&gt;
Confirm by clicking {{key|y}} when prompted.&lt;br /&gt;
&lt;br /&gt;
You can also &#039;kill&#039; you session by entering:&lt;br /&gt;
{{cmd|exit}}&lt;br /&gt;
&lt;br /&gt;
= Extra =&lt;br /&gt;
== Connect to serial console ==&lt;br /&gt;
{{pkg|screen}} is a good tool when you need to connect to a serial console &#039;&#039;(e.g. if you want to configure a switch using it&#039;s serial port)&#039;&#039;. Connecting to a serial console could look like this:&lt;br /&gt;
{{cmd|screen /dev/ttyS0 9600}}&lt;br /&gt;
&lt;br /&gt;
== Force console users into a screen session ==&lt;br /&gt;
In some cases you might want to force only console users into a screen session.&amp;lt;BR&amp;gt;&lt;br /&gt;
Note that the this configuration will not force SSH-users into a screen.&amp;lt;BR&amp;gt;&lt;br /&gt;
Edit {{path|/etc/profile}} and add the following code to it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [ -n &amp;quot;$PS1&amp;quot; ] &amp;amp;&amp;amp; [ -z &amp;quot;$STARTED_SCREEN&amp;quot; ] &amp;amp;&amp;amp; [ -z &amp;quot;$SSH_TTY&amp;quot; ]; then&lt;br /&gt;
  STARTED_SCREEN=1 ; export STARTED_SCREEN&lt;br /&gt;
  screen -RR &amp;amp;&amp;amp; exit 0&lt;br /&gt;
  echo &amp;quot;Screen failed! continuing with normal bash startup&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Force console and SSH users into a screen session ==&lt;br /&gt;
The above example holds the if-statement:&lt;br /&gt;
 &amp;amp;&amp;amp; [ -z &amp;quot;$SSH_TTY&amp;quot; ]&lt;br /&gt;
Remove this part from above configuration to force SSH sessions into a screen session.&amp;lt;BR&amp;gt;&lt;br /&gt;
{{Note|Console users will also be forced into a screen session when folowing these instructions}}&lt;br /&gt;
&lt;br /&gt;
= Other terminal multiplexers =&lt;br /&gt;
A similar tool is {{pkg|tmux}} which is documented [[Tmux_terminal_multiplexer|here]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Shell]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Screen_terminal_multiplexer&amp;diff=8611</id>
		<title>Screen terminal multiplexer</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Screen_terminal_multiplexer&amp;diff=8611"/>
		<updated>2012-10-24T14:11:00Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Fixed some typos and added link to tmux documentation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{pkg|screen}} is a terminal multiplexer. It&#039;s a good tool for e.g. remote support. It can also be used to start a command you want to keep running after you close your console session (you can later on attach to your running session). When you enter a {{pkg|screen}} session you will not notice too much.&amp;lt;BR&amp;gt;&lt;br /&gt;
To know if you are inside a {{pkg|screen}} session, use the notes in &#039;[[#Get_help|get help]]&#039; section mentioned below.&lt;br /&gt;
&lt;br /&gt;
= Install =&lt;br /&gt;
In order to use {{pkg|screen}} you will have to install it:&lt;br /&gt;
{{cmd|apk add screen}}&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
== Start a new session ==&lt;br /&gt;
To enter a {{pkg|screen}} session you just enter:&lt;br /&gt;
{{cmd|screen}}&lt;br /&gt;
&lt;br /&gt;
== List existing sessions ==&lt;br /&gt;
When you have started some session(s) you can list them:&lt;br /&gt;
{{cmd|screen -list}}&lt;br /&gt;
You might get a list that looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
There are screens on:&lt;br /&gt;
        11151.pts-1.mhlab01     (Attached)&lt;br /&gt;
        11131.pts-3.mhlab01     (Attached)&lt;br /&gt;
2 Sockets in /var/run/screen/S-root.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Attach to a existing session ==&lt;br /&gt;
Lets say you want to attach to a existing session (e.g. the above &amp;lt;code&amp;gt;11131.pts-3.mhlab01&amp;lt;/code&amp;gt; session).&lt;br /&gt;
{{cmd|screen -x 11131}}&lt;br /&gt;
or&lt;br /&gt;
{{cmd|screen -x pts-3}}&lt;br /&gt;
{{tip|If you see &amp;lt;code&amp;gt;Attaching from inside of screen?&amp;lt;/code&amp;gt;, you are already inside a screen session.}}&lt;br /&gt;
&lt;br /&gt;
== Controlling a screen session ==&lt;br /&gt;
While inside a {{pkg|screen}} session, you can control it using keyboard shortcuts. We will only describe some of those alternatives.&lt;br /&gt;
&lt;br /&gt;
{{tip|To enter a keyboard shortcut that controls the current {{pkg|screen}} session, you should click {{key|A}} while holding down {{key|CTRL}}&amp;lt;br&amp;gt;In the below examples this procedure is described as &amp;lt;code&amp;gt;^A&amp;lt;/code&amp;gt;}}&lt;br /&gt;
=== Get help ===&lt;br /&gt;
One of the most useful commands is the one that gives you &#039;help&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
While in your {{pkg|screen}} session, click:&lt;br /&gt;
{{cmd|^A ?}}&lt;br /&gt;
&#039;&#039;(Do not press/hold {{key|CTRL}} when clicking {{key|?}})&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Detach from a session ===&lt;br /&gt;
Sometimes it&#039;s useful to just detach from a session without killing it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{cmd|^A d}}&lt;br /&gt;
{{tip|Try starting &amp;lt;code&amp;gt;ping 127.0.0.1&amp;lt;/code&amp;gt; while inside a screen session and then detach from the session.&amp;lt;br&amp;gt;After some while re-connect to the session using &amp;lt;code&amp;gt;screen -x&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;Note that the &amp;quot;seq&amp;quot; value indicates that ping had continued running while you where detached from the session.}}&lt;br /&gt;
&lt;br /&gt;
=== Close or kill a session ===&lt;br /&gt;
To &#039;kill&#039; a session:&lt;br /&gt;
{{cmd|^A k}}&lt;br /&gt;
Confirm by clicking {{key|y}} when prompted.&lt;br /&gt;
&lt;br /&gt;
You can also &#039;kill&#039; you session by entering:&lt;br /&gt;
{{cmd|exit}}&lt;br /&gt;
&lt;br /&gt;
= Extra =&lt;br /&gt;
== Connect to serial console ==&lt;br /&gt;
{{pkg|screen}} is a good tool when you need to connect to a serial console &#039;&#039;(e.g. if you want to configure a switch using it&#039;s serial port)&#039;&#039;. Connecting to a serial console could look like this:&lt;br /&gt;
{{cmd|screen /dev/ttyS0 9600}}&lt;br /&gt;
&lt;br /&gt;
== Force console users into a screen session ==&lt;br /&gt;
In some cases you might want to force only console users into a screen session.&amp;lt;BR&amp;gt;&lt;br /&gt;
Note that the this configuration will not force SSH-users into a screen.&amp;lt;BR&amp;gt;&lt;br /&gt;
Edit {{path|/etc/profile}} and add the following code to it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [ -n &amp;quot;$PS1&amp;quot; ] &amp;amp;&amp;amp; [ -z &amp;quot;$STARTED_SCREEN&amp;quot; ] &amp;amp;&amp;amp; [ -z &amp;quot;$SSH_TTY&amp;quot; ]; then&lt;br /&gt;
  STARTED_SCREEN=1 ; export STARTED_SCREEN&lt;br /&gt;
  screen -RR &amp;amp;&amp;amp; exit 0&lt;br /&gt;
  echo &amp;quot;Screen failed! continuing with normal bash startup&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Force console and SSH users into a screen session ==&lt;br /&gt;
The above example holds the if-statement:&lt;br /&gt;
 &amp;amp;&amp;amp; [ -z &amp;quot;$SSH_TTY&amp;quot; ]&lt;br /&gt;
Remove this part from above configuration to force SSH sessions into a screen session.&amp;lt;BR&amp;gt;&lt;br /&gt;
{{Note|Console users will also be forced into a screen session when folowing these instructions}}&lt;br /&gt;
&lt;br /&gt;
= Other terminal multiplexers =&lt;br /&gt;
A similar tool is {{pkg|tmux}} which is documented [[Tmux_terminal_multiplexer|here]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Shell]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Tmux&amp;diff=8610</id>
		<title>Tmux</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Tmux&amp;diff=8610"/>
		<updated>2012-10-24T14:04:32Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: tmux as a alternative to GNU Screen&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{pkg|tmux}} is a terminal multiplexer. It&#039;s a good tool for e.g. remote support. It can also be used to start a command you want to keep running after you close your console session (you can later on attach to your running session).&lt;br /&gt;
&lt;br /&gt;
= Install =&lt;br /&gt;
In order to use {{pkg|tmux}} you will have to install it:&lt;br /&gt;
{{cmd|apk add tmux}}&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
== Start a new session ==&lt;br /&gt;
To create a {{pkg|tmux}} session you just enter:&lt;br /&gt;
{{cmd|tmux}}&lt;br /&gt;
&lt;br /&gt;
== List existing sessions ==&lt;br /&gt;
When you have started some session(s) you can list them:&lt;br /&gt;
{{cmd|tmux ls}}&lt;br /&gt;
{{tip|Above command can also be run as &amp;lt;code&amp;gt;tmux list-sessions&amp;lt;/code&amp;gt;}}&lt;br /&gt;
You might get a list that looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: 1 windows (created Wed Oct 24 15:12:12 2012) [126x35]&lt;br /&gt;
1: 1 windows (created Wed Oct 24 15:14:44 2012) [126x35]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Attach to a existing session ==&lt;br /&gt;
Lets say you want to attach to a existing session (e.g. the above &amp;lt;code&amp;gt;1: 1 windows&amp;lt;/code&amp;gt; session).&lt;br /&gt;
{{cmd|tmux attach -t 1}}&lt;br /&gt;
{{tip|If you only have one session you don&#039;t need to specify session. Just run &amp;lt;code&amp;gt;tmux attach&amp;lt;/code&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== Controlling a session ==&lt;br /&gt;
While inside a {{pkg|tmux}} session, you can control it using keyboard shortcuts. We will only describe some of those alternatives.&lt;br /&gt;
&lt;br /&gt;
{{tip|To enter a keyboard shortcut that controls the current {{pkg|tmux}} session, you should click {{key|B}} while holding down {{key|CTRL}}&amp;lt;br&amp;gt;In the below examples this procedure is described as &amp;lt;code&amp;gt;C-b&amp;lt;/code&amp;gt;}}&lt;br /&gt;
=== Get help ===&lt;br /&gt;
One of the most useful commands is the one that gives you &#039;help&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
While in your {{pkg|tmux}} session, click:&lt;br /&gt;
{{cmd|C-b ?}}&lt;br /&gt;
&#039;&#039;(Do not press/hold {{key|CTRL}} when clicking {{key|?}})&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Detach from a session ===&lt;br /&gt;
Sometimes it&#039;s useful to just detach from a session without killing it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{cmd|C-b d}}&lt;br /&gt;
{{tip|Try starting &amp;lt;code&amp;gt;ping 127.0.0.1&amp;lt;/code&amp;gt; while inside a session and then detach from the session.&amp;lt;br&amp;gt;After some while re-connect to the session using &amp;lt;code&amp;gt;tmux attach&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;Note that the &amp;quot;seq&amp;quot; value indicates that ping had continued running while you where detached from the session.}}&lt;br /&gt;
&lt;br /&gt;
=== Close or kill a session ===&lt;br /&gt;
To &#039;kill&#039; a session:&lt;br /&gt;
{{cmd|C-b k}}&lt;br /&gt;
&lt;br /&gt;
You can also &#039;kill&#039; your session by entering:&lt;br /&gt;
{{cmd|exit}}&lt;br /&gt;
&lt;br /&gt;
= Other terminal multiplexers =&lt;br /&gt;
A similar tool is {{pkg|screen}} which is documented [[Screen_on_console|here]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Shell]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Screen_terminal_multiplexer&amp;diff=8609</id>
		<title>Screen terminal multiplexer</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Screen_terminal_multiplexer&amp;diff=8609"/>
		<updated>2012-10-24T13:03:15Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: /* Extra */ Serial port using screen&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{pkg|screen}} is a good tool for remote support. It can also be used to start a command you want to keep running after you close your console session (you can later on attach to your running {{pkg|screen}} session). When you enter a {{pkg|screen}} session you will not notice too much.&amp;lt;BR&amp;gt;&lt;br /&gt;
To know if you are inside a {{pkg|screen}} session, use the notes in &#039;[[#Get_help|get help]]&#039; section mentioned below.&lt;br /&gt;
&lt;br /&gt;
= Install =&lt;br /&gt;
In order to use {{pkg|screen}} you will have to install it:&lt;br /&gt;
{{cmd|apk add screen}}&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
== Start a new session ==&lt;br /&gt;
To enter a {{pkg|screen}} session you just enter:&lt;br /&gt;
{{cmd|screen}}&lt;br /&gt;
&lt;br /&gt;
== List existing sessions ==&lt;br /&gt;
When you have started some session(s) you can list them:&lt;br /&gt;
{{cmd|screen -list}}&lt;br /&gt;
You might get a list that looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
There are screens on:&lt;br /&gt;
        11151.pts-1.mhlab01     (Attached)&lt;br /&gt;
        11131.pts-3.mhlab01     (Attached)&lt;br /&gt;
2 Sockets in /var/run/screen/S-root.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Attach to a existing session ==&lt;br /&gt;
Lets say you want to attach to a existing session (e.g. the above &amp;lt;code&amp;gt;11131.pts-3.mhlab01&amp;lt;/code&amp;gt; session).&lt;br /&gt;
{{cmd|screen -x 11131}}&lt;br /&gt;
or&lt;br /&gt;
{{cmd|screen -x pts-3}}&lt;br /&gt;
{{tip|If you see &amp;lt;code&amp;gt;Attaching from inside of screen?&amp;lt;/code&amp;gt;, you are allready inside a screen session.}}&lt;br /&gt;
&lt;br /&gt;
== Controlling a screen session ==&lt;br /&gt;
While inside a {{pkg|screen}} session, you can controll it using keyboard shortcuts. We will only describe some of those alternatives.&lt;br /&gt;
&lt;br /&gt;
{{tip|To enter a keyboard shortcut that controls the current {{pkg|screen}} session, you should click {{key|A}} while holding down {{key|CTRL}}&amp;lt;br&amp;gt;In the below examples this procedure is described as &amp;lt;code&amp;gt;^A&amp;lt;/code&amp;gt;}}&lt;br /&gt;
=== Get help ===&lt;br /&gt;
One of the most useful commands is the one that gives you &#039;help&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
While in your {{pkg|screen}} session, click:&lt;br /&gt;
{{cmd|^A ?}}&lt;br /&gt;
&#039;&#039;(Do not press/hold {{key|CTRL}} when clicking {{key|?}})&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Detach from a session ===&lt;br /&gt;
Sometimes it&#039;s useful to just detach from a session without killing it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{cmd|^A d}}&lt;br /&gt;
{{tip|Try starting &amp;lt;code&amp;gt;ping 127.0.0.1&amp;lt;/code&amp;gt; while inside a screen session and then detatch from the session.&amp;lt;br&amp;gt;After some while re-connect to the session using &amp;lt;code&amp;gt;screen -x&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;Note that the &amp;quot;seq&amp;quot; value indikates that ping had continued running while you where detatched from the session.}}&lt;br /&gt;
&lt;br /&gt;
=== Close or kill a session ===&lt;br /&gt;
To &#039;kill&#039; a session:&lt;br /&gt;
{{cmd|^A k}}&lt;br /&gt;
Confirm by clicking {{key|y}} when prompted.&lt;br /&gt;
&lt;br /&gt;
You can also &#039;kill&#039; you session by entering:&lt;br /&gt;
{{cmd|exit}}&lt;br /&gt;
&lt;br /&gt;
= Extra =&lt;br /&gt;
== Connect to serial console ==&lt;br /&gt;
{{pkg|screen}} is a good tool when you need to connect to a serial console &#039;&#039;(e.g. if you want to configure a switch using it&#039;s serial port)&#039;&#039;. Connecting to a serial console could look like this:&lt;br /&gt;
{{cmd|screen /dev/ttyS0 9600}}&lt;br /&gt;
&lt;br /&gt;
== Force console users into a screen session ==&lt;br /&gt;
In some cases you might want to force only console users into a screen session.&amp;lt;BR&amp;gt;&lt;br /&gt;
Note that the this configuration will not force SSH-users into a screen.&amp;lt;BR&amp;gt;&lt;br /&gt;
Edit {{path|/etc/profile}} and add the following code to it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [ -n &amp;quot;$PS1&amp;quot; ] &amp;amp;&amp;amp; [ -z &amp;quot;$STARTED_SCREEN&amp;quot; ] &amp;amp;&amp;amp; [ -z &amp;quot;$SSH_TTY&amp;quot; ]; then&lt;br /&gt;
  STARTED_SCREEN=1 ; export STARTED_SCREEN&lt;br /&gt;
  screen -RR &amp;amp;&amp;amp; exit 0&lt;br /&gt;
  echo &amp;quot;Screen failed! continuing with normal bash startup&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Force console and SSH users into a screen session ==&lt;br /&gt;
The above example holds the if-statement:&lt;br /&gt;
 &amp;amp;&amp;amp; [ -z &amp;quot;$SSH_TTY&amp;quot; ]&lt;br /&gt;
Remove this part from above configuration to force SSH sessions into a screen session.&amp;lt;BR&amp;gt;&lt;br /&gt;
{{Note|Console users will also be forced into a screen session when folowing these instructions}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Shell]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Screen_terminal_multiplexer&amp;diff=8606</id>
		<title>Screen terminal multiplexer</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Screen_terminal_multiplexer&amp;diff=8606"/>
		<updated>2012-10-24T10:06:24Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: /* General */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{pkg|screen}} is a good tool for remote support. It can also be used to start a command you want to keep running after you close your console session (you can later on attach to your running {{pkg|screen}} session). When you enter a {{pkg|screen}} session you will not notice too much.&amp;lt;BR&amp;gt;&lt;br /&gt;
To know if you are inside a {{pkg|screen}} session, use the notes in &#039;[[#Get_help|get help]]&#039; section mentioned below.&lt;br /&gt;
&lt;br /&gt;
= Install =&lt;br /&gt;
In order to use {{pkg|screen}} you will have to install it:&lt;br /&gt;
{{cmd|apk add screen}}&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
== Start a new session ==&lt;br /&gt;
To enter a {{pkg|screen}} session you just enter:&lt;br /&gt;
{{cmd|screen}}&lt;br /&gt;
&lt;br /&gt;
== List existing sessions ==&lt;br /&gt;
When you have started some session(s) you can list them:&lt;br /&gt;
{{cmd|screen -list}}&lt;br /&gt;
You might get a list that looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
There are screens on:&lt;br /&gt;
        11151.pts-1.mhlab01     (Attached)&lt;br /&gt;
        11131.pts-3.mhlab01     (Attached)&lt;br /&gt;
2 Sockets in /var/run/screen/S-root.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Attach to a existing session ==&lt;br /&gt;
Lets say you want to attach to a existing session (e.g. the above &amp;lt;code&amp;gt;11131.pts-3.mhlab01&amp;lt;/code&amp;gt; session).&lt;br /&gt;
{{cmd|screen -x 11131}}&lt;br /&gt;
or&lt;br /&gt;
{{cmd|screen -x pts-3}}&lt;br /&gt;
{{tip|If you see &amp;lt;code&amp;gt;Attaching from inside of screen?&amp;lt;/code&amp;gt;, you are allready inside a screen session.}}&lt;br /&gt;
&lt;br /&gt;
== Controlling a screen session ==&lt;br /&gt;
While inside a {{pkg|screen}} session, you can controll it using keyboard shortcuts. We will only describe some of those alternatives.&lt;br /&gt;
&lt;br /&gt;
{{tip|To enter a keyboard shortcut that controls the current {{pkg|screen}} session, you should click {{key|A}} while holding down {{key|CTRL}}&amp;lt;br&amp;gt;In the below examples this procedure is described as &amp;lt;code&amp;gt;^A&amp;lt;/code&amp;gt;}}&lt;br /&gt;
=== Get help ===&lt;br /&gt;
One of the most useful commands is the one that gives you &#039;help&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
While in your {{pkg|screen}} session, click:&lt;br /&gt;
{{cmd|^A ?}}&lt;br /&gt;
&#039;&#039;(Do not press/hold {{key|CTRL}} when clicking {{key|?}})&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Detach from a session ===&lt;br /&gt;
Sometimes it&#039;s useful to just detach from a session without killing it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{cmd|^A d}}&lt;br /&gt;
{{tip|Try starting &amp;lt;code&amp;gt;ping 127.0.0.1&amp;lt;/code&amp;gt; while inside a screen session and then detatch from the session.&amp;lt;br&amp;gt;After some while re-connect to the session using &amp;lt;code&amp;gt;screen -x&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;Note that the &amp;quot;seq&amp;quot; value indikates that ping had continued running while you where detatched from the session.}}&lt;br /&gt;
&lt;br /&gt;
=== Close or kill a session ===&lt;br /&gt;
To &#039;kill&#039; a session:&lt;br /&gt;
{{cmd|^A k}}&lt;br /&gt;
Confirm by clicking {{key|y}} when prompted.&lt;br /&gt;
&lt;br /&gt;
You can also &#039;kill&#039; you session by entering:&lt;br /&gt;
{{cmd|exit}}&lt;br /&gt;
&lt;br /&gt;
= Extra =&lt;br /&gt;
== Force console users into a screen session ==&lt;br /&gt;
In some cases you might want to force only console users into a screen session.&amp;lt;BR&amp;gt;&lt;br /&gt;
Note that the this configuration will not force SSH-users into a screen.&amp;lt;BR&amp;gt;&lt;br /&gt;
Edit {{path|/etc/profile}} and add the following code to it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [ -n &amp;quot;$PS1&amp;quot; ] &amp;amp;&amp;amp; [ -z &amp;quot;$STARTED_SCREEN&amp;quot; ] &amp;amp;&amp;amp; [ -z &amp;quot;$SSH_TTY&amp;quot; ]; then&lt;br /&gt;
  STARTED_SCREEN=1 ; export STARTED_SCREEN&lt;br /&gt;
  screen -RR &amp;amp;&amp;amp; exit 0&lt;br /&gt;
  echo &amp;quot;Screen failed! continuing with normal bash startup&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Force console and SSH users into a screen session ==&lt;br /&gt;
The above example holds the if-statement:&lt;br /&gt;
 &amp;amp;&amp;amp; [ -z &amp;quot;$SSH_TTY&amp;quot; ]&lt;br /&gt;
Remove this part from above configuration to force SSH sessions into a screen session.&amp;lt;BR&amp;gt;&lt;br /&gt;
{{Note|Console users will also be forced into a screen session when folowing these instructions}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Shell]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Screen_terminal_multiplexer&amp;diff=8605</id>
		<title>Screen terminal multiplexer</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Screen_terminal_multiplexer&amp;diff=8605"/>
		<updated>2012-10-24T10:05:49Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Restructuring a bit. Adding some notes and examples that indicates how screen can be used&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{pkg|screen}} is a good tool for remote support. It can also be used to start a command you want to keep running after you close your console session (you can later on attach to your running {{pkg|screen}} session). When you enter a {{pkg|screen}} session you will not notice too much.&amp;lt;BR&amp;gt;&lt;br /&gt;
To know if you are inside a {{pkg|screen}} session, use the notes in &#039;[[#Get_help|get help]]&#039; section mentioned below.&lt;br /&gt;
&lt;br /&gt;
= General =&lt;br /&gt;
== Install ==&lt;br /&gt;
In order to use {{pkg|screen}} you will have to install it:&lt;br /&gt;
{{cmd|apk add screen}}&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
== Start a new session ==&lt;br /&gt;
To enter a {{pkg|screen}} session you just enter:&lt;br /&gt;
{{cmd|screen}}&lt;br /&gt;
&lt;br /&gt;
== List existing sessions ==&lt;br /&gt;
When you have started some session(s) you can list them:&lt;br /&gt;
{{cmd|screen -list}}&lt;br /&gt;
You might get a list that looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
There are screens on:&lt;br /&gt;
        11151.pts-1.mhlab01     (Attached)&lt;br /&gt;
        11131.pts-3.mhlab01     (Attached)&lt;br /&gt;
2 Sockets in /var/run/screen/S-root.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Attach to a existing session ==&lt;br /&gt;
Lets say you want to attach to a existing session (e.g. the above &amp;lt;code&amp;gt;11131.pts-3.mhlab01&amp;lt;/code&amp;gt; session).&lt;br /&gt;
{{cmd|screen -x 11131}}&lt;br /&gt;
or&lt;br /&gt;
{{cmd|screen -x pts-3}}&lt;br /&gt;
{{tip|If you see &amp;lt;code&amp;gt;Attaching from inside of screen?&amp;lt;/code&amp;gt;, you are allready inside a screen session.}}&lt;br /&gt;
&lt;br /&gt;
== Controlling a screen session ==&lt;br /&gt;
While inside a {{pkg|screen}} session, you can controll it using keyboard shortcuts. We will only describe some of those alternatives.&lt;br /&gt;
&lt;br /&gt;
{{tip|To enter a keyboard shortcut that controls the current {{pkg|screen}} session, you should click {{key|A}} while holding down {{key|CTRL}}&amp;lt;br&amp;gt;In the below examples this procedure is described as &amp;lt;code&amp;gt;^A&amp;lt;/code&amp;gt;}}&lt;br /&gt;
=== Get help ===&lt;br /&gt;
One of the most useful commands is the one that gives you &#039;help&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
While in your {{pkg|screen}} session, click:&lt;br /&gt;
{{cmd|^A ?}}&lt;br /&gt;
&#039;&#039;(Do not press/hold {{key|CTRL}} when clicking {{key|?}})&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Detach from a session ===&lt;br /&gt;
Sometimes it&#039;s useful to just detach from a session without killing it.&amp;lt;br&amp;gt;&lt;br /&gt;
{{cmd|^A d}}&lt;br /&gt;
{{tip|Try starting &amp;lt;code&amp;gt;ping 127.0.0.1&amp;lt;/code&amp;gt; while inside a screen session and then detatch from the session.&amp;lt;br&amp;gt;After some while re-connect to the session using &amp;lt;code&amp;gt;screen -x&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;Note that the &amp;quot;seq&amp;quot; value indikates that ping had continued running while you where detatched from the session.}}&lt;br /&gt;
&lt;br /&gt;
=== Close or kill a session ===&lt;br /&gt;
To &#039;kill&#039; a session:&lt;br /&gt;
{{cmd|^A k}}&lt;br /&gt;
Confirm by clicking {{key|y}} when prompted.&lt;br /&gt;
&lt;br /&gt;
You can also &#039;kill&#039; you session by entering:&lt;br /&gt;
{{cmd|exit}}&lt;br /&gt;
&lt;br /&gt;
= Extra =&lt;br /&gt;
== Force console users into a screen session ==&lt;br /&gt;
In some cases you might want to force only console users into a screen session.&amp;lt;BR&amp;gt;&lt;br /&gt;
Note that the this configuration will not force SSH-users into a screen.&amp;lt;BR&amp;gt;&lt;br /&gt;
Edit {{path|/etc/profile}} and add the following code to it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [ -n &amp;quot;$PS1&amp;quot; ] &amp;amp;&amp;amp; [ -z &amp;quot;$STARTED_SCREEN&amp;quot; ] &amp;amp;&amp;amp; [ -z &amp;quot;$SSH_TTY&amp;quot; ]; then&lt;br /&gt;
  STARTED_SCREEN=1 ; export STARTED_SCREEN&lt;br /&gt;
  screen -RR &amp;amp;&amp;amp; exit 0&lt;br /&gt;
  echo &amp;quot;Screen failed! continuing with normal bash startup&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Force console and SSH users into a screen session ==&lt;br /&gt;
The above example holds the if-statement:&lt;br /&gt;
 &amp;amp;&amp;amp; [ -z &amp;quot;$SSH_TTY&amp;quot; ]&lt;br /&gt;
Remove this part from above configuration to force SSH sessions into a screen session.&amp;lt;BR&amp;gt;&lt;br /&gt;
{{Note|Console users will also be forced into a screen session when folowing these instructions}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Shell]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Alpine_Linux:IRC&amp;diff=8604</id>
		<title>Alpine Linux:IRC</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Alpine_Linux:IRC&amp;diff=8604"/>
		<updated>2012-10-24T08:59:22Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: /* Clients */ Added som chat client suggestions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Alpine Linux have registered the following channels on [http://freenode.net/ FreeNode]:&lt;br /&gt;
;[irc://irc.freenode.net/alpine-linux #alpine-linux]&lt;br /&gt;
: For general discussion and quick support questions.&lt;br /&gt;
;[irc://irc.freenode.net/alpine-devel #alpine-devel]&lt;br /&gt;
: For disussion of Alpine Linux development and developer support.&lt;br /&gt;
&lt;br /&gt;
Please be patient when asking questions there. Might take a while for someone to answer.&lt;br /&gt;
&lt;br /&gt;
If you are new to IRC and would like to try it out, you can use [http://webchat.freenode.net/ Freenode webchat]. Make sure you use one of the above channels.&lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
There are several clients available to join the IRC network. Please install one and get by.&lt;br /&gt;
&lt;br /&gt;
* irssi&lt;br /&gt;
* weechat&lt;br /&gt;
* xchat&lt;br /&gt;
* ircii&lt;br /&gt;
* pidgin&lt;br /&gt;
* &#039;&#039;other...&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Alpine_Linux:FAQ&amp;diff=8603</id>
		<title>Alpine Linux:FAQ</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Alpine_Linux:FAQ&amp;diff=8603"/>
		<updated>2012-10-24T08:45:04Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Removing obsolete packages&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To get oriented and learn what makes our distribution distinctive, see the [http://alpinelinux.org/about About page] or [[Alpine Linux:Overview|our more detailed overview]].&lt;br /&gt;
&lt;br /&gt;
[[Image:filetypes.svg|64px|left|link=]]&lt;br /&gt;
This is a list of &#039;&#039;&#039;frequently asked questions&#039;&#039;&#039; about Alpine Linux.&amp;lt;br&amp;gt;&lt;br /&gt;
If your question is not answered on this page, use the search box above to find work in progress pages not linked here, or in case of no answer, edit this page and write down your question.&lt;br /&gt;
{{Tip| Prepare your question. Think it through. Make it simple and understandable.}} &lt;br /&gt;
&lt;br /&gt;
=General=&lt;br /&gt;
&lt;br /&gt;
== I have found a bug, where can I report it? ==&lt;br /&gt;
You can report it on the [http://bugs.alpinelinux.org/ bugtracker].&lt;br /&gt;
&lt;br /&gt;
== Are there any details about the releases available? ==&lt;br /&gt;
Yes, please check the [[Alpine Linux:Releases|Releases]] page.&lt;br /&gt;
&lt;br /&gt;
== Alpine freezes during boot from Compact Flash, how can I fix? ==&lt;br /&gt;
Most Compact Flash card readers do not support proper DMA.&amp;lt;br&amp;gt;&lt;br /&gt;
You should append &#039;&#039;&#039;nodma&#039;&#039;&#039; to the &#039;&#039;append&#039;&#039; line in {{path|syslinux.cfg}}.&lt;br /&gt;
&lt;br /&gt;
== How can I contribute? ==&lt;br /&gt;
You can contribute by:&lt;br /&gt;
* using the software and giving feedback&lt;br /&gt;
* by documenting your [http://www.alpinelinux.org Alpine Linux] experiences on this [[Main_Page|wiki]]&lt;br /&gt;
* in many other ways&lt;br /&gt;
Please visit [[Contribute|Contribute page]] to read more about this topic.&lt;br /&gt;
&lt;br /&gt;
Your contributions are highly appreciated.&lt;br /&gt;
&lt;br /&gt;
== How do I remove the CDROM? ==&lt;br /&gt;
Since the modloop loopback device is on CDROM you cannot just run &#039;&#039;eject&#039;&#039;. You need to unmount the modloop first.&amp;lt;br&amp;gt;&lt;br /&gt;
Unmounting both the modloop and the cdrom in one step can be done by executing:&lt;br /&gt;
{{cmd|/etc/init.d/modloop stop}}&lt;br /&gt;
&lt;br /&gt;
Then it&#039;s possible to eject the cdrom:&lt;br /&gt;
{{cmd|eject}}&lt;br /&gt;
&lt;br /&gt;
== Why don&#039;t I have man pages or where is the &#039;man&#039; command? ==&lt;br /&gt;
The {{pkg|man}} command and man pages are not installed by default.&lt;br /&gt;
&lt;br /&gt;
* First, install the {{pkg|man}} package:&lt;br /&gt;
: {{Cmd|apk add man}}&lt;br /&gt;
* Once that&#039;s done, install the documentation for the packages that you require man pages for:&amp;lt;br /&amp;gt;(Keep in mind, however, it&#039;s possible that not all packages will have a corresponding documentation package.)&lt;br /&gt;
: {{Cmd|apk add &amp;lt;pkg&amp;gt;-doc}}&lt;br /&gt;
: For example, say you installed {{pkg|iptables}} and you now require its {{pkg|man}} pages:&lt;br /&gt;
: {{Cmd|apk add iptables-doc}}&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
In our example above, we installed the man pages (and other documentation) for iptables. We can now read it:&lt;br /&gt;
{{Cmd|man iptables}}&lt;br /&gt;
&lt;br /&gt;
==Booting Alpine on an HP ML350 G6==&lt;br /&gt;
{{Note|This &#039;Booting Alpine on an HP ML350 G6&#039; section, only applies to [http://www.alpinelinux.org/ Alpine Linux] 1.9.3 and earlier.}}&lt;br /&gt;
[http://bugs.alpinelinux.org/issues/228 Ticket 228] on [http://bugs.alpinelinux.org/ bugs.alpinelinux.org] includes a patch that disables the kernel module hpwdt by default.&lt;br /&gt;
&lt;br /&gt;
Details: Kernel module for HP Watchdog Timer causes issues during boot.  Solution is to create an overlay (ie {{path|hpwdt.apkovl.tar.gz}}) containing {{path|/etc/modprobe.d/hpwdt}} (which contains &amp;quot;blacklist hpwdt&amp;quot;), place that on some removable media (ie USB key) and insert that during boot process.  This will insure that the offending module doesn&#039;t load and that the server will boot properly.&lt;br /&gt;
&lt;br /&gt;
==My cron jobs don&#039;t run?==&lt;br /&gt;
The cron daemon is started automatically on system boot and executes the scripts placed in the folders under {{path|/etc/periodic}} - there&#039;s a {{path|15min}} folder, plus ones for {{path|hourly}}, {{path|daily}}, {{path|weekly}} and {{path|monthly}} scripts.&lt;br /&gt;
&lt;br /&gt;
You can check whether your scripts are likely to run using the command:&lt;br /&gt;
&lt;br /&gt;
: {{cmd|run-parts -t /etc/periodic/[foldername]}} - for example: &#039;&#039;run-parts -t /etc/periodic/15min&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This command will tell you what should run but will not actually execute the scripts.&lt;br /&gt;
&lt;br /&gt;
If the results of the test are not as expected, check the following:&lt;br /&gt;
&lt;br /&gt;
* Make sure the script is executable - if unsure, issue the command : {{cmd|chmod a+x [scriptname]}}&lt;br /&gt;
* Make sure the first line of your script is :&amp;lt;pre&amp;gt;#!/bin/sh&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Do not put file extensions on your script names - this stops them from working; for example: {{path|myscript}}  will run, but {{path|myscript.sh}} won&#039;t&lt;br /&gt;
&lt;br /&gt;
== What is the difference between edge and stable releases? ==&lt;br /&gt;
Stable releases are just what they sound like: initially a point-in-time snapshot of the package archives, but then maintained with bugfixes only in order to keep a stable environment.&lt;br /&gt;
&lt;br /&gt;
[[Edge]] is more of a rolling-release, with the latest and greatest packages available in the online repositories.&amp;lt;br&amp;gt;&lt;br /&gt;
Occasionally, snapshot ISO images of the then-current state of [[edge]] are made and are available for download.&amp;lt;br&amp;gt;&lt;br /&gt;
Typically these are made when there are major kernel upgrades or package upgrades that require initramfs rebuilds.&lt;br /&gt;
&lt;br /&gt;
== What kind of release of Alpine Linux are available? ==&lt;br /&gt;
Please check the [[Alpine_Linux:Releases|Releases]] page for more information.&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== What is the difference between &#039;sys&#039;, &#039;data&#039;, and &#039;diskless&#039; installs when running setup-alpine (or setup-disk)? ==&lt;br /&gt;
&#039;&#039;&#039;sys:&#039;&#039;&#039; This mode is a traditional disk install. The following partitions will be created on the disk: /boot, / (filesystem root) and swap.&amp;lt;br&amp;gt;&lt;br /&gt;
This mode may be used for development boxes, desktops, virtual servers, etc.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;data:&#039;&#039;&#039; This mode uses your disk(s) for data storage, not for the operating system.  The system itself will run from tmpfs (RAM).  &lt;br /&gt;
&lt;br /&gt;
Use this mode if you only want to use the disk(s) for a mailspool, databases, logs, etc.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;diskless:&#039;&#039;&#039; No disks are to be used.  [[Alpine local backup]] may still be used in this mode.&lt;br /&gt;
&lt;br /&gt;
== How can I install a custom firmware in a diskless system? ==&lt;br /&gt;
&lt;br /&gt;
The modules and firmware are both special images which are mounted as read-only.&amp;lt;br&amp;gt;&lt;br /&gt;
To fix this issue you can copy the firmware directory to your writeable media (cf/usb) and copy your custom firmware to it.&amp;lt;br&amp;gt;&lt;br /&gt;
After reboot Alpine should automatically use the directory on your local storage instead of the loopback device.&lt;br /&gt;
&lt;br /&gt;
=Audio=&lt;br /&gt;
&lt;br /&gt;
== How do I play my .ogg/.mp3 files? ==&lt;br /&gt;
First, the sound card should be recognized (you must have {{path|/dev/snd/*****}} files)&lt;br /&gt;
&lt;br /&gt;
{{pkg|sox}}, {{pkg|mpg123}}, etc all use the oss sound driver, while Alpine uses ALSA drivers.&amp;lt;br&amp;gt;&lt;br /&gt;
So you need to load the snd-pcm-oss compatibility module.&amp;lt;br&amp;gt;&lt;br /&gt;
While you&#039;re at it, you might need {{pkg|aumix}} to turn up the sound volume&lt;br /&gt;
{{cmd|echo snd-pcm-oss &amp;gt;&amp;gt; /etc/modules&lt;br /&gt;
modprobe snd-pcm-oss &lt;br /&gt;
apk_add aumix sox&lt;br /&gt;
aumix (set volume settings)&lt;br /&gt;
play really_cool_song.mp3}}&lt;br /&gt;
&lt;br /&gt;
= Time and timezones =&lt;br /&gt;
&lt;br /&gt;
== How do I set the local timezone? ==&lt;br /&gt;
&lt;br /&gt;
Starting in Alpine 2.2, setting the timezone can be done through the [[Setup-alpine|setup-alpine]] script, and no manual settings should be necessary.&amp;lt;br&amp;gt;&lt;br /&gt;
If you wish to edit the timezone after installation, run the [[Alpine_setup_scripts|setup-timezone]] script.&lt;br /&gt;
&lt;br /&gt;
However, if you are using a previous version, please use the following steps:&lt;br /&gt;
&lt;br /&gt;
 /etc/timezone and the whole zoneinfo directory tree are not supported.&lt;br /&gt;
 To set the timezone, set the TZ environment variable as specified in&lt;br /&gt;
 http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap08.html&lt;br /&gt;
 or you may also create an /etc/TZ file of a single line, ending with a&lt;br /&gt;
 newline, containing the TZ setting.  For example&lt;br /&gt;
 echo CST6CDT &amp;gt; /etc/TZ&lt;br /&gt;
&#039;&#039;Source: http://www.uclibc.org/downloads/Glibc_vs_uClibc_Differences.txt&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For more information, see how other uClibc-based distributions do this:&lt;br /&gt;
* http://leaf.sourceforge.net/doc/buci-tz3.html&lt;br /&gt;
* http://www.sonoracomm.com/index.php?option=com_content&amp;amp;task=view&amp;amp;id=107&amp;amp;Itemid=32&lt;br /&gt;
&lt;br /&gt;
For a more complete list of timezones, please see: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones&lt;br /&gt;
&lt;br /&gt;
== OpenNTPD reports an error with &amp;quot;adjtime&amp;quot; ==&lt;br /&gt;
Your log contains something like:&lt;br /&gt;
 reply from 85.214.86.126: offset 865033148.784255 delay 0.055466, next query 32s&lt;br /&gt;
 reply from 202.150.212.24: offset 865033148.779314 delay 0.400771, next query 3s&lt;br /&gt;
 adjusting local clock by 865033148.779835s                                      &lt;br /&gt;
 adjtime failed: Invalid argument    &lt;br /&gt;
&lt;br /&gt;
{{pkg|openntpd}} is supposed to make small adjustments in the time without causing time jumps.&amp;lt;br&amp;gt;&lt;br /&gt;
If the adjustment is too big then something is clearly wrong and ntpd gives up. (its actually adjtime(3) that has a limit on how big adjustments are allowed)&lt;br /&gt;
&lt;br /&gt;
You can make ntpd set the time at startup by adding &#039;&#039;-s&#039;&#039; option to ntpd. This is done by setting &#039;&#039;&#039;NTPD_OPTS=&amp;quot;-s&amp;quot;&#039;&#039;&#039; in {{path|/etc/conf.d/ntpd}}.&lt;br /&gt;
&lt;br /&gt;
== Using a cron job to keep the time in sync ==&lt;br /&gt;
Add the following to {{path|/etc/periodic/daily}} (or use another folder under the {{path|/etc/periodic}} heirarchy if you want to run the script more/less frequently)&lt;br /&gt;
&lt;br /&gt;
Example: file called {{path|do-ntp}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
ntpd -d -q -n -p uk.pool.ntp.org&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This queries the uk time server pool - you can modify this to suit your localisation, or just use &#039;&#039;pool.ntp.org&#039;&#039;. More info here: [http://www.pool.ntp.org/zone/@ http://www.pool.ntp.org/zone/@]&lt;br /&gt;
&lt;br /&gt;
== Windows clients reports an error when trying to sync ==&lt;br /&gt;
{{pkg|openntpd}} needs to run for a while before it is satisfied it is in sync.&lt;br /&gt;
Until then it will set a flag &amp;quot;clock not synchronized&amp;quot; and Windows will report an error while trying to sync with your {{pkg|openntpd}} server.&lt;br /&gt;
&lt;br /&gt;
Only thing to do is wait, do something else for 15-20mins and then check.&lt;br /&gt;
&lt;br /&gt;
= Packages =&lt;br /&gt;
== Can you build an apk package for ...? ==&lt;br /&gt;
Yes, we probably can.&amp;lt;br&amp;gt;&lt;br /&gt;
Please create an [http://redmine.alpinelinux.org/projects/alpine/issues/new issue] in the [http://bugs.alpinelinux.org bugtracker]. Mark it as &amp;quot;feature&amp;quot; and include a short description (one-line), an url for the home page, and an url for the source package.&lt;br /&gt;
&lt;br /&gt;
== How can I build my own package? ==&lt;br /&gt;
Please see the [[Creating an Alpine package]] page.&lt;br /&gt;
&lt;br /&gt;
== WARNING: Ignoring APKINDEX.xxxx.tar.gz ==&lt;br /&gt;
If you get &amp;lt;code&amp;gt;WARNING: Ignoring APKINDEX.xxxx.tar.gz: No such file or directory&amp;lt;/code&amp;gt; while running package related tools, check your {{path|/etc/apk/repositories}} file if an entry points to {{path|.../v2.4/testing/}}. This directory is gone.&lt;br /&gt;
&lt;br /&gt;
To check the content of the repositories file&lt;br /&gt;
{{Cmd|cat /etc/apk/repositories}}&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
{{Cmd|setup-apkrepos}}&lt;br /&gt;
&lt;br /&gt;
= Dynamic DNS =&lt;br /&gt;
== How do I schedule a regular dynamic DNS update? ==&lt;br /&gt;
You&#039;ll want to install the {{pkg|ez-ipupdate}} package:&lt;br /&gt;
{{cmd|apk add ez-ipupdate}}&lt;br /&gt;
&lt;br /&gt;
After that, create a new file at {{path|/etc/ezipupdate.conf}} with the contents similar to:&lt;br /&gt;
 service-type=dyndns&lt;br /&gt;
 user=myusername:mypassword&lt;br /&gt;
 interface=eth1&lt;br /&gt;
 host=myhostname.dyndns.org&lt;br /&gt;
&lt;br /&gt;
Make the new ip cache directory:&lt;br /&gt;
{{cmd|mkdir /var/cache/ez-ipupdate&lt;br /&gt;
lbu add /var/cache/ez-ipupdate}}&lt;br /&gt;
&lt;br /&gt;
Then schedule a new cron job with this command:&lt;br /&gt;
{{cmd|echo &amp;gt;&amp;gt; /var/log/ez-ipupdate &amp;amp;&amp;amp; /bin/date &amp;gt;&amp;gt; /var/log/ez-ipupdate &amp;amp;&amp;amp; ez-ipupdate --config /etc/ez-ipupdate.conf -f -F /var/run/ez-ipupdate.pid --cache-file /var/cache/ez-ipupdate/ipcache --quiet &amp;gt;&amp;gt; /var/log/ez-ipupdate 2&amp;gt;&amp;amp;1}}&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to backup your settings!&lt;br /&gt;
{{cmd|lbu ci}}&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Alpine_Linux:FAQ&amp;diff=8602</id>
		<title>Alpine Linux:FAQ</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Alpine_Linux:FAQ&amp;diff=8602"/>
		<updated>2012-10-24T08:40:12Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Using macros to show/highlight what&amp;#039;s a package,command,path or file content. Creating links to documents that describes a specific command or procedure. Additionally I added rowbreak to make the page more readable (if you ask me).&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To get oriented and learn what makes our distribution distinctive, see the [http://alpinelinux.org/about About page] or [[Alpine Linux:Overview|our more detailed overview]].&lt;br /&gt;
&lt;br /&gt;
[[Image:filetypes.svg|64px|left|link=]]&lt;br /&gt;
This is a list of &#039;&#039;&#039;frequently asked questions&#039;&#039;&#039; about Alpine Linux.&amp;lt;br&amp;gt;&lt;br /&gt;
If your question is not answered on this page, use the search box above to find work in progress pages not linked here, or in case of no answer, edit this page and write down your question.&lt;br /&gt;
{{Tip| Prepare your question. Think it through. Make it simple and understandable.}} &lt;br /&gt;
&lt;br /&gt;
=General=&lt;br /&gt;
&lt;br /&gt;
== I have found a bug, where can I report it? ==&lt;br /&gt;
You can report it on the [http://bugs.alpinelinux.org/ bugtracker].&lt;br /&gt;
&lt;br /&gt;
== Are there any details about the releases available? ==&lt;br /&gt;
Yes, please check the [[Alpine Linux:Releases|Releases]] page.&lt;br /&gt;
&lt;br /&gt;
== Alpine freezes during boot from Compact Flash, how can I fix? ==&lt;br /&gt;
Most Compact Flash card readers do not support proper DMA.&amp;lt;br&amp;gt;&lt;br /&gt;
You should append &#039;&#039;&#039;nodma&#039;&#039;&#039; to the &#039;&#039;append&#039;&#039; line in {{path|syslinux.cfg}}.&lt;br /&gt;
&lt;br /&gt;
== How can I contribute? ==&lt;br /&gt;
You can contribute by:&lt;br /&gt;
* using the software and giving feedback&lt;br /&gt;
* by documenting your [http://www.alpinelinux.org Alpine Linux] experiences on this [[Main_Page|wiki]]&lt;br /&gt;
* in many other ways&lt;br /&gt;
Please visit [[Contribute|Contribute page]] to read more about this topic.&lt;br /&gt;
&lt;br /&gt;
Your contributions are highly appreciated.&lt;br /&gt;
&lt;br /&gt;
== How do I remove the CDROM? ==&lt;br /&gt;
Since the modloop loopback device is on CDROM you cannot just run &#039;&#039;eject&#039;&#039;. You need to unmount the modloop first.&amp;lt;br&amp;gt;&lt;br /&gt;
Unmounting both the modloop and the cdrom in one step can be done by executing:&lt;br /&gt;
{{cmd|/etc/init.d/modloop stop}}&lt;br /&gt;
&lt;br /&gt;
Then it&#039;s possible to eject the cdrom:&lt;br /&gt;
{{cmd|eject}}&lt;br /&gt;
&lt;br /&gt;
== Why don&#039;t I have man pages or where is the &#039;man&#039; command? ==&lt;br /&gt;
The {{pkg|man}} command and man pages are not installed by default.&lt;br /&gt;
&lt;br /&gt;
* First, install the {{pkg|man}} package:&lt;br /&gt;
: {{Cmd|apk add man}}&lt;br /&gt;
* Once that&#039;s done, install the documentation for the packages that you require man pages for:&amp;lt;br /&amp;gt;(Keep in mind, however, it&#039;s possible that not all packages will have a corresponding documentation package.)&lt;br /&gt;
: {{Cmd|apk add &amp;lt;pkg&amp;gt;-doc}}&lt;br /&gt;
: For example, say you installed {{pkg|iptables}} and you now require its {{pkg|man}} pages:&lt;br /&gt;
: {{Cmd|apk add iptables-doc}}&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
In our example above, we installed the man pages (and other documentation) for iptables. We can now read it:&lt;br /&gt;
{{Cmd|man iptables}}&lt;br /&gt;
&lt;br /&gt;
==Booting Alpine on an HP ML350 G6==&lt;br /&gt;
{{Note|This &#039;Booting Alpine on an HP ML350 G6&#039; section, only applies to [http://www.alpinelinux.org/ Alpine Linux] 1.9.3 and earlier.}}&lt;br /&gt;
[http://bugs.alpinelinux.org/issues/228 Ticket 228] on [http://bugs.alpinelinux.org/ bugs.alpinelinux.org] includes a patch that disables the kernel module hpwdt by default.&lt;br /&gt;
&lt;br /&gt;
Details: Kernel module for HP Watchdog Timer causes issues during boot.  Solution is to create an overlay (ie {{path|hpwdt.apkovl.tar.gz}}) containing {{path|/etc/modprobe.d/hpwdt}} (which contains &amp;quot;blacklist hpwdt&amp;quot;), place that on some removable media (ie USB key) and insert that during boot process.  This will insure that the offending module doesn&#039;t load and that the server will boot properly.&lt;br /&gt;
&lt;br /&gt;
==My cron jobs don&#039;t run?==&lt;br /&gt;
The cron daemon is started automatically on system boot and executes the scripts placed in the folders under {{path|/etc/periodic}} - there&#039;s a {{path|15min}} folder, plus ones for {{path|hourly}}, {{path|daily}}, {{path|weekly}} and {{path|monthly}} scripts.&lt;br /&gt;
&lt;br /&gt;
You can check whether your scripts are likely to run using the command:&lt;br /&gt;
&lt;br /&gt;
: {{cmd|run-parts -t /etc/periodic/[foldername]}} - for example: &#039;&#039;run-parts -t /etc/periodic/15min&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This command will tell you what should run but will not actually execute the scripts.&lt;br /&gt;
&lt;br /&gt;
If the results of the test are not as expected, check the following:&lt;br /&gt;
&lt;br /&gt;
* Make sure the script is executable - if unsure, issue the command : {{cmd|chmod a+x [scriptname]}}&lt;br /&gt;
* Make sure the first line of your script is :&amp;lt;pre&amp;gt;#!/bin/sh&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Do not put file extensions on your script names - this stops them from working; for example: {{path|myscript}}  will run, but {{path|myscript.sh}} won&#039;t&lt;br /&gt;
&lt;br /&gt;
== What is the difference between edge and stable releases? ==&lt;br /&gt;
Stable releases are just what they sound like: initially a point-in-time snapshot of the package archives, but then maintained with bugfixes only in order to keep a stable environment.&lt;br /&gt;
&lt;br /&gt;
[[Edge]] is more of a rolling-release, with the latest and greatest packages available in the online repositories.&amp;lt;br&amp;gt;&lt;br /&gt;
Occasionally, snapshot ISO images of the then-current state of [[edge]] are made and are available for download.&amp;lt;br&amp;gt;&lt;br /&gt;
Typically these are made when there are major kernel upgrades or package upgrades that require initramfs rebuilds.&lt;br /&gt;
&lt;br /&gt;
== What kind of release of Alpine Linux are available? ==&lt;br /&gt;
Please check the [[Alpine_Linux:Releases|Releases]] page for more information.&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== What is the difference between &#039;sys&#039;, &#039;data&#039;, and &#039;diskless&#039; installs when running setup-alpine (or setup-disk)? ==&lt;br /&gt;
&#039;&#039;&#039;sys:&#039;&#039;&#039; This mode is a traditional disk install. The following partitions will be created on the disk: /boot, / (filesystem root) and swap.&amp;lt;br&amp;gt;&lt;br /&gt;
This mode may be used for development boxes, desktops, virtual servers, etc.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;data:&#039;&#039;&#039; This mode uses your disk(s) for data storage, not for the operating system.  The system itself will run from tmpfs (RAM).  &lt;br /&gt;
&lt;br /&gt;
Use this mode if you only want to use the disk(s) for a mailspool, databases, logs, etc.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;diskless:&#039;&#039;&#039; No disks are to be used.  [[Alpine local backup]] may still be used in this mode.&lt;br /&gt;
&lt;br /&gt;
== How can I install a custom firmware in a diskless system? ==&lt;br /&gt;
&lt;br /&gt;
The modules and firmware are both special images which are mounted as read-only.&amp;lt;br&amp;gt;&lt;br /&gt;
To fix this issue you can copy the firmware directory to your writeable media (cf/usb) and copy your custom firmware to it.&amp;lt;br&amp;gt;&lt;br /&gt;
After reboot Alpine should automatically use the directory on your local storage instead of the loopback device.&lt;br /&gt;
&lt;br /&gt;
=Audio=&lt;br /&gt;
&lt;br /&gt;
== How do I play my .ogg/.mp3 files? ==&lt;br /&gt;
First, the sound card should be recognized (you must have {{path|/dev/snd/*****}} files)&lt;br /&gt;
&lt;br /&gt;
sox, mpg321, mpg123, oggplay, etc all use the oss sound driver, while Alpine uses ALSA drivers.&amp;lt;br&amp;gt;&lt;br /&gt;
So you need to load the snd-pcm-oss compatibility module.&amp;lt;br&amp;gt;&lt;br /&gt;
While you&#039;re at it, you might need {{pkg|aumix}} to turn up the sound volume&lt;br /&gt;
{{cmd|echo snd-pcm-oss &amp;gt;&amp;gt; /etc/modules&lt;br /&gt;
modprobe snd-pcm-oss &lt;br /&gt;
apk_add aumix sox&lt;br /&gt;
aumix (set volume settings)&lt;br /&gt;
play really_cool_song.mp3}}&lt;br /&gt;
&lt;br /&gt;
= Time and timezones =&lt;br /&gt;
&lt;br /&gt;
== How do I set the local timezone? ==&lt;br /&gt;
&lt;br /&gt;
Starting in Alpine 2.2, setting the timezone can be done through the [[Setup-alpine|setup-alpine]] script, and no manual settings should be necessary.&amp;lt;br&amp;gt;&lt;br /&gt;
If you wish to edit the timezone after installation, run the [[Alpine_setup_scripts|setup-timezone]] script.&lt;br /&gt;
&lt;br /&gt;
However, if you are using a previous version, please use the following steps:&lt;br /&gt;
&lt;br /&gt;
 /etc/timezone and the whole zoneinfo directory tree are not supported.&lt;br /&gt;
 To set the timezone, set the TZ environment variable as specified in&lt;br /&gt;
 http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap08.html&lt;br /&gt;
 or you may also create an /etc/TZ file of a single line, ending with a&lt;br /&gt;
 newline, containing the TZ setting.  For example&lt;br /&gt;
 echo CST6CDT &amp;gt; /etc/TZ&lt;br /&gt;
&#039;&#039;Source: http://www.uclibc.org/downloads/Glibc_vs_uClibc_Differences.txt&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For more information, see how other uClibc-based distributions do this:&lt;br /&gt;
* http://leaf.sourceforge.net/doc/buci-tz3.html&lt;br /&gt;
* http://www.sonoracomm.com/index.php?option=com_content&amp;amp;task=view&amp;amp;id=107&amp;amp;Itemid=32&lt;br /&gt;
&lt;br /&gt;
For a more complete list of timezones, please see: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones&lt;br /&gt;
&lt;br /&gt;
== OpenNTPD reports an error with &amp;quot;adjtime&amp;quot; ==&lt;br /&gt;
Your log contains something like:&lt;br /&gt;
 reply from 85.214.86.126: offset 865033148.784255 delay 0.055466, next query 32s&lt;br /&gt;
 reply from 202.150.212.24: offset 865033148.779314 delay 0.400771, next query 3s&lt;br /&gt;
 adjusting local clock by 865033148.779835s                                      &lt;br /&gt;
 adjtime failed: Invalid argument    &lt;br /&gt;
&lt;br /&gt;
{{pkg|openntpd}} is supposed to make small adjustments in the time without causing time jumps.&amp;lt;br&amp;gt;&lt;br /&gt;
If the adjustment is too big then something is clearly wrong and ntpd gives up. (its actually adjtime(3) that has a limit on how big adjustments are allowed)&lt;br /&gt;
&lt;br /&gt;
You can make ntpd set the time at startup by adding &#039;&#039;-s&#039;&#039; option to ntpd. This is done by setting &#039;&#039;&#039;NTPD_OPTS=&amp;quot;-s&amp;quot;&#039;&#039;&#039; in {{path|/etc/conf.d/ntpd}}.&lt;br /&gt;
&lt;br /&gt;
== Using a cron job to keep the time in sync ==&lt;br /&gt;
Add the following to {{path|/etc/periodic/daily}} (or use another folder under the {{path|/etc/periodic}} heirarchy if you want to run the script more/less frequently)&lt;br /&gt;
&lt;br /&gt;
Example: file called {{path|do-ntp}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
ntpd -d -q -n -p uk.pool.ntp.org&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This queries the uk time server pool - you can modify this to suit your localisation, or just use &#039;&#039;pool.ntp.org&#039;&#039;. More info here: [http://www.pool.ntp.org/zone/@ http://www.pool.ntp.org/zone/@]&lt;br /&gt;
&lt;br /&gt;
== Windows clients reports an error when trying to sync ==&lt;br /&gt;
{{pkg|openntpd}} needs to run for a while before it is satisfied it is in sync.&lt;br /&gt;
Until then it will set a flag &amp;quot;clock not synchronized&amp;quot; and Windows will report an error while trying to sync with your {{pkg|openntpd}} server.&lt;br /&gt;
&lt;br /&gt;
Only thing to do is wait, do something else for 15-20mins and then check.&lt;br /&gt;
&lt;br /&gt;
= Packages =&lt;br /&gt;
== Can you build an apk package for ...? ==&lt;br /&gt;
Yes, we probably can.&amp;lt;br&amp;gt;&lt;br /&gt;
Please create an [http://redmine.alpinelinux.org/projects/alpine/issues/new issue] in the [http://bugs.alpinelinux.org bugtracker]. Mark it as &amp;quot;feature&amp;quot; and include a short description (one-line), an url for the home page, and an url for the source package.&lt;br /&gt;
&lt;br /&gt;
== How can I build my own package? ==&lt;br /&gt;
Please see the [[Creating an Alpine package]] page.&lt;br /&gt;
&lt;br /&gt;
== WARNING: Ignoring APKINDEX.xxxx.tar.gz ==&lt;br /&gt;
If you get &amp;lt;code&amp;gt;WARNING: Ignoring APKINDEX.xxxx.tar.gz: No such file or directory&amp;lt;/code&amp;gt; while running package related tools, check your {{path|/etc/apk/repositories}} file if an entry points to {{path|.../v2.4/testing/}}. This directory is gone.&lt;br /&gt;
&lt;br /&gt;
To check the content of the repositories file&lt;br /&gt;
{{Cmd|cat /etc/apk/repositories}}&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
{{Cmd|setup-apkrepos}}&lt;br /&gt;
&lt;br /&gt;
= Dynamic DNS =&lt;br /&gt;
== How do I schedule a regular dynamic DNS update? ==&lt;br /&gt;
You&#039;ll want to install the {{pkg|ez-ipupdate}} package:&lt;br /&gt;
{{cmd|apk add ez-ipupdate}}&lt;br /&gt;
&lt;br /&gt;
After that, create a new file at {{path|/etc/ezipupdate.conf}} with the contents similar to:&lt;br /&gt;
 service-type=dyndns&lt;br /&gt;
 user=myusername:mypassword&lt;br /&gt;
 interface=eth1&lt;br /&gt;
 host=myhostname.dyndns.org&lt;br /&gt;
&lt;br /&gt;
Make the new ip cache directory:&lt;br /&gt;
{{cmd|mkdir /var/cache/ez-ipupdate&lt;br /&gt;
lbu add /var/cache/ez-ipupdate}}&lt;br /&gt;
&lt;br /&gt;
Then schedule a new cron job with this command:&lt;br /&gt;
{{cmd|echo &amp;gt;&amp;gt; /var/log/ez-ipupdate &amp;amp;&amp;amp; /bin/date &amp;gt;&amp;gt; /var/log/ez-ipupdate &amp;amp;&amp;amp; ez-ipupdate --config /etc/ez-ipupdate.conf -f -F /var/run/ez-ipupdate.pid --cache-file /var/cache/ez-ipupdate/ipcache --quiet &amp;gt;&amp;gt; /var/log/ez-ipupdate 2&amp;gt;&amp;amp;1}}&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to backup your settings!&lt;br /&gt;
{{cmd|lbu ci}}&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=How-To_Alpine_Wall&amp;diff=8594</id>
		<title>How-To Alpine Wall</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=How-To_Alpine_Wall&amp;diff=8594"/>
		<updated>2012-10-23T07:21:33Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: /* Example firewall using AWall */ Fixed missing comma&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
&lt;br /&gt;
= General =&lt;br /&gt;
Purpose of this doc is to illustrate Alpine Wall (AWall) by examples.&amp;lt;BR&amp;gt;&lt;br /&gt;
We will explain AWall from the viewpoint of a Shorewall user.&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
AWall is available since Alpine v2.4.&amp;lt;BR&amp;gt;&lt;br /&gt;
Please see [[Alpine_Wall_User&#039;s_Guide]] for details about the syntax. &lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
Your AWall firewall configuration file(s) goes to {{Path|/usr/share/awall/optional}}.&amp;lt;BR&amp;gt;&lt;br /&gt;
You may have multiple configuration files &#039;&#039;(it is useful to have separate files for eg. HTTP,FTP and other roles)&#039;&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
Each such file is called &#039;&#039;Policy&#039;&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
The &#039;&#039;Policy(s)&#039;&#039; can be enabled or disabled by using the &amp;quot;awall [enable|disable]&amp;quot; command.&lt;br /&gt;
{{note|AWalls &#039;&#039;Policy&#039;&#039; files are not equivalent to Shorewalls {{Path|/etc/shorewall/policy}} file.}}&lt;br /&gt;
&lt;br /&gt;
An AWall &#039;&#039;Policy&#039;&#039; can contain definitions of:&lt;br /&gt;
* variables &#039;&#039;(like {{Path|/etc/shorewall/params}})&#039;&#039;&lt;br /&gt;
* zones &#039;&#039;(like {{Path|/etc/shorewall/zones}})&#039;&#039;&lt;br /&gt;
* interfaces &#039;&#039;(like {{Path|/etc/shorewall/interfaces}})&#039;&#039;&lt;br /&gt;
* policies &#039;&#039;(like {{Path|/etc/shorewall/policy}})&#039;&#039;&lt;br /&gt;
* filters and NAT rules &#039;&#039;(like {{Path|/etc/shorewall/rules}})&#039;&#039;&lt;br /&gt;
* services &#039;&#039;(like {{Path|/usr/share/shorewall/macro.HTTP}})&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
After installing awall package, you need to load the following iptables modules:&lt;br /&gt;
{{cmd|modprobe ip_tables&lt;br /&gt;
modprobe iptable_nat    #if NAT is used}}&lt;br /&gt;
&lt;br /&gt;
This is needed only the first time, after AWall installation.&lt;br /&gt;
&lt;br /&gt;
Make the firewall autostart at boot and autoload the needed modules:&lt;br /&gt;
{{cmd|rc-update add iptables}}&lt;br /&gt;
&lt;br /&gt;
= A Basic Home Firewall =&lt;br /&gt;
We will give a example on how you can convert a &amp;quot;Basic home firewall&amp;quot; from Shorewall to AWall.&lt;br /&gt;
&lt;br /&gt;
== Example firewall using Shorewall ==&lt;br /&gt;
Let&#039;s suppose you have the following Shorewall configuration:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/zones&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inet  ipv4&lt;br /&gt;
loc   ipv4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/interfaces&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inet  eth0&lt;br /&gt;
loc   eth1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/policy&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fw   all  ACCEPT&lt;br /&gt;
loc  inet ACCEPT&lt;br /&gt;
all  all  DROP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/masq&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
eth0  0.0.0.0/0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example firewall using AWall ==&lt;br /&gt;
Now we will configure AWall to do the same thing as we just did with the above Shorewall example.&lt;br /&gt;
&lt;br /&gt;
Create a new file called {{Path|/usr/share/awall/optional/test-policy.json}} and add the following content to the file.&amp;lt;BR&amp;gt;&lt;br /&gt;
{{Tip|You could call it something else as long as you save it in {{Path|/usr/share/awall/optional/}} and name it {{Path|???&#039;&#039;&#039;.json&#039;&#039;&#039;}})}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Home firewall&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;inet&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;eth0&amp;quot; },&lt;br /&gt;
    &amp;quot;loc&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;eth1&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;policy&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;loc&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;snat&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;inet&amp;quot; }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above configuration will:&lt;br /&gt;
* Create a description of your &#039;&#039;Policy&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;zones&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;policy&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;snat&#039;&#039; &#039;&#039;(to masqurade the outgoing traffic)&#039;&#039;&lt;br /&gt;
{{Note|&#039;&#039;snat&#039;&#039; means &amp;quot;source NAT&amp;quot;. It does &amp;lt;u&amp;gt;not&amp;lt;/u&amp;gt; mean &amp;quot;static NAT&amp;quot;.}}&lt;br /&gt;
{{Tip| AWall has a built-in zone named &amp;quot;_fw&amp;quot; which is the &amp;quot;firewall itself&amp;quot;. This corresponds to the Shorewall &amp;quot;fw&amp;quot; zone.}}&lt;br /&gt;
&lt;br /&gt;
=== Activating/Applying a Policy ===&lt;br /&gt;
After saving the &#039;&#039;Policy&#039;&#039; you can run the following commands to activate your firewall settings:&lt;br /&gt;
{{cmd|awall list                  # Listing available &#039;Policy(s)&#039; (This step is optional)&lt;br /&gt;
awall enable test-policy    # Enables the &#039;Policy&#039;&lt;br /&gt;
awall activate              # Genereates firewall configuration from the &#039;Policy&#039; files and enables it (starts the firewall)}}&lt;br /&gt;
&lt;br /&gt;
If you have multiple policies, after enabling or disabling them, you need to always run &#039;&#039;awall activate&#039;&#039; in order to update the iptables rules.&lt;br /&gt;
&lt;br /&gt;
= Advanced Firewall settings =&lt;br /&gt;
Assuming you have your {{Path|/usr/share/awall/optional/test-policy.json}} with your &amp;quot;Basic home firewall&amp;quot; settings, you could choose to modify that file to test the below examples.&lt;br /&gt;
{{tip|You could create new files in {{Path|/usr/share/awall/optional/}} for testing some of the below examples}}&lt;br /&gt;
&lt;br /&gt;
== Logging ==&lt;br /&gt;
AWall will &#039;&#039;(since v0.2.7)&#039;&#039; automatically log dropped packets.&amp;lt;BR&amp;gt;&lt;br /&gt;
You could add the following row to the &amp;quot;policy&amp;quot; section in your &#039;&#039;Policy&#039;&#039; file in order to see the dropped packets.&lt;br /&gt;
&amp;lt;pre&amp;gt;{ &amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;loc&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;drop&amp;quot; }&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note|If you are using Alpine 2.4 repository (AWall v0.2.5 or below), you should use &amp;lt;code&amp;gt;&amp;quot;action&amp;quot;: &amp;quot;logdrop&amp;quot;&amp;lt;/code&amp;gt; in order to log dropped packets .}}&lt;br /&gt;
{{Note|If you are adding the above content to an already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
&lt;br /&gt;
== Port-Forwarding ==&lt;br /&gt;
Let&#039;s suppose you have a local web server (192.168.1.10) that you want to make accessible from the &amp;quot;inet&amp;quot;.&amp;lt;BR&amp;gt;&lt;br /&gt;
With Shorewall you would have a rule like this in your {{Path|/etc/shorewall/rules}}:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#ACTION  SOURCE  DEST               PROTO  DEST    SOURCE    ORIGINAL&lt;br /&gt;
#                                          PORT(S) PORT(S)   DEST&lt;br /&gt;
DNAT     inet     loc:192.168.1.10  tcp    80&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lets configure our AWall &#039;&#039;Policy&#039;&#039; file likewise by adding the following content.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;APACHE&amp;quot;: &amp;quot;192.168.1.10&amp;quot;,&lt;br /&gt;
    &amp;quot;STATIC_IP&amp;quot;: &amp;quot;1.2.3.4&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;$STATIC_IP&amp;quot;, &lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;http&amp;quot;, &lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;, &lt;br /&gt;
      &amp;quot;dnat&amp;quot;: &amp;quot;$APACHE&amp;quot; &lt;br /&gt;
      }&lt;br /&gt;
    ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see in the above example, we create a&lt;br /&gt;
* &amp;quot;variable&amp;quot; section where we specify some IP-addresses&lt;br /&gt;
* &amp;quot;filter&amp;quot; section where we do the actual port-forwarding (using the variables we just created and using some preexisting &amp;quot;services&amp;quot; definitions)&lt;br /&gt;
{{Note|If you are adding the above content to a already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
{{Tip|AWall already has a &amp;quot;service&amp;quot; definition list for several services like HTTP, FTP, SNMP, etc. &#039;&#039;(see {{Path|/usr/share/awall/mandatory/services.json}})&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
== Create your own service definitions ==&lt;br /&gt;
You can add your own service definitions into your &#039;&#039;Policy&#039;&#039; files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;service&amp;quot;: {  &lt;br /&gt;
  &amp;quot;openvpn&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;udp&amp;quot;, &amp;quot;port&amp;quot;: 1194 }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note|You can not override a &amp;quot;service&amp;quot; definition that comes from {{Path|/usr/share/awall/mandatory/services.json}} }}&lt;br /&gt;
{{Note|If you are adding the above content to a already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
&lt;br /&gt;
== Inherit services or variables == &lt;br /&gt;
You can import a &#039;&#039;Policy&#039;&#039; into other &#039;&#039;Policy&#039;&#039; files for inheriting services or variables definitions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;import&amp;quot;: &amp;quot;myfirewall&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Specify load order ==&lt;br /&gt;
By default policies are loaded on alphabetical order.&amp;lt;BR&amp;gt;&lt;br /&gt;
You can change the load order with the keywords &amp;quot;before&amp;quot; and &amp;quot;after&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;before&amp;quot;: &amp;quot;myfirewall&amp;quot;&lt;br /&gt;
&amp;quot;after&amp;quot;: &amp;quot;someotherpolicy&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Other =&lt;br /&gt;
== Permanently save config ==&lt;br /&gt;
If you are running from read-only medium (from CD, USB or CF) you will need to make sure your &#039;&#039;Policy&#039;&#039; files gets permanently saved until next reboot.&lt;br /&gt;
{{cmd|lbu inc &amp;lt;var&amp;gt;/usr/share/awall/optional/&amp;lt;/var&amp;gt;   # This tells lbu to include that path when creating a new apkovl&lt;br /&gt;
lbu ci                               # This creates the new apkovl}}&lt;br /&gt;
&lt;br /&gt;
== Help and debugging ==&lt;br /&gt;
If you end up in some kind of trouble, you might find some commands useful when debugging:&lt;br /&gt;
{{cmd|awall                 # (With no parameters) Shows some basic help about awall application&lt;br /&gt;
iptables -L -n        # Show what&#039;s in &amp;lt;code&amp;gt;iptables&amp;lt;/code&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=How-To_Alpine_Wall&amp;diff=8587</id>
		<title>How-To Alpine Wall</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=How-To_Alpine_Wall&amp;diff=8587"/>
		<updated>2012-10-22T13:38:17Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: /* Example firewall using AWall */ You need to enter &amp;#039;MASQUERADE&amp;#039; instead of &amp;#039;masquerade&amp;#039; (this is what &amp;#039;iptables&amp;#039; was complaining about)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
&lt;br /&gt;
= General =&lt;br /&gt;
Purpose of this doc is to illustrate Alpine Wall (AWall) by examples.&amp;lt;BR&amp;gt;&lt;br /&gt;
We will explain AWall from the viewpoint of a Shorewall user.&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
AWall is available since Alpine v2.4.&amp;lt;BR&amp;gt;&lt;br /&gt;
Please see [[Alpine_Wall_User&#039;s_Guide]] for details about the syntax. &lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
Your AWall firewall configuration file(s) goes to {{Path|/usr/share/awall/optional}}.&amp;lt;BR&amp;gt;&lt;br /&gt;
You may have multiple configuration files &#039;&#039;(it is useful to have separate files for eg. HTTP,FTP and other roles)&#039;&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
Each such file is called &#039;&#039;Policy&#039;&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
The &#039;&#039;Policy(s)&#039;&#039; can be enabled or disabled by using the &amp;quot;awall [enable|disable]&amp;quot; command.&lt;br /&gt;
{{note|AWalls &#039;&#039;Policy&#039;&#039; files are not equivalent to Shorewalls {{Path|/etc/shorewall/policy}} file.}}&lt;br /&gt;
&lt;br /&gt;
An AWall &#039;&#039;Policy&#039;&#039; can contain definitions of:&lt;br /&gt;
* variables &#039;&#039;(like {{Path|/etc/shorewall/params}})&#039;&#039;&lt;br /&gt;
* zones &#039;&#039;(like {{Path|/etc/shorewall/zones}})&#039;&#039;&lt;br /&gt;
* interfaces &#039;&#039;(like {{Path|/etc/shorewall/interfaces}})&#039;&#039;&lt;br /&gt;
* policies &#039;&#039;(like {{Path|/etc/shorewall/policy}})&#039;&#039;&lt;br /&gt;
* filters and NAT rules &#039;&#039;(like {{Path|/etc/shorewall/rules}})&#039;&#039;&lt;br /&gt;
* services &#039;&#039;(like {{Path|/usr/share/shorewall/macro.HTTP}})&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
After installing awall package, you need to load the following iptables modules:&lt;br /&gt;
{{cmd|modprobe ip_tables&lt;br /&gt;
modprobe iptable_nat    #if NAT is used}}&lt;br /&gt;
&lt;br /&gt;
This is needed only the first time, after AWall installation.&lt;br /&gt;
&lt;br /&gt;
Make the firewall autostart at boot and autoload the needed modules:&lt;br /&gt;
{{cmd|rc-update add iptables}}&lt;br /&gt;
&lt;br /&gt;
= A Basic Home Firewall =&lt;br /&gt;
We will give a example on how you can convert a &amp;quot;Basic home firewall&amp;quot; from Shorewall to AWall.&lt;br /&gt;
&lt;br /&gt;
== Example firewall using Shorewall ==&lt;br /&gt;
Let&#039;s suppose you have the following Shorewall configuration:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/zones&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inet  ipv4&lt;br /&gt;
loc   ipv4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/interfaces&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inet  eth0&lt;br /&gt;
loc   eth1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/policy&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fw   all  ACCEPT&lt;br /&gt;
loc  inet ACCEPT&lt;br /&gt;
all  all  DROP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/masq&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
eth0  0.0.0.0/0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example firewall using AWall ==&lt;br /&gt;
Now we will configure AWall to do the same thing as we just did with the above Shorewall example.&lt;br /&gt;
&lt;br /&gt;
Create a new file called {{Path|/usr/share/awall/optional/test-policy.json}} and add the following content to the file.&amp;lt;BR&amp;gt;&lt;br /&gt;
{{Tip|You could call it something else as long as you save it in {{Path|/usr/share/awall/optional/}} and name it {{Path|???&#039;&#039;&#039;.json&#039;&#039;&#039;}})}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Home firewall&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;inet&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;eth0&amp;quot; },&lt;br /&gt;
    &amp;quot;loc&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;eth1&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;policy&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;loc&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;snat&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;MASQUERADE&amp;quot; }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above configuration will:&lt;br /&gt;
* Create a description of your &#039;&#039;Policy&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;zones&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;policy&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;snat&#039;&#039; &#039;&#039;(to masqurade the outgoing traffic)&#039;&#039;&lt;br /&gt;
{{Note|&#039;&#039;snat&#039;&#039; means &amp;quot;source NAT&amp;quot;. It does &amp;lt;u&amp;gt;not&amp;lt;/u&amp;gt; mean &amp;quot;static NAT&amp;quot;.}}&lt;br /&gt;
{{Tip| AWall has a built-in zone named &amp;quot;_fw&amp;quot; which is the &amp;quot;firewall itself&amp;quot;. This corresponds to the Shorewall &amp;quot;fw&amp;quot; zone.}}&lt;br /&gt;
&lt;br /&gt;
=== Activating/Applying a Policy ===&lt;br /&gt;
After saving the &#039;&#039;Policy&#039;&#039; you can run the following commands to activate your firewall settings:&lt;br /&gt;
{{cmd|awall list                  # Listing available &#039;Policy(s)&#039; (This step is optional)&lt;br /&gt;
awall enable test-policy    # Enables the &#039;Policy&#039;&lt;br /&gt;
awall activate              # Genereates firewall configuration from the &#039;Policy&#039; files and enables it (starts the firewall)}}&lt;br /&gt;
&lt;br /&gt;
If you have multiple policies, after enabling or disabling them, you need to always run &#039;&#039;awall activate&#039;&#039; in order to update the iptables rules.&lt;br /&gt;
&lt;br /&gt;
= Advanced Firewall settings =&lt;br /&gt;
Assuming you have your {{Path|/usr/share/awall/optional/test-policy.json}} with your &amp;quot;Basic home firewall&amp;quot; settings, you could choose to modify that file to test the below examples.&lt;br /&gt;
{{tip|You could create new files in {{Path|/usr/share/awall/optional/}} for testing some of the below examples}}&lt;br /&gt;
&lt;br /&gt;
== Logging ==&lt;br /&gt;
AWall will &#039;&#039;(since v0.2.7)&#039;&#039; automatically log dropped packets.&amp;lt;BR&amp;gt;&lt;br /&gt;
You could add the following row to the &amp;quot;policy&amp;quot; section in your &#039;&#039;Policy&#039;&#039; file in order to see the dropped packets.&lt;br /&gt;
&amp;lt;pre&amp;gt;{ &amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;loc&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;drop&amp;quot; }&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note|If you are using Alpine 2.4 repository (AWall v0.2.5 or below), you should use &amp;lt;code&amp;gt;&amp;quot;action&amp;quot;: &amp;quot;logdrop&amp;quot;&amp;lt;/code&amp;gt; in order to log dropped packets .}}&lt;br /&gt;
{{Note|If you are adding the above content to an already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
&lt;br /&gt;
== Port-Forwarding ==&lt;br /&gt;
Let&#039;s suppose you have a local web server (192.168.1.10) that you want to make accessible from the &amp;quot;inet&amp;quot;.&amp;lt;BR&amp;gt;&lt;br /&gt;
With Shorewall you would have a rule like this in your {{Path|/etc/shorewall/rules}}:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#ACTION  SOURCE  DEST               PROTO  DEST    SOURCE    ORIGINAL&lt;br /&gt;
#                                          PORT(S) PORT(S)   DEST&lt;br /&gt;
DNAT     inet     loc:192.168.1.10  tcp    80&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lets configure our AWall &#039;&#039;Policy&#039;&#039; file likewise by adding the following content.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;APACHE&amp;quot;: &amp;quot;192.168.1.10&amp;quot;,&lt;br /&gt;
    &amp;quot;STATIC_IP&amp;quot;: &amp;quot;1.2.3.4&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;$STATIC_IP&amp;quot;, &lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;http&amp;quot;, &lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;, &lt;br /&gt;
      &amp;quot;dnat&amp;quot;: &amp;quot;$APACHE&amp;quot; &lt;br /&gt;
      }&lt;br /&gt;
    ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see in the above example, we create a&lt;br /&gt;
* &amp;quot;variable&amp;quot; section where we specify some IP-addresses&lt;br /&gt;
* &amp;quot;filter&amp;quot; section where we do the actual port-forwarding (using the variables we just created and using some preexisting &amp;quot;services&amp;quot; definitions)&lt;br /&gt;
{{Note|If you are adding the above content to a already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
{{Tip|AWall already has a &amp;quot;service&amp;quot; definition list for several services like HTTP, FTP, SNMP, etc. &#039;&#039;(see {{Path|/usr/share/awall/mandatory/services.json}})&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
== Create your own service definitions ==&lt;br /&gt;
You can add your own service definitions into your &#039;&#039;Policy&#039;&#039; files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;service&amp;quot;: {  &lt;br /&gt;
  &amp;quot;openvpn&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;udp&amp;quot;, &amp;quot;port&amp;quot;: 1194 }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note|You can not override a &amp;quot;service&amp;quot; definition that comes from {{Path|/usr/share/awall/mandatory/services.json}} }}&lt;br /&gt;
{{Note|If you are adding the above content to a already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
&lt;br /&gt;
== Inherit services or variables == &lt;br /&gt;
You can import a &#039;&#039;Policy&#039;&#039; into other &#039;&#039;Policy&#039;&#039; files for inheriting services or variables definitions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;import&amp;quot;: &amp;quot;myfirewall&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Specify load order ==&lt;br /&gt;
By default policies are loaded on alphabetical order.&amp;lt;BR&amp;gt;&lt;br /&gt;
You can change the load order with the keywords &amp;quot;before&amp;quot; and &amp;quot;after&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;before&amp;quot;: &amp;quot;myfirewall&amp;quot;&lt;br /&gt;
&amp;quot;after&amp;quot;: &amp;quot;someotherpolicy&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Other =&lt;br /&gt;
== Permanently save config ==&lt;br /&gt;
If you are running from read-only medium (from CD, USB or CF) you will need to make sure your &#039;&#039;Policy&#039;&#039; files gets permanently saved until next reboot.&lt;br /&gt;
{{cmd|lbu inc &amp;lt;var&amp;gt;/usr/share/awall/optional/&amp;lt;/var&amp;gt;   # This tells lbu to include that path when creating a new apkovl&lt;br /&gt;
lbu ci                               # This creates the new apkovl}}&lt;br /&gt;
&lt;br /&gt;
== Help and debugging ==&lt;br /&gt;
If you end up in some kind of trouble, you might find some commands useful when debugging:&lt;br /&gt;
{{cmd|awall                 # (With no parameters) Shows some basic help about awall application&lt;br /&gt;
iptables -L -n        # Show what&#039;s in &amp;lt;code&amp;gt;iptables&amp;lt;/code&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Template:Pkg&amp;diff=8475</id>
		<title>Template:Pkg</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Template:Pkg&amp;diff=8475"/>
		<updated>2012-10-15T14:49:49Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Trying to bugfix firefox, chrome and some other browsers displaying monospace chars too small&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;{{Template}}&lt;br /&gt;
An inline link to search for the given package in the Package Browser.&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
&amp;lt;pre&amp;gt;{{Pkg|package}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Note: This template will search for package in the official repos. Thus, if package-foo and package-bar exist, all matching variations will be listed. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Special characters in the package name are automatically encoded in the URL.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&amp;lt;pre&amp;gt;{{Pkg|gtk+2.0}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
will produce:&lt;br /&gt;
{{Pkg|gtk+2.0}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&amp;lt;includeonly&amp;gt;&amp;lt;span class=&amp;quot;plainlinks&amp;quot; style=&amp;quot;font-family: monospace, Courier;font-size:10pt;&amp;quot;&amp;gt;[http://alpinelinux.org/apk/main/x86/{{urlencode:{{{1}}}}} {{{1}}}]&amp;lt;/span&amp;gt;&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Stream_a_DV-camera_using_vlc&amp;diff=8474</id>
		<title>Stream a DV-camera using vlc</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Stream_a_DV-camera_using_vlc&amp;diff=8474"/>
		<updated>2012-10-15T14:46:31Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: /* Install programs */ Note that you must install vlc-qt to get the graphical part of &amp;#039;vlc&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{draft}}&lt;br /&gt;
In this howto we are going to stream the video coming from a DV-camera connected through ie1394 (firewire).&amp;lt;BR&amp;gt;&lt;br /&gt;
vlc is used to stream the content.&amp;lt;BR&amp;gt;&lt;br /&gt;
We will be using h264 and AAC to transcode the stream &#039;&#039;(should be fairly easy to change to whatever suits your needs)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
= Setup Alpine =&lt;br /&gt;
== Initial Setup ==&lt;br /&gt;
Follow [[Installing_Alpine]] to setup Alpine Linux.&lt;br /&gt;
&lt;br /&gt;
== Install programs ==&lt;br /&gt;
{{Cmd| apk add vlc-daemon vlc-dev }}&lt;br /&gt;
{{note|If you intend to use a desktop environment with vlc you will need to install {{pkg|vlc-qt}} in order to get that working.&amp;lt;BR&amp;gt;{{pkg|vlc-dev}} or {{pkg|vlc}} package does not contain the graphical part of vlc &#039;&#039;(menus etc.)&#039;&#039;.}}&lt;br /&gt;
{{todo| I haven&#039;t figured out why vlc-dev is needed. Manually adding all vlc-dev dependencies does not work.&amp;lt;BR&amp;gt;&lt;br /&gt;
The &#039;require vlc-dev&#039; thing is reported at http://bugs.alpinelinux.org/issues/1051 and might be solved soon &#039;&#039;(or &#039;vlc-dev&#039; really is needed as a dependency)&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
== Using ACF to control vlc ==&lt;br /&gt;
{{tip|A easy way to control vlc-daemon would be through [[ACF]]. Consider following these simple steps.&amp;lt;BR&amp;gt;&lt;br /&gt;
But as it is &#039;&#039;optional&#039;&#039; you could just skip this [[ACF]] section.}}&lt;br /&gt;
Setup/install acf &#039;&#039;(unless it&#039;s not already done)&#039;&#039;.&lt;br /&gt;
{{cmd| setup-acf}}&lt;br /&gt;
Install acf-package for vlc&lt;br /&gt;
{{cmd| apk add acf-vlc-daemon}}&lt;br /&gt;
We won&#039;t describe in this tutorial how you would use [[ACF]] to control vlc-daemon &#039;&#039;(basically because it&#039;s so simple it does not need any describing)&#039;&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
If you installed [[ACF]], just browse https://ip.of.your.box and you would from this tutorial understand what to do.&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Configure vlc =&lt;br /&gt;
Configuration is done by modifying &#039;/etc/conf.d/vlc&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
Here comes the actual configuration that makes vlc stream the DV-camera.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
###############&lt;br /&gt;
BITRATE=500&lt;br /&gt;
XRES=720&lt;br /&gt;
YRES=576&lt;br /&gt;
&lt;br /&gt;
###############&lt;br /&gt;
# Chose one of the following &#039;preset&#039; values depending on how fast your CPU is:&lt;br /&gt;
#   ultrafast,superfast,veryfast,faster,fast,medium,slow,slower,veryslow,placebo&lt;br /&gt;
TVIDEO=&amp;quot;venc=x264{preset=ultrafast,vbv-maxrate=${BITRATE},vbv-bufsize=256,keyint=250,min-keyint=25},vcodec=h264,vb=${BITRATE},scale=1,width=${XRES},height=${YRES}&amp;quot;&lt;br /&gt;
TAUDIO=&amp;quot;acodec=mp4a,ab=96,channels=2,samplerate=44100&amp;quot;&lt;br /&gt;
TMISC=&amp;quot;deinterlace,audio-sync&amp;quot;&lt;br /&gt;
&lt;br /&gt;
###############&lt;br /&gt;
TRANSPORT=&amp;quot;std{access=http,mux=ts,dst=:8080}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
VLC_OPTS=&amp;quot;--daemon -I dummy dv:///dev/fw0 --rawdv-hurry-up --sout-keep --sout-transcode-audio-sync \&lt;br /&gt;
--file-logging --logfile /var/log/vlc/vlc.log \&lt;br /&gt;
--sout #transcode{$TVIDEO,$TAUDIO,$TMISC}:$TRANSPORT&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Start it up =&lt;br /&gt;
== Prepare the hardware ==&lt;br /&gt;
Here comes the hardest part in this tutorial... Attach the DV-camera to your ie1394/firewire port.&amp;lt;BR&amp;gt;&lt;br /&gt;
Well... that wasn&#039;t too hard! :-)&lt;br /&gt;
&lt;br /&gt;
== Manual start ==&lt;br /&gt;
Start vlc-daemon either from terminal:&lt;br /&gt;
{{cmd|/etc/init.d/vlc start}}&lt;br /&gt;
or using ACF and just klick [Start].&lt;br /&gt;
&lt;br /&gt;
== Make it start at next reboot ==&lt;br /&gt;
You might want to make it automatically start at next reboot&lt;br /&gt;
{{cmd|rc-update add vlc-daemon default}}&lt;br /&gt;
&lt;br /&gt;
== Debug ==&lt;br /&gt;
In case something goes wrong, consider looking at the logfiles.&lt;br /&gt;
{{cmd|less -I /var/log/vlc/vlc.log}}&lt;br /&gt;
If you don&#039;t find any useful information you could add verbosity by adding &#039;-v&#039; or &#039;-vv&#039; to /etc/conf.d/vlc and restart vlc &#039;&#039;(you would need to restart vlc-daemon to see more information in the logs)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[Category:Multimedia]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Template:Path&amp;diff=8472</id>
		<title>Template:Path</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Template:Path&amp;diff=8472"/>
		<updated>2012-10-12T16:51:37Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Bugfix causing font&amp;#039;s to be displayed too small in some browsers&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;{{Template}}&lt;br /&gt;
Formats pathnames.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;{{Path|/etc/network/interfaces}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will produce:&lt;br /&gt;
{{Path|/etc/network/interfaces}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&amp;lt;includeonly&amp;gt;&amp;lt;span style=&amp;quot;font-family: monospace, Courier; font-size:10pt; color: #000055; white-space: nowrap&amp;quot;&amp;gt;{{{1}}}&amp;lt;/span&amp;gt;&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Template:Path&amp;diff=8471</id>
		<title>Template:Path</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Template:Path&amp;diff=8471"/>
		<updated>2012-10-12T16:50:38Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Reverted edits by Mhavela (talk) to last revision by Dubiousjim&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;{{Template}}&lt;br /&gt;
Formats pathnames.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;{{Path|/etc/network/interfaces}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will produce:&lt;br /&gt;
{{Path|/etc/network/interfaces}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&amp;lt;includeonly&amp;gt;&amp;lt;span style=&amp;quot;font-family: monospace; color: #000055; white-space: nowrap&amp;quot;&amp;gt;{{{1}}}&amp;lt;/span&amp;gt;&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Template:Path&amp;diff=8470</id>
		<title>Template:Path</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Template:Path&amp;diff=8470"/>
		<updated>2012-10-12T16:49:46Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Modifying font-size&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;{{Template}}&lt;br /&gt;
Formats pathnames.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;{{Path|/etc/network/interfaces}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will produce:&lt;br /&gt;
{{Path|/etc/network/interfaces}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&amp;lt;includeonly&amp;gt;&amp;lt;span style=&amp;quot;font-family: monospace, Courier; font-size:12pt; color: #000055; white-space: nowrap&amp;quot;&amp;gt;{{{1}}}&amp;lt;/span&amp;gt;&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Template:Path&amp;diff=8469</id>
		<title>Template:Path</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Template:Path&amp;diff=8469"/>
		<updated>2012-10-12T16:49:21Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Bugfix causing font&amp;#039;s to be displayed too small in some browsers&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;{{Template}}&lt;br /&gt;
Formats pathnames.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;{{Path|/etc/network/interfaces}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will produce:&lt;br /&gt;
{{Path|/etc/network/interfaces}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&amp;lt;includeonly&amp;gt;&amp;lt;span style=&amp;quot;font-family: monospace, Courier; font-size:10pt; color: #000055; white-space: nowrap&amp;quot;&amp;gt;{{{1}}}&amp;lt;/span&amp;gt;&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=How-To_Alpine_Wall&amp;diff=8468</id>
		<title>How-To Alpine Wall</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=How-To_Alpine_Wall&amp;diff=8468"/>
		<updated>2012-10-12T16:47:03Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Using the &amp;#039;Path&amp;#039; template to display file/folder paths (didn&amp;#039;t know there existed a &amp;#039;Path&amp;#039; template)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
&lt;br /&gt;
= General =&lt;br /&gt;
Purpose of this doc is to illustrate Alpine Wall (AWall) by examples.&amp;lt;BR&amp;gt;&lt;br /&gt;
We will explain AWall from the viewpoint of a Shorewall user.&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
AWall is available since Alpine v2.4.&amp;lt;BR&amp;gt;&lt;br /&gt;
Please see [[Alpine_Wall_User&#039;s_Guide]] for details about the syntax. &lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
Your AWall firewall configuration file(s) goes to {{Path|/usr/share/awall/optional}}.&amp;lt;BR&amp;gt;&lt;br /&gt;
You may have multiple configuration files &#039;&#039;(it is useful to have separate files for eg. HTTP,FTP and other roles)&#039;&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
Each such file is called &#039;&#039;Policy&#039;&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
The &#039;&#039;Policy(s)&#039;&#039; can be enabled or disabled by using the &amp;quot;awall [enable|disable]&amp;quot; command.&lt;br /&gt;
{{note|AWalls &#039;&#039;Policy&#039;&#039; files are not equivalent to Shorewalls {{Path|/etc/shorewall/policy}} file.}}&lt;br /&gt;
&lt;br /&gt;
An AWall &#039;&#039;Policy&#039;&#039; can contain definitions of:&lt;br /&gt;
* variables &#039;&#039;(like {{Path|/etc/shorewall/params}})&#039;&#039;&lt;br /&gt;
* zones &#039;&#039;(like {{Path|/etc/shorewall/zones}})&#039;&#039;&lt;br /&gt;
* interfaces &#039;&#039;(like {{Path|/etc/shorewall/interfaces}})&#039;&#039;&lt;br /&gt;
* policies &#039;&#039;(like {{Path|/etc/shorewall/policy}})&#039;&#039;&lt;br /&gt;
* filters and NAT rules &#039;&#039;(like {{Path|/etc/shorewall/rules}})&#039;&#039;&lt;br /&gt;
* services &#039;&#039;(like {{Path|/usr/share/shorewall/macro.HTTP}})&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
After installing awall package, you need to load the following iptables modules:&lt;br /&gt;
{{cmd|modprobe ip_tables&lt;br /&gt;
modprobe iptable_nat    #if NAT is used}}&lt;br /&gt;
&lt;br /&gt;
This is needed only the first time, after AWall installation.&lt;br /&gt;
&lt;br /&gt;
Make the firewall autostart at boot and autoload the needed modules:&lt;br /&gt;
{{cmd|rc-update add iptables}}&lt;br /&gt;
&lt;br /&gt;
= A Basic Home Firewall =&lt;br /&gt;
We will give a example on how you can convert a &amp;quot;Basic home firewall&amp;quot; from Shorewall to AWall.&lt;br /&gt;
&lt;br /&gt;
== Example firewall using Shorewall ==&lt;br /&gt;
Let&#039;s suppose you have the following Shorewall configuration:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/zones&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inet  ipv4&lt;br /&gt;
loc   ipv4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/interfaces&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inet  eth0&lt;br /&gt;
loc   eth1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/policy&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fw   all  ACCEPT&lt;br /&gt;
loc  inet ACCEPT&lt;br /&gt;
all  all  DROP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/masq&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
eth0  0.0.0.0/0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example firewall using AWall ==&lt;br /&gt;
Now we will configure AWall to do the same thing as we just did with the above Shorewall example.&lt;br /&gt;
&lt;br /&gt;
Create a new file called {{Path|/usr/share/awall/optional/test-policy.json}} and add the following content to the file.&amp;lt;BR&amp;gt;&lt;br /&gt;
{{Tip|You could call it something else as long as you save it in {{Path|/usr/share/awall/optional/}} and name it {{Path|???&#039;&#039;&#039;.json&#039;&#039;&#039;}})}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Home firewall&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;inet&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;eth0&amp;quot; },&lt;br /&gt;
    &amp;quot;loc&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;eth1&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;policy&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;loc&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;snat&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;masquerade&amp;quot; }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above configuration will:&lt;br /&gt;
* Create a description of your &#039;&#039;Policy&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;zones&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;policy&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;snat&#039;&#039; &#039;&#039;(to masqurade the outgoing traffic)&#039;&#039;&lt;br /&gt;
{{Note|&#039;&#039;snat&#039;&#039; means &amp;quot;source NAT&amp;quot;. It does &amp;lt;u&amp;gt;not&amp;lt;/u&amp;gt; mean &amp;quot;static NAT&amp;quot;.}}&lt;br /&gt;
{{Tip| AWall has a built-in zone named &amp;quot;_fw&amp;quot; which is the &amp;quot;firewall itself&amp;quot;. This corresponds to the Shorewall &amp;quot;fw&amp;quot; zone.}}&lt;br /&gt;
{{Todo|There is something wrong with awall/iptables/other, when using the &#039;&#039;snat&#039;&#039; section (due to the &amp;quot;masquerade&amp;quot;).&amp;lt;br&amp;gt;&lt;br /&gt;
This needs some research and/or modify this wiki doc.}}&lt;br /&gt;
&lt;br /&gt;
=== Activating/Applying a Policy ===&lt;br /&gt;
After saving the &#039;&#039;Policy&#039;&#039; you can run the following commands to activate your firewall settings:&lt;br /&gt;
{{cmd|awall list                  # Listing available &#039;Policy(s)&#039; (This step is optional)&lt;br /&gt;
awall enable test-policy    # Enables the &#039;Policy&#039;&lt;br /&gt;
awall activate              # Genereates firewall configuration from the &#039;Policy&#039; files and enables it (starts the firewall)}}&lt;br /&gt;
&lt;br /&gt;
If you have multiple policies, after enabling or disabling them, you need to always run &#039;&#039;awall activate&#039;&#039; in order to update the iptables rules.&lt;br /&gt;
&lt;br /&gt;
= Advanced Firewall settings =&lt;br /&gt;
Assuming you have your {{Path|/usr/share/awall/optional/test-policy.json}} with your &amp;quot;Basic home firewall&amp;quot; settings, you could choose to modify that file to test the below examples.&lt;br /&gt;
{{tip|You could create new files in {{Path|/usr/share/awall/optional/}} for testing some of the below examples}}&lt;br /&gt;
&lt;br /&gt;
== Logging ==&lt;br /&gt;
AWall will &#039;&#039;(since v0.2.7)&#039;&#039; automatically log dropped packets.&amp;lt;BR&amp;gt;&lt;br /&gt;
You could add the following row to the &amp;quot;policy&amp;quot; section in your &#039;&#039;Policy&#039;&#039; file in order to see the dropped packets.&lt;br /&gt;
&amp;lt;pre&amp;gt;{ &amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;loc&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;drop&amp;quot; }&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note|If you are using Alpine 2.4 repository (AWall v0.2.5 or below), you should use &amp;lt;code&amp;gt;&amp;quot;action&amp;quot;: &amp;quot;logdrop&amp;quot;&amp;lt;/code&amp;gt; in order to log dropped packets .}}&lt;br /&gt;
{{Note|If you are adding the above content to an already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
&lt;br /&gt;
== Port-Forwarding ==&lt;br /&gt;
Let&#039;s suppose you have a local web server (192.168.1.10) that you want to make accessible from the &amp;quot;inet&amp;quot;.&amp;lt;BR&amp;gt;&lt;br /&gt;
With Shorewall you would have a rule like this in your {{Path|/etc/shorewall/rules}}:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#ACTION  SOURCE  DEST               PROTO  DEST    SOURCE    ORIGINAL&lt;br /&gt;
#                                          PORT(S) PORT(S)   DEST&lt;br /&gt;
DNAT     inet     loc:192.168.1.10  tcp    80&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lets configure our AWall &#039;&#039;Policy&#039;&#039; file likewise by adding the following content.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;APACHE&amp;quot;: &amp;quot;192.168.1.10&amp;quot;,&lt;br /&gt;
    &amp;quot;STATIC_IP&amp;quot;: &amp;quot;1.2.3.4&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;$STATIC_IP&amp;quot;, &lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;http&amp;quot;, &lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;, &lt;br /&gt;
      &amp;quot;dnat&amp;quot;: &amp;quot;$APACHE&amp;quot; &lt;br /&gt;
      }&lt;br /&gt;
    ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see in the above example, we create a&lt;br /&gt;
* &amp;quot;variable&amp;quot; section where we specify some IP-addresses&lt;br /&gt;
* &amp;quot;filter&amp;quot; section where we do the actual port-forwarding (using the variables we just created and using some preexisting &amp;quot;services&amp;quot; definitions)&lt;br /&gt;
{{Note|If you are adding the above content to a already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
{{Tip|AWall already has a &amp;quot;service&amp;quot; definition list for several services like HTTP, FTP, SNMP, etc. &#039;&#039;(see {{Path|/usr/share/awall/mandatory/services.json}})&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
== Create your own service definitions ==&lt;br /&gt;
You can add your own service definitions into your &#039;&#039;Policy&#039;&#039; files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;service&amp;quot;: {  &lt;br /&gt;
  &amp;quot;openvpn&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;udp&amp;quot;, &amp;quot;port&amp;quot;: 1194 }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note|You can not override a &amp;quot;service&amp;quot; definition that comes from {{Path|/usr/share/awall/mandatory/services.json}} }}&lt;br /&gt;
{{Note|If you are adding the above content to a already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
&lt;br /&gt;
== Inherit services or variables == &lt;br /&gt;
You can import a &#039;&#039;Policy&#039;&#039; into other &#039;&#039;Policy&#039;&#039; files for inheriting services or variables definitions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;import&amp;quot;: &amp;quot;myfirewall&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Specify load order ==&lt;br /&gt;
By default policies are loaded on alphabetical order.&amp;lt;BR&amp;gt;&lt;br /&gt;
You can change the load order with the keywords &amp;quot;before&amp;quot; and &amp;quot;after&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;before&amp;quot;: &amp;quot;myfirewall&amp;quot;&lt;br /&gt;
&amp;quot;after&amp;quot;: &amp;quot;someotherpolicy&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Other =&lt;br /&gt;
== Permanently save config ==&lt;br /&gt;
If you are running from read-only medium (from CD, USB or CF) you will need to make sure your &#039;&#039;Policy&#039;&#039; files gets permanently saved until next reboot.&lt;br /&gt;
{{cmd|lbu inc &amp;lt;var&amp;gt;/usr/share/awall/optional/&amp;lt;/var&amp;gt;   # This tells lbu to include that path when creating a new apkovl&lt;br /&gt;
lbu ci                               # This creates the new apkovl}}&lt;br /&gt;
&lt;br /&gt;
== Help and debugging ==&lt;br /&gt;
If you end up in some kind of trouble, you might find some commands useful when debugging:&lt;br /&gt;
{{cmd|awall                 # (With no parameters) Shows some basic help about awall application&lt;br /&gt;
iptables -L -n        # Show what&#039;s in &amp;lt;code&amp;gt;iptables&amp;lt;/code&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=How-To_Alpine_Wall&amp;diff=8467</id>
		<title>How-To Alpine Wall</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=How-To_Alpine_Wall&amp;diff=8467"/>
		<updated>2012-10-12T15:44:26Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Something wrong with snat/masquerade - needs fixing&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
&lt;br /&gt;
= General =&lt;br /&gt;
Purpose of this doc is to illustrate Alpine Wall (AWall) by examples.&amp;lt;BR&amp;gt;&lt;br /&gt;
We will explain AWall from the viewpoint of a Shorewall user.&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
AWall is available since Alpine v2.4.&amp;lt;BR&amp;gt;&lt;br /&gt;
Please see [[Alpine_Wall_User&#039;s_Guide]] for details about the syntax. &lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
Your AWall firewall configuration file(s) goes to &amp;lt;code&amp;gt;/usr/share/awall/optional&amp;lt;/code&amp;gt;.&amp;lt;BR&amp;gt;&lt;br /&gt;
You may have multiple configuration files &#039;&#039;(it is useful to have separate files for eg. HTTP,FTP and other roles)&#039;&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
Each such file is called &#039;&#039;Policy&#039;&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
The &#039;&#039;Policy(s)&#039;&#039; can be enabled or disabled by using the &amp;quot;awall [enable|disable]&amp;quot; command.&lt;br /&gt;
{{note|AWalls &#039;&#039;Policy&#039;&#039; files are not equivalent to Shorewalls &amp;lt;code&amp;gt;/etc/shorewall/policy&amp;lt;/code&amp;gt; file.}}&lt;br /&gt;
&lt;br /&gt;
An AWall &#039;&#039;Policy&#039;&#039; can contain definitions of:&lt;br /&gt;
* variables &#039;&#039;(like &amp;lt;code&amp;gt;/etc/shorewall/params&amp;lt;/code&amp;gt;)&#039;&#039;&lt;br /&gt;
* zones &#039;&#039;(like &amp;lt;code&amp;gt;/etc/shorewall/zones&amp;lt;/code&amp;gt;)&#039;&#039;&lt;br /&gt;
* interfaces &#039;&#039;(like &amp;lt;code&amp;gt;/etc/shorewall/interfaces&amp;lt;/code&amp;gt;)&#039;&#039;&lt;br /&gt;
* policies &#039;&#039;(like &amp;lt;code&amp;gt;/etc/shorewall/policy&amp;lt;/code&amp;gt;)&#039;&#039;&lt;br /&gt;
* filters and NAT rules &#039;&#039;(like &amp;lt;code&amp;gt;/etc/shorewall/rules&amp;lt;/code&amp;gt;)&#039;&#039;&lt;br /&gt;
* services &#039;&#039;(like &amp;lt;code&amp;gt;/usr/share/shorewall/macro.HTTP&amp;lt;/code&amp;gt;)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
After installing awall package, you need to load the following iptables modules:&lt;br /&gt;
{{cmd|modprobe ip_tables&lt;br /&gt;
modprobe iptable_nat    #if NAT is used}}&lt;br /&gt;
&lt;br /&gt;
This is needed only the first time, after AWall installation.&lt;br /&gt;
&lt;br /&gt;
Make the firewall autostart at boot and autoload the needed modules:&lt;br /&gt;
{{cmd|rc-update add iptables}}&lt;br /&gt;
&lt;br /&gt;
= A Basic Home Firewall =&lt;br /&gt;
We will give a example on how you can convert a &amp;quot;Basic home firewall&amp;quot; from Shorewall to AWall.&lt;br /&gt;
&lt;br /&gt;
== Example firewall using Shorewall ==&lt;br /&gt;
Let&#039;s suppose you have the following Shorewall configuration:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/zones&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inet  ipv4&lt;br /&gt;
loc   ipv4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/interfaces&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inet  eth0&lt;br /&gt;
loc   eth1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/policy&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fw   all  ACCEPT&lt;br /&gt;
loc  inet ACCEPT&lt;br /&gt;
all  all  DROP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/masq&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
eth0  0.0.0.0/0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example firewall using AWall ==&lt;br /&gt;
Now we will configure AWall to do the same thing as we just did with the above Shorewall example.&lt;br /&gt;
&lt;br /&gt;
Create a new file called &amp;lt;code&amp;gt;/usr/share/awall/optional/test-policy.json&amp;lt;/code&amp;gt; and add the following content to the file.&amp;lt;BR&amp;gt;&lt;br /&gt;
{{Tip|You could call it something else as long as you save it in &amp;lt;code&amp;gt;/usr/share/awall/optional/&amp;lt;/code&amp;gt; and name it &amp;lt;code&amp;gt;???&#039;&#039;&#039;.json&#039;&#039;&#039;&amp;lt;/code&amp;gt;)}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Home firewall&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;inet&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;eth0&amp;quot; },&lt;br /&gt;
    &amp;quot;loc&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;eth1&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;policy&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;loc&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;snat&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;masquerade&amp;quot; }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above configuration will:&lt;br /&gt;
* Create a description of your &#039;&#039;Policy&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;zones&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;policy&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;snat&#039;&#039; &#039;&#039;(to masqurade the outgoing traffic)&#039;&#039;&lt;br /&gt;
{{Note|&#039;&#039;snat&#039;&#039; means &amp;quot;source NAT&amp;quot;. It does &amp;lt;u&amp;gt;not&amp;lt;/u&amp;gt; mean &amp;quot;static NAT&amp;quot;.}}&lt;br /&gt;
{{Tip| AWall has a built-in zone named &amp;quot;_fw&amp;quot; which is the &amp;quot;firewall itself&amp;quot;. This corresponds to the Shorewall &amp;quot;fw&amp;quot; zone.}}&lt;br /&gt;
{{Todo|There is something wrong with awall/iptables/other, when using the &#039;&#039;snat&#039;&#039; section (due to the &amp;quot;masquerade&amp;quot;).&amp;lt;br&amp;gt;&lt;br /&gt;
This needs some research and/or modify this wiki doc.}}&lt;br /&gt;
&lt;br /&gt;
=== Activating/Applying a Policy ===&lt;br /&gt;
After saving the &#039;&#039;Policy&#039;&#039; you can run the following commands to activate your firewall settings:&lt;br /&gt;
{{cmd|awall list                  # Listing available &#039;Policy(s)&#039; (This step is optional)&lt;br /&gt;
awall enable test-policy    # Enables the &#039;Policy&#039;&lt;br /&gt;
awall activate              # Genereates firewall configuration from the &#039;Policy&#039; files and enables it (starts the firewall)}}&lt;br /&gt;
&lt;br /&gt;
If you have multiple policies, after enabling or disabling them, you need to always run &#039;&#039;awall activate&#039;&#039; in order to update the iptables rules.&lt;br /&gt;
&lt;br /&gt;
= Advanced Firewall settings =&lt;br /&gt;
Assuming you have your &amp;lt;code&amp;gt;/usr/share/awall/optional/test-policy.json&amp;lt;/code&amp;gt; with your &amp;quot;Basic home firewall&amp;quot; settings, you could choose to modify that file to test the below examples.&lt;br /&gt;
{{tip|You could create new files in &amp;lt;code&amp;gt;/usr/share/awall/optional/&amp;lt;/code&amp;gt; for testing some of the below examples}}&lt;br /&gt;
&lt;br /&gt;
== Logging ==&lt;br /&gt;
AWall will &#039;&#039;(since v0.2.7)&#039;&#039; automatically log dropped packets. If you are using Alpine 2.4 repository (AWall v0.2.5 or below), you should use &#039;&#039;&amp;quot;action&amp;quot;: &amp;quot;logdrop&amp;quot;&#039;&#039; in order to log dropped packets.&amp;lt;br&amp;gt;&lt;br /&gt;
You could add the following row to the &amp;quot;policy&amp;quot; section in your &#039;&#039;Policy&#039;&#039; file in order to see the dropped packets.&lt;br /&gt;
&amp;lt;pre&amp;gt;{ &amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;loc&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;drop&amp;quot; }&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you are adding the above content to an already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
&lt;br /&gt;
== Port-Forwarding ==&lt;br /&gt;
Let&#039;s suppose you have a local web server (192.168.1.10) that you want to make accessible from the &amp;quot;inet&amp;quot;.&amp;lt;BR&amp;gt;&lt;br /&gt;
With Shorewall you would have a rule like this in your &amp;lt;code&amp;gt;/etc/shorewall/rules&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#ACTION  SOURCE  DEST               PROTO  DEST    SOURCE    ORIGINAL&lt;br /&gt;
#                                          PORT(S) PORT(S)   DEST&lt;br /&gt;
DNAT     inet     loc:192.168.1.10  tcp    80&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lets configure our AWall &#039;&#039;Policy&#039;&#039; file likewise by adding the following content.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;APACHE&amp;quot;: &amp;quot;192.168.1.10&amp;quot;,&lt;br /&gt;
    &amp;quot;STATIC_IP&amp;quot;: &amp;quot;1.2.3.4&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;$STATIC_IP&amp;quot;, &lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;http&amp;quot;, &lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;, &lt;br /&gt;
      &amp;quot;dnat&amp;quot;: &amp;quot;$APACHE&amp;quot; &lt;br /&gt;
      }&lt;br /&gt;
    ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see in the above example, we create a&lt;br /&gt;
* &amp;quot;variable&amp;quot; section where we specify some IP-addresses&lt;br /&gt;
* &amp;quot;filter&amp;quot; section where we do the actual port-forwarding (using the variables we just created and using some preexisting &amp;quot;services&amp;quot; definitions)&lt;br /&gt;
{{Note|If you are adding the above content to a already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
{{Tip|AWall already has a &amp;quot;service&amp;quot; definition list for several services like HTTP, FTP, SNMP, etc. &#039;&#039;(see &amp;lt;code&amp;gt;/usr/share/awall/mandatory/services.json&amp;lt;/code&amp;gt;)&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
== Create your own service definitions ==&lt;br /&gt;
You can add your own service definitions into your &#039;&#039;Policy&#039;&#039; files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;service&amp;quot;: {  &lt;br /&gt;
  &amp;quot;openvpn&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;udp&amp;quot;, &amp;quot;port&amp;quot;: 1194 }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note|You can not override a &amp;quot;service&amp;quot; definition that comes from &amp;lt;code&amp;gt;/usr/share/awall/mandatory/services.json&amp;lt;/code&amp;gt;}}&lt;br /&gt;
{{Note|If you are adding the above content to a already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
&lt;br /&gt;
== Inherit services or variables == &lt;br /&gt;
You can import a &#039;&#039;Policy&#039;&#039; into other &#039;&#039;Policy&#039;&#039; files for inheriting services or variables definitions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;import&amp;quot;: &amp;quot;myfirewall&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Specify load order ==&lt;br /&gt;
By default policies are loaded on alphabetical order.&amp;lt;BR&amp;gt;&lt;br /&gt;
You can change the load order with the keywords &amp;quot;before&amp;quot; and &amp;quot;after&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;before&amp;quot;: &amp;quot;myfirewall&amp;quot;&lt;br /&gt;
&amp;quot;after&amp;quot;: &amp;quot;someotherpolicy&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Other =&lt;br /&gt;
== Permanently save config ==&lt;br /&gt;
If you are running from read-only medium (from CD, USB or CF) you will need to make sure your &#039;&#039;Policy&#039;&#039; files gets permanently saved until next reboot.&lt;br /&gt;
{{cmd|lbu inc &amp;lt;var&amp;gt;/usr/share/awall/optional/&amp;lt;/var&amp;gt;   # This tells lbu to include that path when creating a new apkovl&lt;br /&gt;
lbu ci                               # This creates the new apkovl}}&lt;br /&gt;
&lt;br /&gt;
== Help and debugging ==&lt;br /&gt;
If you end up in some kind of trouble, you might find some commands useful when debugging:&lt;br /&gt;
{{cmd|awall                 # (With no parameters) Shows some basic help about awall application&lt;br /&gt;
iptables -L -n        # Show what&#039;s in &amp;lt;code&amp;gt;iptables&amp;lt;/code&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=How-To_Alpine_Wall&amp;diff=8466</id>
		<title>How-To Alpine Wall</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=How-To_Alpine_Wall&amp;diff=8466"/>
		<updated>2012-10-12T14:17:09Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Help/Debuggin notes. lbu inc when running from CD/USB/etc.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
&lt;br /&gt;
= General =&lt;br /&gt;
Purpose of this doc is to illustrate Alpine Wall (AWall) by examples.&amp;lt;BR&amp;gt;&lt;br /&gt;
We will explain AWall from the viewpoint of a Shorewall user.&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
AWall is available since Alpine v2.4.&amp;lt;BR&amp;gt;&lt;br /&gt;
Please see [[Alpine_Wall_User&#039;s_Guide]] for details about the syntax. &lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
Your AWall firewall configuration file(s) goes to &amp;lt;code&amp;gt;/usr/share/awall/optional&amp;lt;/code&amp;gt;.&amp;lt;BR&amp;gt;&lt;br /&gt;
You may have multiple configuration files &#039;&#039;(it is useful to have separate files for eg. HTTP,FTP and other roles)&#039;&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
Each such file is called &#039;&#039;Policy&#039;&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
The &#039;&#039;Policy(s)&#039;&#039; can be enabled or disabled by using the &amp;quot;awall [enable|disable]&amp;quot; command.&lt;br /&gt;
{{note|AWalls &#039;&#039;Policy&#039;&#039; files are not equivalent to Shorewalls &amp;lt;code&amp;gt;/etc/shorewall/policy&amp;lt;/code&amp;gt; file.}}&lt;br /&gt;
&lt;br /&gt;
An AWall &#039;&#039;Policy&#039;&#039; can contain definitions of:&lt;br /&gt;
* variables &#039;&#039;(like &amp;lt;code&amp;gt;/etc/shorewall/params&amp;lt;/code&amp;gt;)&#039;&#039;&lt;br /&gt;
* zones &#039;&#039;(like &amp;lt;code&amp;gt;/etc/shorewall/zones&amp;lt;/code&amp;gt;)&#039;&#039;&lt;br /&gt;
* interfaces &#039;&#039;(like &amp;lt;code&amp;gt;/etc/shorewall/interfaces&amp;lt;/code&amp;gt;)&#039;&#039;&lt;br /&gt;
* policies &#039;&#039;(like &amp;lt;code&amp;gt;/etc/shorewall/policy&amp;lt;/code&amp;gt;)&#039;&#039;&lt;br /&gt;
* filters and NAT rules &#039;&#039;(like &amp;lt;code&amp;gt;/etc/shorewall/rules&amp;lt;/code&amp;gt;)&#039;&#039;&lt;br /&gt;
* services &#039;&#039;(like &amp;lt;code&amp;gt;/usr/share/shorewall/macro.HTTP&amp;lt;/code&amp;gt;)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
After installing awall package, you need to load the following iptables modules:&lt;br /&gt;
{{cmd|modprobe ip_tables&lt;br /&gt;
modprobe iptable_nat    #if NAT is used}}&lt;br /&gt;
&lt;br /&gt;
This is needed only the first time, after AWall installation.&lt;br /&gt;
&lt;br /&gt;
Make the firewall autostart at boot and autoload the needed modules:&lt;br /&gt;
{{cmd|rc-update add iptables}}&lt;br /&gt;
&lt;br /&gt;
= A Basic Home Firewall =&lt;br /&gt;
We will give a example on how you can convert a &amp;quot;Basic home firewall&amp;quot; from Shorewall to AWall.&lt;br /&gt;
&lt;br /&gt;
== Example firewall using Shorewall ==&lt;br /&gt;
Let&#039;s suppose you have the following Shorewall configuration:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/zones&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inet  ipv4&lt;br /&gt;
loc   ipv4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/interfaces&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inet  eth0&lt;br /&gt;
loc   eth1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/policy&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fw   all  ACCEPT&lt;br /&gt;
loc  inet ACCEPT&lt;br /&gt;
all  all  DROP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/masq&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
eth0  0.0.0.0/0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example firewall using AWall ==&lt;br /&gt;
Now we will configure AWall to do the same thing as we just did with the above Shorewall example.&lt;br /&gt;
&lt;br /&gt;
Create a new file called &amp;lt;code&amp;gt;/usr/share/awall/optional/test-policy.json&amp;lt;/code&amp;gt; and add the following content to the file.&amp;lt;BR&amp;gt;&lt;br /&gt;
{{Tip|You could call it something else as long as you save it in &amp;lt;code&amp;gt;/usr/share/awall/optional/&amp;lt;/code&amp;gt; and name it &amp;lt;code&amp;gt;???&#039;&#039;&#039;.json&#039;&#039;&#039;&amp;lt;/code&amp;gt;)}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Home firewall&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;inet&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;eth0&amp;quot; },&lt;br /&gt;
    &amp;quot;loc&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;eth1&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;policy&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;loc&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;snat&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;masquerade&amp;quot; }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above configuration will:&lt;br /&gt;
* Create a description of your &#039;&#039;Policy&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;zones&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;policy&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;snat&#039;&#039; &#039;&#039;(to masqurade the outgoing traffic)&#039;&#039;&lt;br /&gt;
{{Note|&#039;&#039;snat&#039;&#039; means &amp;quot;source NAT&amp;quot;. It does &amp;lt;u&amp;gt;not&amp;lt;/u&amp;gt; mean &amp;quot;static NAT&amp;quot;.}}&lt;br /&gt;
{{Tip| AWall has a built-in zone named &amp;quot;_fw&amp;quot; which is the &amp;quot;firewall itself&amp;quot;. This corresponds to the Shorewall &amp;quot;fw&amp;quot; zone.}}&lt;br /&gt;
&lt;br /&gt;
=== Activating/Applying a Policy ===&lt;br /&gt;
After saving the &#039;&#039;Policy&#039;&#039; you can run the following commands to activate your firewall settings:&lt;br /&gt;
{{cmd|awall list                  # Listing available &#039;Policy(s)&#039; (This step is optional)&lt;br /&gt;
awall enable test-policy    # Enables the &#039;Policy&#039;&lt;br /&gt;
awall activate              # Genereates firewall configuration from the &#039;Policy&#039; files and enables it (starts the firewall)}}&lt;br /&gt;
&lt;br /&gt;
If you have multiple policies, after enabling or disabling them, you need to always run &#039;&#039;awall activate&#039;&#039; in order to update the iptables rules.&lt;br /&gt;
&lt;br /&gt;
= Advanced Firewall settings =&lt;br /&gt;
Assuming you have your &amp;lt;code&amp;gt;/usr/share/awall/optional/test-policy.json&amp;lt;/code&amp;gt; with your &amp;quot;Basic home firewall&amp;quot; settings, you could choose to modify that file to test the below examples.&lt;br /&gt;
{{tip|You could create new files in &amp;lt;code&amp;gt;/usr/share/awall/optional/&amp;lt;/code&amp;gt; for testing some of the below examples}}&lt;br /&gt;
&lt;br /&gt;
== Logging ==&lt;br /&gt;
AWall will &#039;&#039;(since v0.2.7)&#039;&#039; automatically log dropped packets. If you are using Alpine 2.4 repository (AWall v0.2.5 or below), you should use &#039;&#039;&amp;quot;action&amp;quot;: &amp;quot;logdrop&amp;quot;&#039;&#039; in order to log dropped packets.&amp;lt;br&amp;gt;&lt;br /&gt;
You could add the following row to the &amp;quot;policy&amp;quot; section in your &#039;&#039;Policy&#039;&#039; file in order to see the dropped packets.&lt;br /&gt;
&amp;lt;pre&amp;gt;{ &amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;loc&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;drop&amp;quot; }&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you are adding the above content to an already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
&lt;br /&gt;
== Port-Forwarding ==&lt;br /&gt;
Let&#039;s suppose you have a local web server (192.168.1.10) that you want to make accessible from the &amp;quot;inet&amp;quot;.&amp;lt;BR&amp;gt;&lt;br /&gt;
With Shorewall you would have a rule like this in your &amp;lt;code&amp;gt;/etc/shorewall/rules&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#ACTION  SOURCE  DEST               PROTO  DEST    SOURCE    ORIGINAL&lt;br /&gt;
#                                          PORT(S) PORT(S)   DEST&lt;br /&gt;
DNAT     inet     loc:192.168.1.10  tcp    80&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lets configure our AWall &#039;&#039;Policy&#039;&#039; file likewise by adding the following content.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;APACHE&amp;quot;: &amp;quot;192.168.1.10&amp;quot;,&lt;br /&gt;
    &amp;quot;STATIC_IP&amp;quot;: &amp;quot;1.2.3.4&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;$STATIC_IP&amp;quot;, &lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;http&amp;quot;, &lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;, &lt;br /&gt;
      &amp;quot;dnat&amp;quot;: &amp;quot;$APACHE&amp;quot; &lt;br /&gt;
      }&lt;br /&gt;
    ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see in the above example, we create a&lt;br /&gt;
* &amp;quot;variable&amp;quot; section where we specify some IP-addresses&lt;br /&gt;
* &amp;quot;filter&amp;quot; section where we do the actual port-forwarding (using the variables we just created and using some preexisting &amp;quot;services&amp;quot; definitions)&lt;br /&gt;
{{Note|If you are adding the above content to a already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
{{Tip|AWall already has a &amp;quot;service&amp;quot; definition list for several services like HTTP, FTP, SNMP, etc. &#039;&#039;(see &amp;lt;code&amp;gt;/usr/share/awall/mandatory/services.json&amp;lt;/code&amp;gt;)&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
== Create your own service definitions ==&lt;br /&gt;
You can add your own service definitions into your &#039;&#039;Policy&#039;&#039; files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;service&amp;quot;: {  &lt;br /&gt;
  &amp;quot;openvpn&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;udp&amp;quot;, &amp;quot;port&amp;quot;: 1194 }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note|You can not override a &amp;quot;service&amp;quot; definition that comes from &amp;lt;code&amp;gt;/usr/share/awall/mandatory/services.json&amp;lt;/code&amp;gt;}}&lt;br /&gt;
{{Note|If you are adding the above content to a already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
&lt;br /&gt;
== Inherit services or variables == &lt;br /&gt;
You can import a &#039;&#039;Policy&#039;&#039; into other &#039;&#039;Policy&#039;&#039; files for inheriting services or variables definitions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;import&amp;quot;: &amp;quot;myfirewall&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Specify load order ==&lt;br /&gt;
By default policies are loaded on alphabetical order.&amp;lt;BR&amp;gt;&lt;br /&gt;
You can change the load order with the keywords &amp;quot;before&amp;quot; and &amp;quot;after&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;before&amp;quot;: &amp;quot;myfirewall&amp;quot;&lt;br /&gt;
&amp;quot;after&amp;quot;: &amp;quot;someotherpolicy&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Other =&lt;br /&gt;
== Permanently save config ==&lt;br /&gt;
If you are running from read-only medium (from CD, USB or CF) you will need to make sure your &#039;&#039;Policy&#039;&#039; files gets permanently saved until next reboot.&lt;br /&gt;
{{cmd|lbu inc &amp;lt;var&amp;gt;/usr/share/awall/optional/&amp;lt;/var&amp;gt;   # This tells lbu to include that path when creating a new apkovl&lt;br /&gt;
lbu ci                               # This creates the new apkovl}}&lt;br /&gt;
&lt;br /&gt;
== Help and debugging ==&lt;br /&gt;
If you end up in some kind of trouble, you might find some commands useful when debugging:&lt;br /&gt;
{{cmd|awall                 # (With no parameters) Shows some basic help about awall application&lt;br /&gt;
iptables -L -n        # Show what&#039;s in &amp;lt;code&amp;gt;iptables&amp;lt;/code&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=How-To_Alpine_Wall&amp;diff=8465</id>
		<title>How-To Alpine Wall</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=How-To_Alpine_Wall&amp;diff=8465"/>
		<updated>2012-10-12T13:30:13Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Marking files and folders with &amp;#039;&amp;lt;code&amp;gt;&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
&lt;br /&gt;
= General =&lt;br /&gt;
Purpose of this doc is to illustrate Alpine Wall (AWall) by examples.&amp;lt;BR&amp;gt;&lt;br /&gt;
We will explain AWall from the viewpoint of a Shorewall user.&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
AWall is available since Alpine v2.4.&amp;lt;BR&amp;gt;&lt;br /&gt;
Please see [[Alpine_Wall_User&#039;s_Guide]] for details about the syntax. &lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
Your AWall firewall configuration file(s) goes to &amp;lt;code&amp;gt;/usr/share/awall/optional&amp;lt;/code&amp;gt;.&amp;lt;BR&amp;gt;&lt;br /&gt;
You may have multiple configuration files &#039;&#039;(it is useful to have separate files for eg. HTTP,FTP and other roles)&#039;&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
Each such file is called &#039;&#039;Policy&#039;&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
The &#039;&#039;Policy(s)&#039;&#039; can be enabled or disabled by using the &amp;quot;awall [enable|disable]&amp;quot; command.&lt;br /&gt;
{{note|AWalls &#039;&#039;Policy&#039;&#039; files are not equivalent to Shorewalls &amp;lt;code&amp;gt;/etc/shorewall/policy&amp;lt;/code&amp;gt; file.}}&lt;br /&gt;
&lt;br /&gt;
An AWall &#039;&#039;Policy&#039;&#039; can contain definitions of:&lt;br /&gt;
* variables &#039;&#039;(like &amp;lt;code&amp;gt;/etc/shorewall/params&amp;lt;/code&amp;gt;)&#039;&#039;&lt;br /&gt;
* zones &#039;&#039;(like &amp;lt;code&amp;gt;/etc/shorewall/zones&amp;lt;/code&amp;gt;)&#039;&#039;&lt;br /&gt;
* interfaces &#039;&#039;(like &amp;lt;code&amp;gt;/etc/shorewall/interfaces&amp;lt;/code&amp;gt;)&#039;&#039;&lt;br /&gt;
* policies &#039;&#039;(like &amp;lt;code&amp;gt;/etc/shorewall/policy&amp;lt;/code&amp;gt;)&#039;&#039;&lt;br /&gt;
* filters and NAT rules &#039;&#039;(like &amp;lt;code&amp;gt;/etc/shorewall/rules&amp;lt;/code&amp;gt;)&#039;&#039;&lt;br /&gt;
* services &#039;&#039;(like &amp;lt;code&amp;gt;/usr/share/shorewall/macro.HTTP&amp;lt;/code&amp;gt;)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
After installing awall package, you need to load the following iptables modules:&lt;br /&gt;
{{cmd|modprobe ip_tables&lt;br /&gt;
modprobe iptable_nat    #if NAT is used}}&lt;br /&gt;
&lt;br /&gt;
This is needed only the first time, after AWall installation.&lt;br /&gt;
&lt;br /&gt;
Make the firewall autostart at boot and autoload the needed modules:&lt;br /&gt;
{{cmd|rc-update add iptables}}&lt;br /&gt;
&lt;br /&gt;
= A Basic Home Firewall =&lt;br /&gt;
We will give a example on how you can convert a &amp;quot;Basic home firewall&amp;quot; from Shorewall to AWall.&lt;br /&gt;
&lt;br /&gt;
== Example firewall using Shorewall ==&lt;br /&gt;
Let&#039;s suppose you have the following Shorewall configuration:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/zones&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inet  ipv4&lt;br /&gt;
loc   ipv4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/interfaces&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inet  eth0&lt;br /&gt;
loc   eth1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/policy&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fw   all  ACCEPT&lt;br /&gt;
loc  inet ACCEPT&lt;br /&gt;
all  all  DROP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;/etc/shorewall/masq&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
eth0  0.0.0.0/0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example firewall using AWall ==&lt;br /&gt;
Now we will configure AWall to do the same thing as we just did with the above Shorewall example.&lt;br /&gt;
&lt;br /&gt;
Create a new file called &amp;lt;code&amp;gt;/usr/share/awall/optional/test-policy.json&amp;lt;/code&amp;gt; and add the following content to the file.&amp;lt;BR&amp;gt;&lt;br /&gt;
{{Tip|You could call it something else as long as you save it in &amp;lt;code&amp;gt;/usr/share/awall/optional/&amp;lt;/code&amp;gt; and name it &amp;lt;code&amp;gt;???&#039;&#039;&#039;.json&#039;&#039;&#039;&amp;lt;/code&amp;gt;)}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;description&amp;quot;: &amp;quot;Home firewall&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;zone&amp;quot;: {&lt;br /&gt;
    &amp;quot;inet&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;eth0&amp;quot; },&lt;br /&gt;
    &amp;quot;loc&amp;quot;: { &amp;quot;iface&amp;quot;: &amp;quot;eth1&amp;quot; }&lt;br /&gt;
  },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;policy&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;_fw&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; },&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;loc&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot; }&lt;br /&gt;
  ],&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;snat&amp;quot;: [&lt;br /&gt;
    { &amp;quot;out&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;masquerade&amp;quot; }&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above configuration will:&lt;br /&gt;
* Create a description of your &#039;&#039;Policy&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;zones&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;policy&#039;&#039;&lt;br /&gt;
* Define &#039;&#039;snat&#039;&#039; &#039;&#039;(to masqurade the outgoing traffic)&#039;&#039;&lt;br /&gt;
{{Note|&#039;&#039;snat&#039;&#039; means &amp;quot;source NAT&amp;quot;. It does &amp;lt;u&amp;gt;not&amp;lt;/u&amp;gt; mean &amp;quot;static NAT&amp;quot;.}}&lt;br /&gt;
{{Tip| AWall has a built-in zone named &amp;quot;_fw&amp;quot; which is the &amp;quot;firewall itself&amp;quot;. This corresponds to the Shorewall &amp;quot;fw&amp;quot; zone.}}&lt;br /&gt;
&lt;br /&gt;
=== Activating/Applying a Policy ===&lt;br /&gt;
After saving the &#039;&#039;Policy&#039;&#039; you can run the following commands to activate your firewall settings:&lt;br /&gt;
{{cmd|awall list                  # Listing available &#039;Policy(s)&#039; (This step is optional)&lt;br /&gt;
awall enable test-policy    # Enables the &#039;Policy&#039;&lt;br /&gt;
awall activate              # Genereates firewall configuration from the &#039;Policy&#039; files and enables it (starts the firewall)}}&lt;br /&gt;
&lt;br /&gt;
If you have multiple policies, after enabling or disabling them, you need to always run &#039;&#039;awall activate&#039;&#039; in order to update the iptables rules.&lt;br /&gt;
&lt;br /&gt;
= Advanced Firewall settings =&lt;br /&gt;
Assuming you have your &amp;lt;code&amp;gt;/usr/share/awall/optional/test-policy.json&amp;lt;/code&amp;gt; with your &amp;quot;Basic home firewall&amp;quot; settings, you could choose to modify that file to test the below examples.&lt;br /&gt;
{{tip|You could create new files in &amp;lt;code&amp;gt;/usr/share/awall/optional/&amp;lt;/code&amp;gt; for testing some of the below examples}}&lt;br /&gt;
&lt;br /&gt;
== Logging ==&lt;br /&gt;
AWall will &#039;&#039;(since v0.2.7)&#039;&#039; automatically log dropped packets. If you are using Alpine 2.4 repository (AWall v0.2.5 or below), you should use &#039;&#039;&amp;quot;action&amp;quot;: &amp;quot;logdrop&amp;quot;&#039;&#039; in order to log dropped packets.&amp;lt;br&amp;gt;&lt;br /&gt;
You could add the following row to the &amp;quot;policy&amp;quot; section in your &#039;&#039;Policy&#039;&#039; file in order to see the dropped packets.&lt;br /&gt;
&amp;lt;pre&amp;gt;{ &amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &amp;quot;out&amp;quot;: &amp;quot;loc&amp;quot;, &amp;quot;action&amp;quot;: &amp;quot;drop&amp;quot; }&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you are adding the above content to an already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
&lt;br /&gt;
== Port-Forwarding ==&lt;br /&gt;
Let&#039;s suppose you have a local web server (192.168.1.10) that you want to make accessible from the &amp;quot;inet&amp;quot;.&amp;lt;BR&amp;gt;&lt;br /&gt;
With Shorewall you would have a rule like this in your &amp;lt;code&amp;gt;/etc/shorewall/rules&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#ACTION  SOURCE  DEST               PROTO  DEST    SOURCE    ORIGINAL&lt;br /&gt;
#                                          PORT(S) PORT(S)   DEST&lt;br /&gt;
DNAT     inet     loc:192.168.1.10  tcp    80&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lets configure our AWall &#039;&#039;Policy&#039;&#039; file likewise by adding the following content.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;variable&amp;quot;: {&lt;br /&gt;
    &amp;quot;APACHE&amp;quot;: &amp;quot;192.168.1.10&amp;quot;,&lt;br /&gt;
    &amp;quot;STATIC_IP&amp;quot;: &amp;quot;1.2.3.4&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;filter&amp;quot;: [&lt;br /&gt;
    { &amp;quot;in&amp;quot;: &amp;quot;inet&amp;quot;, &lt;br /&gt;
      &amp;quot;dest&amp;quot;: &amp;quot;$STATIC_IP&amp;quot;, &lt;br /&gt;
      &amp;quot;service&amp;quot;: &amp;quot;http&amp;quot;, &lt;br /&gt;
      &amp;quot;action&amp;quot;: &amp;quot;accept&amp;quot;, &lt;br /&gt;
      &amp;quot;dnat&amp;quot;: &amp;quot;$APACHE&amp;quot; &lt;br /&gt;
      }&lt;br /&gt;
    ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you can see in the above example, we create a&lt;br /&gt;
* &amp;quot;variable&amp;quot; section where we specify some IP-addresses&lt;br /&gt;
* &amp;quot;filter&amp;quot; section where we do the actual port-forwarding (using the variables we just created and using some preexisting &amp;quot;services&amp;quot; definitions)&lt;br /&gt;
{{Note|If you are adding the above content to a already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
{{Tip|AWall already has a &amp;quot;service&amp;quot; definition list for several services like HTTP, FTP, SNMP, etc. &#039;&#039;(see &amp;lt;code&amp;gt;/usr/share/awall/mandatory/services.json&amp;lt;/code&amp;gt;)&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
== Create your own service definitions ==&lt;br /&gt;
You can add your own service definitions into your &#039;&#039;Policy&#039;&#039; files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;service&amp;quot;: {  &lt;br /&gt;
  &amp;quot;openvpn&amp;quot;: { &amp;quot;proto&amp;quot;: &amp;quot;udp&amp;quot;, &amp;quot;port&amp;quot;: 1194 }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note|You can not override a &amp;quot;service&amp;quot; definition that comes from &amp;lt;code&amp;gt;/usr/share/awall/mandatory/services.json&amp;lt;/code&amp;gt;}}&lt;br /&gt;
{{Note|If you are adding the above content to a already existing file, then make sure you add &amp;quot;,&amp;quot; signs where they are needed!}}&lt;br /&gt;
&lt;br /&gt;
== Inherit services or variables == &lt;br /&gt;
You can import a &#039;&#039;Policy&#039;&#039; into other &#039;&#039;Policy&#039;&#039; files for inheriting services or variables definitions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;import&amp;quot;: &amp;quot;myfirewall&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Specify load order ==&lt;br /&gt;
By default policies are loaded on alphabetical order.&amp;lt;BR&amp;gt;&lt;br /&gt;
You can change the load order with the keywords &amp;quot;before&amp;quot; and &amp;quot;after&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;before&amp;quot;: &amp;quot;myfirewall&amp;quot;&lt;br /&gt;
&amp;quot;after&amp;quot;: &amp;quot;someotherpolicy&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Template:Cmd&amp;diff=8464</id>
		<title>Template:Cmd</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Template:Cmd&amp;diff=8464"/>
		<updated>2012-10-12T13:15:50Z</updated>

		<summary type="html">&lt;p&gt;Mhavela: Decreasing size (leaving &amp;#039;font-family&amp;#039; objects&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;{{Template}}&lt;br /&gt;
== Template Documentation ==&lt;br /&gt;
This template should be used for commands&amp;lt;br /&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;nowiki&amp;gt;{{Cmd|apk add &amp;lt;var&amp;gt;package&amp;lt;/var&amp;gt;}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Will produce:&lt;br /&gt;
{{Cmd|apk add &amp;lt;var&amp;gt;package&amp;lt;/var&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- background-color:#eeeeee; color:#111111; padding:.05em .5em; margin:.5em; border:1px solid #dddddd; border-left:2px solid #dddddd; white-space:pre; font-family:monospace, Courier; font-size:10pt; &lt;br /&gt;
&lt;br /&gt;
background-color:#f9f9f9&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&amp;lt;includeonly&amp;gt;&amp;lt;p style=&amp;quot;background-color:#eeeeee; border:1px dashed #bbbbbb; line-height:1.1em; padding:1em; font-family:monospace, Courier; font-size:10pt; white-space:pre; overflow:auto;&amp;quot;&amp;gt;{{{1}}}&amp;lt;/p&amp;gt;&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mhavela</name></author>
	</entry>
</feed>