<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.8.7">Jekyll</generator><link href="http://www.minhng99.cloud/feed.xml" rel="self" type="application/atom+xml" /><link href="http://www.minhng99.cloud/" rel="alternate" type="text/html" /><updated>2020-07-13T10:25:45+00:00</updated><id>http://www.minhng99.cloud/feed.xml</id><title type="html">Minh’s Scrap Yard</title><subtitle>My blog for random stuffs, including Linux tips and tricks, reversing engineering, also some random electronic projects.</subtitle><author><name>Nguyen Quang Minh</name></author><entry><title type="html">Exploring VTVcab’s router (Dasan H660DW)</title><link href="http://www.minhng99.cloud/Exploring-router-Dasan_H660DW/" rel="alternate" type="text/html" title="Exploring VTVcab's router (Dasan H660DW)" /><published>2019-01-22T00:00:00+00:00</published><updated>2019-01-22T00:00:00+00:00</updated><id>http://www.minhng99.cloud/Exploring-router-Dasan_H660DW</id><content type="html" xml:base="http://www.minhng99.cloud/Exploring-router-Dasan_H660DW/">&lt;p&gt;This post is a little bit different than usual, having me exploring my ISP router which is the &lt;em&gt;Dasan Networks H660DW&lt;/em&gt;, stay with me to see what I’ve found in the process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Disclaimer: I am not responsible for any damage you cause to your device or ISP by following this guide. Do this at your own risk!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/exploring_dasan_h660dw/1.overview.png&quot; alt=&quot;Overview of the router panel&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The default IP for this router is &lt;strong&gt;192.168.55.1&lt;/strong&gt; or &lt;strong&gt;192.168.56.1&lt;/strong&gt;, yes it has 2 separated LAN IP address. In this tutorial I’ve changed my Net ID to &lt;strong&gt;192.168.0.0&lt;/strong&gt; so the router’s IP will be &lt;strong&gt;192.168.0.1&lt;/strong&gt; because it’s faster to type.&lt;/p&gt;

&lt;p&gt;The password for this router varies by firmware, it could be &lt;strong&gt;admin:vertex25&lt;/strong&gt; or &lt;strong&gt;admin:SERIAL_NUMBER&lt;/strong&gt; with &lt;strong&gt;SERIAL_NUMBER&lt;/strong&gt; is the &lt;strong&gt;GPON S/N&lt;/strong&gt; on the label of the router.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;1-specs&quot;&gt;1. Specs:&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;1244Mb/s 1310nm DFB Upstream Burst Mode Transmitter&lt;/li&gt;
  &lt;li&gt;2488Mb/s 1490nm APD/TIA Downstream&lt;/li&gt;
  &lt;li&gt;1550nm CATV Receiver&lt;/li&gt;
  &lt;li&gt;Triplexer: Hisense LTY9775M&lt;/li&gt;
  &lt;li&gt;SC Fiber connector&lt;/li&gt;
  &lt;li&gt;5x1Gbps Ethernet Switch (4 usable)&lt;/li&gt;
  &lt;li&gt;1 CATV RF output&lt;/li&gt;
  &lt;li&gt;WIFI: Ralink RT5392L (2.4GHz Wireless access point with 2 Antenna)&lt;/li&gt;
  &lt;li&gt;SOC: Ralink MT751020 SOC (4 MIPS core)&lt;/li&gt;
  &lt;li&gt;RAM: 128MB&lt;/li&gt;
  &lt;li&gt;NAND: 128MB&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;2-access-sshtelnet&quot;&gt;2. Access SSH/Telnet:&lt;/h3&gt;

&lt;p&gt;Web interface have a lot of limitation because it’s designed for end user, what you will want to do is to talk with it natively, on some earlier firmware having SSH and Telnet enabled by default but the latest one doesn’t do that, you have to do it manually.&lt;/p&gt;

&lt;h3 id=&quot;21-enabling-sshtelnet&quot;&gt;2.1. Enabling SSH/Telnet&lt;/h3&gt;

&lt;p&gt;Go to &lt;strong&gt;Maintenance&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Utilities&lt;/strong&gt; -&amp;gt; &lt;strong&gt;ACL&lt;/strong&gt; and set it as the picture below.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ACL: Activated&lt;/strong&gt;
&lt;strong&gt;Access Control Listing&lt;/strong&gt;: This table determines which IP range are allowed to access the router’s features in the &lt;strong&gt;SCL&lt;/strong&gt;.&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;IP Address&lt;/strong&gt;: Put your LAN Network ID here&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Net Mask&lt;/strong&gt;: This is the range of the Network ID which are allowed to access &lt;strong&gt;SCL&lt;/strong&gt;, &lt;strong&gt;24&lt;/strong&gt; means from &lt;strong&gt;192.168.0.0&lt;/strong&gt; to &lt;strong&gt;192.168.0.255&lt;/strong&gt;
&lt;strong&gt;SCL&lt;/strong&gt;: This table is for enable/disable special function access.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;WAN&lt;/strong&gt;: For security reason, you should disable all the options here so people on the internet couldn’t access your router’s panel.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;LAN&lt;/strong&gt;: You could enable everything here if you want.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/exploring_dasan_h660dw/2.enablessh.png&quot; alt=&quot;Overview of the router panel&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;22-accessing-ssh&quot;&gt;2.2. Accessing SSH:&lt;/h3&gt;
&lt;p&gt;Now you should be able to access SSH/Telnet using PuTTY on Windows or ssh tools on your favorite Linux distribution.&lt;/p&gt;

&lt;p&gt;SSH credential: &lt;strong&gt;admin:YOUR_PANEL_PASSWORD&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now there’s something to notice: The router’s SSH server are using a deprecated algorithm for SSH which is not allowed to access by openssh by default, you have to put &lt;strong&gt;-oKexAlgorithms=+diffie-hellman-group1-sha1&lt;/strong&gt; to the &lt;strong&gt;ssh&lt;/strong&gt; command for login:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;user@Arch-Linux ~]&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;ssh &lt;span class=&quot;nt&quot;&gt;-oKexAlgorithms&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;+diffie-hellman-group1-sha1 admin@192.168.0.1
admin@192.168.0.1&lt;span class=&quot;s1&quot;&gt;'s password: 
# export
export HOME='&lt;/span&gt;/&lt;span class=&quot;s1&quot;&gt;'
export LOGNAME='&lt;/span&gt;admin&lt;span class=&quot;s1&quot;&gt;'
export PATH='&lt;/span&gt;/userfs/bin:/usr/sbin:/bin:/usr/bin:/sbin&lt;span class=&quot;s1&quot;&gt;'
export PWD='&lt;/span&gt;/&lt;span class=&quot;s1&quot;&gt;'
export SHELL='&lt;/span&gt;/bin/sh&lt;span class=&quot;s1&quot;&gt;'
export TERM='&lt;/span&gt;xterm-256color&lt;span class=&quot;s1&quot;&gt;'
export USER='&lt;/span&gt;admin&lt;span class=&quot;s1&quot;&gt;'
# pwd
/
# ls
bin      data     etc      linuxrc  sbin     userfs   var
boaroot  dev      lib      proc     tmp      usr
# uname -a
Linux tc 2.6.36 #1 SMP Thu Jun 22 08:40:46 UTC 2017 mips unknown
#

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;There we go, we got SSH access, this router is running a &lt;strong&gt;MIPS&lt;/strong&gt; processor with a small Linux on it, the file system is &lt;strong&gt;squashfs&lt;/strong&gt; so you can’t directly modify the file system, it’s not gonna keeping change when you reboot it, the config file is saved on a different partition.&lt;/p&gt;

&lt;h3 id=&quot;23-accessing-telnet&quot;&gt;2.3. Accessing Telnet:&lt;/h3&gt;
&lt;p&gt;This is an exciting one, for some reason, Telnet don’t allow you to login using the control panel’s credentials but it using a different password, I was able to find some documents talking about the password for this.&lt;/p&gt;

&lt;p&gt;Telnet credential: &lt;strong&gt;admin:vertex25ektks123&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;user@Arch-Linux ~]&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;telnet 192.168.0.1
Trying 192.168.0.1...
Connected to 192.168.0.1.
Escape character is &lt;span class=&quot;s1&quot;&gt;'^]'&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
tc login: admin
Password: 
&lt;span class=&quot;c&quot;&gt;# export&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;HOME&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/'&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;LOGNAME&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'admin'&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/userfs/bin:/usr/sbin:/bin:/usr/bin:/sbin'&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;PWD&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/'&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;SHELL&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/bin/sh'&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;TERM&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'vt102'&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;USER&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'admin'&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# &lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It’s still the exact same thing as SSH, not that it enable some extra privilege or something and more importantly: &lt;strong&gt;You can’t change this password, this is a serious security flaw which allow attacker to logging using a hardcoded credential, I recommeded to disable the telnet function because an attacker could do anything with this telnet access to your router&lt;/strong&gt;.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;3-ssh-exploring&quot;&gt;3. SSH exploring&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Random stuffs I’ve grabbed via SSH goes here:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Mount point, MTD info:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# mount&lt;/span&gt;
/dev/mtdblock3 on / &lt;span class=&quot;nb&quot;&gt;type &lt;/span&gt;squashfs &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;ro,relatime&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
proc on /proc &lt;span class=&quot;nb&quot;&gt;type &lt;/span&gt;proc &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;rw,relatime&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
ramfs on /tmp &lt;span class=&quot;nb&quot;&gt;type &lt;/span&gt;ramfs &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;rw,relatime&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
devpts on /dev/pts &lt;span class=&quot;nb&quot;&gt;type &lt;/span&gt;devpts &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;rw,relatime,mode&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;600&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
/dev/mtdblock8 on /data &lt;span class=&quot;nb&quot;&gt;type &lt;/span&gt;jffs2 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;rw,relatime&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# ls /dev/mtd*&lt;/span&gt;
/dev/mtd         /dev/mtd4        /dev/mtdblock0   /dev/mtdblock5
/dev/mtd0        /dev/mtd5        /dev/mtdblock1   /dev/mtdblock6
/dev/mtd1        /dev/mtd6        /dev/mtdblock10  /dev/mtdblock7
/dev/mtd10       /dev/mtd7        /dev/mtdblock2   /dev/mtdblock8
/dev/mtd2        /dev/mtd8        /dev/mtdblock3   /dev/mtdblock9
/dev/mtd3        /dev/mtd9        /dev/mtdblock4

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;/proc/cpuinfo:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;system &lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;		: Ralink MT751020 SOC
processor		: 0
cpu model		: MIPS 34Kc V5.5
BogoMIPS		: 498.07
&lt;span class=&quot;nb&quot;&gt;wait &lt;/span&gt;instruction	: &lt;span class=&quot;nb&quot;&gt;yes
&lt;/span&gt;microsecond timers	: &lt;span class=&quot;nb&quot;&gt;yes
&lt;/span&gt;tlb_entries		: 64
extra interrupt vector	: &lt;span class=&quot;nb&quot;&gt;yes
&lt;/span&gt;hardware watchpoint	: &lt;span class=&quot;nb&quot;&gt;yes&lt;/span&gt;, count: 4, address/irw mask: &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;0x0000, 0x0ff8, 0x0ff8, 0x0ff8]
ASEs implemented	: mips16 dsp mt
shadow register sets	: 1
core			: 0
VCED exceptions		: not available
VCEI exceptions		: not available

processor		: 1
cpu model		: &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;null&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; V5.5
BogoMIPS		: 374.37
&lt;span class=&quot;nb&quot;&gt;wait &lt;/span&gt;instruction	: &lt;span class=&quot;nb&quot;&gt;yes
&lt;/span&gt;microsecond timers	: &lt;span class=&quot;nb&quot;&gt;yes
&lt;/span&gt;tlb_entries		: 64
extra interrupt vector	: &lt;span class=&quot;nb&quot;&gt;yes
&lt;/span&gt;hardware watchpoint	: &lt;span class=&quot;nb&quot;&gt;yes&lt;/span&gt;, count: 4, address/irw mask: &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;0x0000, 0x0ff8, 0x0ff8, 0x0ff8]
ASEs implemented	: mips16 dsp mt
shadow register sets	: 1
core			: 0
VCED exceptions		: not available
VCEI exceptions		: not available

processor		: 2
cpu model		: &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;null&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; V5.5
BogoMIPS		: 374.37
&lt;span class=&quot;nb&quot;&gt;wait &lt;/span&gt;instruction	: &lt;span class=&quot;nb&quot;&gt;yes
&lt;/span&gt;microsecond timers	: &lt;span class=&quot;nb&quot;&gt;yes
&lt;/span&gt;tlb_entries		: 64
extra interrupt vector	: &lt;span class=&quot;nb&quot;&gt;yes
&lt;/span&gt;hardware watchpoint	: &lt;span class=&quot;nb&quot;&gt;yes&lt;/span&gt;, count: 4, address/irw mask: &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;0x0000, 0x0ff8, 0x0ff8, 0x0ff8]
ASEs implemented	: mips16 dsp mt
shadow register sets	: 1
core			: 0
VCED exceptions		: not available
VCEI exceptions		: not available

processor		: 3
cpu model		: &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;null&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; V5.5
BogoMIPS		: 374.37
&lt;span class=&quot;nb&quot;&gt;wait &lt;/span&gt;instruction	: &lt;span class=&quot;nb&quot;&gt;yes
&lt;/span&gt;microsecond timers	: &lt;span class=&quot;nb&quot;&gt;yes
&lt;/span&gt;tlb_entries		: 64
extra interrupt vector	: &lt;span class=&quot;nb&quot;&gt;yes
&lt;/span&gt;hardware watchpoint	: &lt;span class=&quot;nb&quot;&gt;yes&lt;/span&gt;, count: 4, address/irw mask: &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;0x0000, 0x0ff8, 0x0ff8, 0x0ff8]
ASEs implemented	: mips16 dsp mt
shadow register sets	: 1
core			: 0
VCED exceptions		: not available
VCEI exceptions		: not available

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;/proc/crypto:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;name         : stdrng
driver       : krng
module       : kernel
priority     : 200
refcnt       : 1
selftest     : passed
&lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;         : rng
seedsize     : 0

name         : arc4
driver       : arc4-generic
module       : kernel
priority     : 0
refcnt       : 1
selftest     : passed
&lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;         : cipher
blocksize    : 1
min keysize  : 1
max keysize  : 256

name         : aes
driver       : aes-generic
module       : kernel
priority     : 100
refcnt       : 1
selftest     : passed
&lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;         : cipher
blocksize    : 16
min keysize  : 16
max keysize  : 32

name         : md5
driver       : md5-generic
module       : kernel
priority     : 0
refcnt       : 1
selftest     : passed
&lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;         : shash
blocksize    : 64
digestsize   : 16

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;/proc/mtd:
(To calculate actual size of MTD, convert the &lt;strong&gt;&lt;em&gt;size&lt;/em&gt;&lt;/strong&gt; column from Hex to Decimal, the result will be the size in Kilobytes)&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dev:    size   erasesize  name
mtd0: 00040000 00020000 &lt;span class=&quot;s2&quot;&gt;&quot;bootloader&quot;&lt;/span&gt;
mtd1: 00040000 00020000 &lt;span class=&quot;s2&quot;&gt;&quot;romfile&quot;&lt;/span&gt;
mtd2: 0013645b 00020000 &lt;span class=&quot;s2&quot;&gt;&quot;kernel&quot;&lt;/span&gt;
mtd3: 00770000 00020000 &lt;span class=&quot;s2&quot;&gt;&quot;rootfs&quot;&lt;/span&gt;
mtd4: 030e0000 00020000 &lt;span class=&quot;s2&quot;&gt;&quot;tclinux&quot;&lt;/span&gt;
mtd5: 001358d7 00020000 &lt;span class=&quot;s2&quot;&gt;&quot;kernel_slave&quot;&lt;/span&gt;
mtd6: 00760000 00020000 &lt;span class=&quot;s2&quot;&gt;&quot;rootfs_slave&quot;&lt;/span&gt;
mtd7: 02ae0000 00020000 &lt;span class=&quot;s2&quot;&gt;&quot;tclinux_slave&quot;&lt;/span&gt;
mtd8: 00200000 00020000 &lt;span class=&quot;s2&quot;&gt;&quot;user_rootfs&quot;&lt;/span&gt;
mtd9: 00500000 00020000 &lt;span class=&quot;s2&quot;&gt;&quot;user_config&quot;&lt;/span&gt;
mtd10: 000a0000 00020000 &lt;span class=&quot;s2&quot;&gt;&quot;reservearea&quot;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;#ps aux:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  PID  Uid     VmSize Stat Command
    1 admin       328 S   init       
    2 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;kthreadd]
    3 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;ksoftirqd/0]
    4 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;kworker/0:0]
    5 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;kworker/u:0]
    6 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;migration/0]
    7 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;migration/1]
    9 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;ksoftirqd/1]
   10 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;migration/2]
   12 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;ksoftirqd/2]
   13 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;migration/3]
   14 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;kworker/3:0]
   15 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;ksoftirqd/3]
   16 admin           SW&amp;lt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;khelper]
   17 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;sync_supers]
   18 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;bdi-default]
   19 admin           SW&amp;lt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;kblockd]
   20 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;kswapd0]
   21 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;fsnotify_mark]
   22 admin           SW&amp;lt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;aio]
   23 admin           SW&amp;lt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;crypto]
   28 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;mtdblock0]
   29 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;mtdblock1]
   30 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;mtdblock2]
   31 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;mtdblock3]
   32 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;mtdblock4]
   33 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;mtdblock5]
   34 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;mtdblock6]
   35 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;mtdblock7]
   36 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;mtdblock8]
   37 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;mtdblock9]
   38 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;mtdblock10]
   40 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;kworker/3:1]
   41 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;kworker/1:1]
   42 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;kworker/2:1]
   43 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;kworker/0:1]
   51 admin           SWN &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;jffs2_gcd_mtd8]
  126 admin      2308 S   /userfs/bin/cfg_manager 
  175 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;kworker/u:1]
  222 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;pon_phy_task]
  336 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;kworker/1:2]
  422 admin        60 S   tcwdog &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; 1 /dev/watchdog 
  527 admin        56 S   /usr/bin/utelnetd &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt; /bin/login &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; 
  644 admin      2308 S   /userfs/bin/cfg_manager 
  645 admin      2308 S   /userfs/bin/cfg_manager 
  646 admin      2308 S   /userfs/bin/cfg_manager 
  647 admin      2308 S   /userfs/bin/cfg_manager 
  648 admin      2308 S   /userfs/bin/cfg_manager 
  650 admin       596 S   /userfs/bin/epon_oam 
  652 admin      1276 S   /userfs/bin/omci 
 1480 admin       308 S   /userfs/bin/dropbear 
 1606 admin       324 S   /usr/sbin/udhcpd 
 1941 admin        44 S   /usr/bin/manager_watchdog 
 3130 admin       308 S   /sbin/syslogd &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt; 5 &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; 0 &lt;span class=&quot;nt&quot;&gt;-O&lt;/span&gt; /data/log/messages &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; /data/log/sec_messages &lt;span class=&quot;nt&quot;&gt;-S&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; 512 
 3134 admin       296 S   /sbin/klogd 
 3370 admin       736 S   /userfs/bin/boa &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; /boaroot &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; 
 3489 admin       452 S   /bin/sh /usr/script/telnet_checker.sh 
 3516 admin       452 S   /bin/sh /usr/script/cpu_usage_check.sh 
 3530 admin      2308 S   /userfs/bin/cfg_manager 
 3531 admin      2308 S   /userfs/bin/cfg_manager 
 3532 admin       596 S   /userfs/bin/epon_oam 
 3535 admin       596 S   /userfs/bin/epon_oam 
 3555 admin       596 S   /userfs/bin/epon_oam 
 3558 admin       596 S   /userfs/bin/epon_oam 
 3606 admin       596 S   /userfs/bin/epon_oam 
 3651 admin       300 S   /userfs/bin/nos_upgrade 
 3652 admin       300 S   /userfs/bin/nos_upgrade 
 3654 admin       300 S   /userfs/bin/nos_upgrade 
 3879 admin           SW  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;kworker/2:2]
 3997 admin        92 S   init       
 4002 admin      1276 S   /userfs/bin/omci 
 4003 admin      1276 S   /userfs/bin/omci 
 4004 admin      1276 S   /userfs/bin/omci 
 4005 admin      1276 S   /userfs/bin/omci 
 4006 admin      1276 S   /userfs/bin/omci 
 4007 admin      1276 S   /userfs/bin/omci 
 4008 admin      1276 S   /userfs/bin/omci 
 4009 admin      1276 S   /userfs/bin/omci 
 4010 admin      1276 S   /userfs/bin/omci 
 9092 admin       552 S   pppd unit 0 user vtv_XXXXXXX password XXXXXX nodetach holdoff 4 maxfail 0 usepeerdns lcp-echo-interval 60 lcp-echo-failure 3 plugin libpppoe.so nas0 defaultroute noipdefault persist mtu 
11069 admin       100 S   /sbin/udhcpc &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; nas6 &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /usr/script/udhcpc_nodef.sh &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; /var/run/udhcpc-nas6.pid &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; XX:XX:XX:XX:XX:XX 
12286 admin      1620 S   /userfs/bin/snmpd &lt;span class=&quot;nt&quot;&gt;-Ln&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; /etc/snmp/snmpd.conf &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; /var/log/snmpd.pid 
14266 admin       304 S   /userfs/bin/dnsmasq 
22612 admin       552 S   /userfs/bin/dropbear 
22906 admin       500 S   &lt;span class=&quot;nt&quot;&gt;-sh&lt;/span&gt; 
27644 admin        92 S   &lt;span class=&quot;nb&quot;&gt;sleep &lt;/span&gt;5 
27727 admin        92 S   &lt;span class=&quot;nb&quot;&gt;sleep &lt;/span&gt;10 
27756 admin       340 R   ps aux 

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;#ls /boaroot/cgi-bin (notice these files, there will be more fun after this)&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
OutVariant.asp                   adv_nat_alg_switch.asp           cfm_mip.asp                      home_wireless_5g.asp             reboot.asp                       tools_update.asp
WLAN_Scheduling.asp              adv_nat_dmz.asp                  cfm_status.asp                   home_wireless_cht.asp            ssid_index2.asp                  upnp_portforward_list.asp
access_URLfilter.asp             adv_nat_ipaddrmap.asp            cfm_status_log.cgi               home_wizard.asp                  status.asp                       video_status.asp
access_acl.asp                   adv_nat_porttriggering.asp       current_users.asp                index.asp                        status_deviceinfo.asp            virsvr_table.cgi
access_acl2.asp                  adv_nat_porttriggering_list.asp  gem_rate.cgi                     index_new.asp                    status_deviceinfo_bhati.asp      wifiqa_advanced.asp
access_appfilter.asp             adv_nat_top.asp                  gem_rate_info.asp                index_org.asp                    status_dhcp.asp                  wifiqa_advanced_cht.asp
access_auth.asp                  adv_nat_virsvr.asp               getCANames.cgi                   ipaddr_table.cgi                 status_log.cgi                   wifiqa_apstatistics.asp
access_auth_registerID.asp       adv_ontmode.asp                  getCertNames.cgi                 loginFail.asp                    status_log_bhati.cgi             wifiqa_basic.asp
access_cwmp.asp                  adv_portbinding.asp              help_access.asp                  logout.cgi                       status_new.asp                   wifiqa_wmm.asp
access_ddns.asp                  adv_pvidsetting.asp              help_advanced.asp                more_client_list.asp             status_statistics.asp            wizardBridge.asp
access_ipfilter.asp              adv_qos.asp                      help_index.asp                   more_client_list_2.asp           tools_admin.asp                  wizardConType.asp
access_l2filter.asp              adv_qoslist.asp                  help_interface.asp               more_client_list_3.asp           tools_admin_cht.asp              wizardDHCP.asp
access_l3filter.asp              adv_routepolicy.asp              help_maintenance.asp             navigation-access.asp            tools_autoprovision.asp          wizardPPP.asp
access_l4appctrl.asp             adv_routepolicy_summary.asp      help_quickstart.asp              navigation-advanced.asp          tools_config_backup.asp          wizardStatic.asp
access_parental.asp              adv_routepolicy_url_summary.asp  help_status.asp                  navigation-basic.asp             tools_config_restore.asp         wizardTZ.asp
access_snmp.asp                  adv_routing.asp                  home_advancedwireless.asp        navigation-help.asp              tools_factory_restore.asp        wizardclose.asp
access_sshd.asp                  adv_routing_table.asp            home_lan.asp                     navigation-left-cht.asp          tools_firmware.asp               wizardcomp.asp
access_upnp.asp                  adv_static_route.asp             home_pvclist.asp                 navigation-left.asp              tools_management.asp             wizardpwd.asp
admin.asp                        adv_vlan_group.asp               home_servlist.asp                navigation-maintenance.asp       tools_remove_tftp.cgi            wizardset.asp
adv_6rdtunnel.asp                adv_vlan_pvid.asp                home_setup.asp                   navigation-status.asp            tools_save.asp                   wizardstart.asp
adv_adsl.asp                     adv_vlan_top.asp                 home_wan.asp                     navigation-status_ssid2.asp      tools_system.asp
adv_firewall.asp                 adv_vpn_connection.asp           home_wan2.asp                    navigation.asp                   tools_test.asp
adv_fonnet.asp                   adv_vpn_setting.asp              home_wan2_setup.asp              portbinding_table.asp            tools_tftp.asp
adv_gpon.asp                     cfm_action.asp                   home_wan2_setup_cht.asp          porttriggering_list.cgi          tools_tftp.cgi
adv_ipv6_static_route.asp         cfm_mep.asp                      home_wireless.asp                pppoe_pwd.cgi                    tools_time.asp

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ul&gt;
  &lt;li&gt;Unencrypted config file is located at &lt;strong&gt;/tmp/var/romfile.cfg&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;3-web-interface-vulnerables&quot;&gt;3. Web interface vulnerables:&lt;/h3&gt;
&lt;p&gt;This router have a security issue which allows anyone to access its .cgi page &lt;strong&gt;&lt;em&gt;without any password&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;As you can see above, we have some .cgi pages&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cfm_status_log.cgi       getCANames.cgi           ipaddr_table.cgi         porttriggering_list.cgi  status_log.cgi           tools_remove_tftp.cgi    virsvr_table.cgi
gem_rate.cgi             getCertNames.cgi         logout.cgi               pppoe_pwd.cgi            status_log_bhati.cgi     tools_tftp.cgi

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Most of them is not that interesting but take a look at these files:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;&lt;em&gt;pppoe_pwd.cgi&lt;/em&gt;&lt;/strong&gt;: This file will show the &lt;strong&gt;&lt;em&gt;password&lt;/em&gt;&lt;/strong&gt; of the PPPoE account running inside the router, it only show PPPoE Password but not Username though…&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;&lt;em&gt;status_log.cgi&lt;/em&gt;&lt;/strong&gt;: This file will reading from /data/log/messages which is the device’s syslogd, there’s nothing much interesting in it, it could also can access via &lt;strong&gt;&lt;em&gt;Maintenance&lt;/em&gt;&lt;/strong&gt; -&amp;gt; &lt;strong&gt;&lt;em&gt;Logs&lt;/em&gt;&lt;/strong&gt; -&amp;gt; &lt;strong&gt;&lt;em&gt;System Log&lt;/em&gt;&lt;/strong&gt; in the web interface.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;&lt;em&gt;status_log_bhati.cgi&lt;/em&gt;&lt;/strong&gt;: This is the most interesting one, it’s the kernel kmsg which having the router’s MAC Address in there, the &lt;strong&gt;&lt;em&gt;GPON S/N&lt;/em&gt;&lt;/strong&gt; is a MAC Address and also very similar to the one you could get in here, assuming the router is exposed on the internet, anyone could access this file and try to login using this MAC address (assuming the user didn’t changed the default password and this router’s default password is the GPON S/N)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/exploring_dasan_h660dw/4.log_bhati.png&quot; alt=&quot;status_log_bhati&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Update: Actually not needed to knowing the Router’s MAC address, just use the hardcoded Telnet password and you’ll get in easily.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Also the Web Interface password is not hashed, it is encoded using base64 and saved in the &lt;strong&gt;&lt;em&gt;romfile.cfg&lt;/em&gt;&lt;/strong&gt;, you could even get the data from the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;export&lt;/code&gt; command to print out environment variables in Telnet (SSH don’t have these)&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# export
export DS_CONFIG_CONSOLE_PASSWD='dmVydGV4MjVla3RrczEyMw=='
export DS_CONFIG_CONSOLE_USERNAME='admin'
...
export DS_CONFIG_WEB_ACC_NAME_0='admin'
export DS_CONFIG_WEB_ACC_NAME_1='user'
export DS_CONFIG_WEB_ACC_NAME_2='guest'
export DS_CONFIG_WEB_ACC_NUM='3'
export DS_CONFIG_WEB_ACC_PASSWD_0='dmVydGV4MjU='
export DS_CONFIG_WEB_ACC_PASSWD_1='MTIzNA=='
export DS_CONFIG_WEB_ACC_PASSWD_2='MTIzNA=='
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;4-firmware-hacking&quot;&gt;4. Firmware hacking&lt;/h3&gt;
&lt;p&gt;The device having a populated UART header and an unpopulated JTAG header on the board, this is what get spilled out at the UART when boot&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
DRAMC V2.0 (0)



DRAMC V2.0.0.1 (0)



MT751020 at Wed Dec 16 00:42:14 KST 2015 version 1.6.0 free bootbase

Memory size 128MB

NAND Page size:2048B,Total size 128MB 

bmt pool size: 81 

Press 's' key in 3 secs to enter boot command mode.
............................................................


Invalid Power GPIO, just return and don't turn on Power LED 


==&amp;gt; boot flag = 0
Decompress to 80002000 free_mem_ptr=80600000 free_mem_ptr_end=80780000
from main
Uncompressing [LZMA] ...  done.
busybox init and set aff

init started:  BusyBox v1.00 (2017.06.22-08:43+0000) multi-call binary
chmod: /userfs/profile.cfg: Read-only file system
Unlocking bootloader ...
Writing from /tmp/boot.bin to bootloader ... 
 [ w ]
TCSUPPORT_IPV6
net.netfilter.nf_conntrack_max = 8196
net.netfilter.nf_conntrack_tcp_timeout_established = 3600
net.netfilter.nf_conntrack_tcp_timeout_close = 10
net.netfilter.nf_conntrack_tcp_timeout_close_wait = 10
net.netfilter.nf_conntrack_tcp_timeout_time_wait = 10
net.netfilter.nf_conntrack_tcp_timeout_last_ack = 10
chmod: /etc/xml/xml: Read-only file system
mtd[readflash]:device=reservearea tclen=512 tcoffset=524288
Unlocking reservearea ...
Reading from reservearea to /tmp/RT30xxEEPROM.bin ... 
mtd[readflash]:device=reservearea tclen=64 tcoffset=525312
Unlocking reservearea ...
Reading from reservearea to /tmp/wlan_cal_info ... 
Error--MCL activate value is NULL.
modprobe: could not parse modules.dep

The kernel doesn't support the ebtables 'filter' table.
modprobe: could not parse modules.dep

The kernel doesn't support the ebtables 'filter' table.
modprobe: could not parse modules.dep

The kernel doesn't support the ebtables 'filter' table.
Cannot find device &quot;br0&quot;
insmod raeth driver
cat: /proc/tc3162/hwnat_wan_account: No such file or directory
route: SIOC[ADD|DEL]RT: No such device
==&amp;gt;wlan_read:ioctl open fail
TCSUPPORT_WLAN
iptables: No chain/target/match by that name.
TCSUPPORT_WLAN_MULTIDRIVER
SIOCGIFFLAGS: No such device
done
TCSUPPORT_WLAN: ifconfig
SIOCSIFADDR: No such device
SIOCGIFFLAGS: No such device
interface rai0 does not exist!
telnetd: starting
  port: 23; login program: /bin/login
SSH
four ports
SIOCGIFFLAGS: No such device
interface eth0.1 does not exist!
sh: vconfig: not found
SIOCGIFFLAGS: No such device
interface eth0.2 does not exist!
sh: vconfig: not found
SIOCGIFFLAGS: No such device
interface eth0.3 does not exist!
sh: vconfig: not found
SIOCGIFFLAGS: No such device
interface eth0.4 does not exist!
sh: vconfig: not found
device eth0 is already a member of a bridge; can't enslave it to bridge br0.
Added VLAN with VID == 1 to IF -:eth0:-
WARNING:  VLAN 1 does not work with many switches,
consider another number if you have problems.
Added VLAN with VID == 2 to IF -:eth0:-
Added VLAN with VID == 3 to IF -:eth0:-
Added VLAN with VID == 4 to IF -:eth0:-
mtd[readflash]:device=reservearea tclen=1 tcoffset=541696
Unlocking reservearea ...
Reading from reservearea to /tmp/bootflag ... 
mtd[readflash]:device=tclinux tclen=32 tcoffset=16
Unlocking tclinux ...
Reading from tclinux to /tmp/main_trx.bin ... 
mtd[readflash]:device=tclinux tclen=4 tcoffset=0
Unlocking tclinux ...
Reading from tclinux to /tmp/main_magic.bin ... 
mtd[readflash]:device=tclinux_slave tclen=32 tcoffset=16
Unlocking tclinux_slave ...
Reading from tclinux_slave to /tmp/slave_trx.bin ... 
mtd[readflash]:device=tclinux_slave tclen=4 tcoffset=0
Unlocking tclinux_slave ...
Reading from tclinux_slave to /tmp/slave_magic.bin ... 
mtd[readflash]:device=reservearea tclen=1 tcoffset=541696
Unlocking reservearea ...
Reading from reservearea to /tmp/boot_flag_read ... 
00:00:17 imgr.c [71]: Initial system driver.
00:00:17 imgr.c [77]: Initial pthread parameters.
00:00:17 imgr.c [83]: Initial dispatcher.
00:00:17 dspch_init.c [23]: Create IPC trap message queue
00:00:17 dspch_init.c [36]: Create IPC trap message queue
00:00:17 imgr.c [89]: Initial database manager.
00:00:17 dbmgr_init.c [32]: Create database memory.
00:00:17 dbmgr_init.c [38]: Create the share database memory successful.
00:00:17 dbmgr_init.c [41]: The total share database size is 0.
00:00:17 imgr.c [95]: Initial config manager.
00:00:17 imgr.c [101]: Initial fault manager.
00:00:17 imgr.c [107]: Initial performance manager.
insmod: cannot insert `/lib/modules/2.6.36/kernel/net/ipv4/netfilter/iptable_filter.ko': File exists (-1): File exists
chmod: /userfs/profile.cfg: Read-only file system
/etc/isp0.conf
/usr/script/wan_start_boot.sh: 925: Syntax error: end of file unexpected
/etc/isp1.conf
/etc/isp2.conf
Cannot find device &quot;imq0&quot;
bad action parsing
parse_action: bad value (5:mirred)!
Illegal fw &quot;action&quot;
/etc/isp3.conf
/etc/isp4.conf
/etc/isp5.conf
/etc/isp6.conf
/etc/isp7.conf
conntrack v1.2.2 (conntrack-tools): connection tracking table has been emptied.
method = HW_NAT_TAB_CLEAN
done
iptables: No chain/target/match by that name.
RTNETLINK answers: No such file or directory
RTNETLINK answers: No such file or directory
RTNETLINK answers: No such file or directory
RTNETLINK answers: No such file or directory
RTNETLINK answers: No such file or directory
RTNETLINK answers: No such file or directory
RTNETLINK answers: No such file or directory
RTNETLINK answers: No such file or directory
conntrack v1.2.2 (conntrack-tools): connection tracking table has been emptied.
method = HW_NAT_TAB_CLEAN
done
SIOCDIFADDR: Cannot assign requested address
SIOCDIFADDR: Cannot assign requested address
killall: dropbear: no process killed
udhcpd (v0.9.9-pre) started
Jan  1 00:00:23 udhcpd[1606]: udhcpd (v0.9.9-pre) started

Unable to open /etc/udhcpd.leases for reading
Jan  1 00:00:23 udhcpd[1606]: Unable to open /etc/udhcpd.leases for reading

sh: /userfs/bin/dproxy: not found
killall: wscd: no process killed
chmod: /userfs/profile.cfg: Read-only file system
chmod: /userfs/profile.cfg: Read-only file system
chmod: /userfs/profile.cfg: Read-only file system
chmod: /userfs/profile.cfg: Read-only file system
chmod: /userfs/profile.cfg: Read-only file system
chmod: /userfs/profile.cfg: Read-only file system
chmod: /userfs/profile.cfg: Read-only file system
chmod: /userfs/profile.cfg: Read-only file system
chmod: /userfs/profile.cfg: Read-only file system
chmod: /userfs/profile.cfg: Read-only file system
chmod: /userfs/profile.cfg: Read-only file system
chmod: /userfs/profile.cfg: Read-only file system
iptables: Chain already exists.
sh: cannot create /proc/tc3162/qos_switch: Directory nonexistent
/etc/lanAlias0.conf
killall: klogd: no process killed
killall: syslogd: no process killed
ftp switch turn on

sip switch turn on

h323 switch turn on

rtsp switch turn on

l2tp switch turn on,sw_state=

iptables: Bad rule (does a matching rule exist in that chain?).
ipsec switch turn on,sw_state=

iptables: Bad rule (does a matching rule exist in that chain?).
pptp switch turn on

done
killall: boa: no process killed
killall: telnet_checker.sh: no process killed
killall: tftpd: no process killed
killall: inetd: no process killed
send: Broken pipe
mkdir: Cannot create directory `/tmp/cwmp': File exists
mtd[writeflash]:device=reservearea tclen=1 tcoffset=541696 tcfilelen =2
Unlocking reservearea ...
Writing from /tmp/boot_flag_write to reservearea ... 
enter real action -----tclen:0x1,tcoffset:0x84400
writeflash: write 0 'st sector,start from 0x80000,0x1 bytes
 [e] [w] writeflash: total write 0x1 bytes

cp: /etc/udhcp_lease: No such file or directory
cp: /etc/udhcp_external_lease: No such file or directory
sendEponOamCmdMsg open message queue fail!
Unlocking romfile ...
Writing from /tmp/var/romfile.cfg to romfile ... 
 [ ] [e] [w] [w] [w] [w] [w]
rai0      no private ioctls.

rai0      no private ioctls.

rai0      no private ioctls.



switch qos type: sp.


switch qos base : 2. (port-based:0, tag-based:1, dscp-based:2, acl-based:3, arl-based:4, stag-based:5)
write reg: 44, value: 227222
dir: 0, port: 6, rate: 1000000
write reg: 1640
write val: 7a12808f
net.ipv4.conf.all.arp_filter = 1
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2
^MT7530 switch kernel API (002D, 0, 00000000) return -1 !
^MT7530 switch kernel API (002D, 1, 00000000) return -1 !
iptables: Chain already exists.
^MT7530 switch kernel API (002D, 2, 00000000) return -1 !
^MT7530 switch kernel API (002D, 3, 00000000) return -1 !
device ra1 is not a slave of br0
device ra2 is not a slave of br0
device ra3 is not a slave of br0
unregister_netdevice: waiting for ra0 to become free. Usage count = 1
device ra0 is already a member of a bridge; can't enslave it to bridge br0.
device ra1 is not a slave of br0
device ra2 is not a slave of br0
device ra3 is not a slave of br0
killall: wscd: no process killed
Interface doesn't accept private ioctl...
set (8BE2): Invalid argument
killall: rtdot1xd: no process killed
Ralink DOT1X daemon, version = '2.5.0.0' 

Please press Enter to activate this console. 

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This console is the same as the Telnet console, nothing special about it.&lt;/p&gt;

&lt;p&gt;The unencrypted ROM configuration file is located at &lt;strong&gt;&lt;em&gt;/tmp/var/romfile.cfg&lt;/em&gt;&lt;/strong&gt;, it is a clear text XML file which contains all the configuration data (Panel password, PPPoE account, WiFi…) and it get written to &lt;strong&gt;&lt;em&gt;/dev/mtd1&lt;/em&gt;&lt;/strong&gt; when you save configuration and get loaded on boot.&lt;/p&gt;

&lt;p&gt;To write the &lt;strong&gt;&lt;em&gt;romfile.cfg&lt;/em&gt;&lt;/strong&gt; to the romfile partition, use this command:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/userfs/bin/mtd write /tmp/var/romfile.cfg romfile
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;hr /&gt;</content><author><name>Nguyen Quang Minh</name></author><summary type="html">This post is a little bit different than usual, having me exploring my ISP router which is the Dasan Networks H660DW, stay with me to see what I’ve found in the process.</summary></entry><entry><title type="html">Setup a Tor Exit/Middle/Bridge relay</title><link href="http://www.minhng99.cloud/Setup-a-Tor-Exit-Middle-Bridge-relay/" rel="alternate" type="text/html" title="Setup a Tor Exit/Middle/Bridge relay" /><published>2018-12-02T00:00:00+00:00</published><updated>2018-12-02T00:00:00+00:00</updated><id>http://www.minhng99.cloud/Setup-a-Tor-Exit-Middle-Bridge-relay</id><content type="html" xml:base="http://www.minhng99.cloud/Setup-a-Tor-Exit-Middle-Bridge-relay/">&lt;p&gt;Tor is an anonymity tool used by those who want to stay private and uncensored when browsing the
Internet, it’s working like a proxy but your traffic will be passing through multiple servers before
reaching its final destination, the entire network is made of routers operated by volunteer so
if you have the bandwidth and a spare server you could help make the Tor network more secure and faster.&lt;/p&gt;

&lt;p&gt;Tor has 3 kinds of relays:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Entry/Guard Relays - Entry points into the Tor network&lt;/li&gt;
  &lt;li&gt;Middle Relays - Send traffic from an entry relay to an exit relay&lt;/li&gt;
  &lt;li&gt;Exit Relays - Send the traffic out of the Tor network to the original destination on clearnet&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When connected to a Tor network, your traffic will go like this if you accessing a website on a clearnet:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Your computer -&amp;gt; Entry Relays -&amp;gt; Middle Relay(s) -&amp;gt; Exit Relay -&amp;gt; Destination server&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And like this if you’re accessing a .onion website:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Your computer -&amp;gt; Entry Relays -&amp;gt; Middle Relay(s) -&amp;gt; Destination server&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Your traffic is fully encrypted while traveling through the Tor network, that means whoever operating the Entry and Middle relays can’t possibly know what kind of data you’re transmitting, the Entry Relay only know your IP address but don’t know what you’re sending through the Tor network, meanwhile the Exit Relay could only read your traffic (if it’s not end-to-end encrypted to Destination server like HTTPS) but it doesn’t know who has transmitted it.&lt;/p&gt;

&lt;p&gt;If you accessing the .onion website, only your machine and the Destination server can read your traffic, it’s not needed to pass through the Exit Relay because the server of the .onion website is not located on regular internet. Because of this, no one knows where’s the exact location of a specific .onion server is at.&lt;/p&gt;

&lt;p&gt;In this tutorial, I’ll show you how to set up all kind of Tor Relay node.&lt;/p&gt;

&lt;h3 id=&quot;requirement&quot;&gt;Requirement:&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;Internet access&lt;/li&gt;
  &lt;li&gt;Basic knowledge of Linux&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;note&quot;&gt;Note:&lt;/h3&gt;
&lt;p&gt;Ask your ISP or your server hosting to see if they allow Tor Relay/Exit node first, most of ISP allow hosts Tor Relay on their network but not all allowing Tor Exit, because the Exit node will help Tor users access “real” internet that means they might get you into trouble if they’re doing anything illegal while connected to your Exit node.&lt;/p&gt;

&lt;p&gt;Generally, it is safe to run a guard or middle relay on any VPS or shared server (such as DigitalOcean or EC2), since all the server operators will see is harmless encrypted traffic.&lt;/p&gt;

&lt;p&gt;However, there are special responsibilities to consider when running an exit node. Since exit relays send traffic directly to the end destination, any illicit activity done through Tor appears to come from the exit relay.
This leads to the rare possibility of raids, abuse notices, or more.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;1-install-tor&quot;&gt;1. Install Tor&lt;/h3&gt;
&lt;p&gt;I’m using Debian 9, you could use the tor package from Debian default repo, however… but I want the latest one so I’ll
proceed on adding repo from TorProject.&lt;/p&gt;

&lt;p&gt;Always run apt update first to make sure you’ll install the latest packages.&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;root@tor-exit:~# apt update
Hit:1 http://security.debian.org stretch/updates InRelease
Ign:2 http://deb.debian.org/debian stretch InRelease
Hit:3 http://deb.debian.org/debian stretch-updates InRelease
Hit:4 http://deb.debian.org/debian stretch-backports InRelease
Hit:6 http://deb.debian.org/debian stretch Release
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This will need to install apt-transport-https because TorProject’s repo using HTTPS instead of HTTP, this is not supported
by default.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  apt-transport-https
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 171 kB of archives.
After this operation, 243 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian stretch/main amd64 apt-transport-https amd64 1.4.8 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;171 kB]
Fetched 171 kB &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;0s &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;8,987 kB/s&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;       
Selecting previously unselected package apt-transport-https.
&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Reading database ... 30001 files and directories currently installed.&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
Preparing to unpack .../apt-transport-https_1.4.8_amd64.deb ...
Unpacking apt-transport-https &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;1.4.8&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; ...
Setting up apt-transport-https &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;1.4.8&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; ...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You’ll need to import their PGP key, this will help APT know the package is downloaded from TorProject is legit and not
altered/corrupted.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;root@tor-exit:~# gpg &lt;span class=&quot;nt&quot;&gt;--recv&lt;/span&gt; A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89
gpg: directory &lt;span class=&quot;s1&quot;&gt;'/root/.gnupg'&lt;/span&gt; created
gpg: keybox &lt;span class=&quot;s1&quot;&gt;'/root/.gnupg/pubring.kbx'&lt;/span&gt; created
uid  deb.torproject.org archive signing key
sig!3        EE8CBC9E886DDD89 2012-08-29  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;self-signature]
sig!3        EE8CBC9E886DDD89 2014-08-31  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;self-signature]
sig!3        EE8CBC9E886DDD89 2009-09-04  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;self-signature]
sig!3        EE8CBC9E886DDD89 2018-08-06  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;self-signature]
sub  74A941BA219EC810
sig!         EE8CBC9E886DDD89 2012-08-29  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;self-signature]
sig!         EE8CBC9E886DDD89 2014-08-31  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;self-signature]
sig!         EE8CBC9E886DDD89 2009-09-04  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;self-signature]
sig!         EE8CBC9E886DDD89 2018-08-06  &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;self-signature]
key EE8CBC9E886DDD89:
2 duplicate signatures removed
80 signatures not checked due to missing keys
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key EE8CBC9E886DDD89: public key &lt;span class=&quot;s2&quot;&gt;&quot;deb.torproject.org archive signing key&quot;&lt;/span&gt; imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:               imported: 1

root@tor-exit:~# gpg &lt;span class=&quot;nt&quot;&gt;--export&lt;/span&gt; A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add -
key EE8CBC9E886DDD89:
80 signatures not checked due to missing keys
OK
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now adding TorProject’s repo to apt sources.list.d directory&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;root@tor-exit:~# &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;deb https://deb.torproject.org/torproject.org stretch main&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /etc/apt/sources.list.d/tor.list
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now we re-run apt update again so apt will query available package from the updated sources.list&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;root@tor-exit:~# apt update
Hit:1 http://security.debian.org stretch/updates InRelease
Ign:2 http://deb.debian.org/debian stretch InRelease                                                              
Hit:3 http://deb.debian.org/debian stretch-updates InRelease                                                      
Hit:4 http://deb.debian.org/debian stretch-backports InRelease                                                    
Hit:5 http://ppa.launchpad.net/scaleway/stable/ubuntu bionic InRelease                                            
Hit:6 http://deb.debian.org/debian stretch Release                                                                
Get:7 https://deb.torproject.org/torproject.org stretch InRelease &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;4,965 B]
Get:9 https://deb.torproject.org/torproject.org stretch/main amd64 Packages &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;3,465 B]
Fetched 8,430 B &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;1s &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;7,620 B/s&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Install Tor and TorProject’s keyring&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;root@tor-exit:~# apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;tor deb.torproject.org-keyring
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libzstd1 tor-geoipdb torsocks
Suggested packages:
  mixmaster torbrowser-launcher tor-arm apparmor-utils obfs4proxy
The following NEW packages will be installed:
  libzstd1 tor tor-geoipdb torsocks deb.torproject.org-keyring
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,282 kB of archives.
After this operation, 12.9 MB of additional disk space will be used.
Do you want to &lt;span class=&quot;k&quot;&gt;continue&lt;/span&gt;? &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Y/n] y
Get:1 http://deb.debian.org/debian stretch/main amd64 libzstd1 amd64 1.1.2-1 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;193 kB]
Get:2 http://deb.debian.org/debian stretch/main amd64 torsocks amd64 2.2.0-1+deb9u1 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;72.7 kB]
Get:3 https://deb.torproject.org/torproject.org stretch/main amd64 tor amd64 0.3.4.9-1~d90.stretch+1 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;1,718 kB]
Get:4 https://deb.torproject.org/torproject.org stretch/main amd64 tor-geoipdb all 0.3.4.9-1~d90.stretch+1 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;1,289 kB]
Get:1 https://deb.torproject.org/torproject.org stretch/main amd64 deb.torproject.org-keyring all 2018.08.06 &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;4,922 B]
Fetched 3,273 kB &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;0s &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;6,112 kB/s&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
Selecting previously unselected package libzstd1.
&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Reading database ... 30007 files and directories currently installed.&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
Preparing to unpack .../libzstd1_1.1.2-1_amd64.deb ...
Unpacking libzstd1 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;1.1.2-1&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; ...
Selecting previously unselected package tor.
Preparing to unpack .../tor_0.3.4.9-1~d90.stretch+1_amd64.deb ...
Unpacking tor &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;0.3.4.9-1~d90.stretch+1&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; ...
Selecting previously unselected package torsocks.
Preparing to unpack .../torsocks_2.2.0-1+deb9u1_amd64.deb ...
Unpacking torsocks &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;2.2.0-1+deb9u1&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; ...
Selecting previously unselected package tor-geoipdb.
Preparing to unpack .../tor-geoipdb_0.3.4.9-1~d90.stretch+1_all.deb ...
Unpacking tor-geoipdb &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;0.3.4.9-1~d90.stretch+1&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; ...           
Selecting previously unselected package deb.torproject.org-keyring.
Preparing to unpack .../deb.torproject.org-keyring_2018.08.06_all.deb ...
Unpacking deb.torproject.org-keyring &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;2018.08.06&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; ...
Setting up libzstd1 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;1.1.2-1&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; ...
Processing triggers &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;libc-bin &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;2.24-11+deb9u3&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; ...
Processing triggers &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;systemd &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;232-25+deb9u6&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; ...
Processing triggers &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;man-db &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;2.7.6.1-2&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; ...
Setting up deb.torproject.org-keyring &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;2018.08.06&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; ...
Setting up torsocks &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;2.2.0-1+deb9u1&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; ...
Setting up tor &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;0.3.4.9-1~d90.stretch+1&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; ...
Something or somebody made /var/lib/tor disappear.
Creating one &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;you again.
Something or somebody made /var/log/tor disappear.
Creating one &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;you again.
Created symlink /etc/systemd/system/multi-user.target.wants/tor.service → /lib/systemd/system/tor.service.
Setting up tor-geoipdb &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;0.3.4.9-1~d90.stretch+1&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; ...
Processing triggers &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;systemd &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;232-25+deb9u6&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; ...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;2-prepare-tor-config&quot;&gt;2. Prepare Tor config&lt;/h3&gt;
&lt;p&gt;You’ve just installed Tor successfully (hopefully), now you must tell it what you’re going to do with it&lt;/p&gt;

&lt;p&gt;If you have an IPv6 and want your Tor Relay to listening on IPv6 and are able to access IPv6,
check &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Step 2.1&lt;/code&gt; (optional)&lt;/p&gt;

&lt;p&gt;If you want to set up a Tor Bridge, get the config from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Step 2.2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you want to set up a Tor Relay, get the config from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Step 2.3&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you want to set up a Tor Exit, get the config from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Step 2.4&lt;/code&gt;
and then continue on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Step 3&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;21-getting-your-ipv6-address&quot;&gt;2.1. Getting your IPv6 address&lt;/h3&gt;
&lt;p&gt;By default Tor does not listen on IPv6 and will not automatically detect your IPv6 interface, you’ll need to get your current
IPv6 and enable Tor to use it.&lt;/p&gt;

&lt;p&gt;You could get your current IPv6 address by:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;root@tor-exit:~# ip a
1: lo: &amp;lt;LOOPBACK,UP,LOWER_UP&amp;gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    &lt;span class=&quot;nb&quot;&gt;link&lt;/span&gt;/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens2: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    &lt;span class=&quot;nb&quot;&gt;link&lt;/span&gt;/ether de:1a:24:26:50:04 brd ff:ff:ff:ff:ff:ff
    inet 10.16.41.7/31 brd 10.16.41.7 scope global ens2
       valid_lft forever preferred_lft forever
    inet6 2001:bc8:4400:2c00::5:c07/127 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::dc1a:24ff:fe26:5004/64 scope &lt;span class=&quot;nb&quot;&gt;link 
       &lt;/span&gt;valid_lft forever preferred_lft forever
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Look for the line that said &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;inet6&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;global&lt;/code&gt;, in this case, my IPv6 is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2001:bc8:4400:2c00::5:c07&lt;/code&gt;, write it
down because you’ll need it later.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;22-tor-bridge-config&quot;&gt;2.2. Tor Bridge config&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ORPort auto
ORPort [INSERT_IPV6_ADDRESS]:auto
SocksPort 0
BridgeRelay 1
Log notice file /var/log/tor/notices.log
DirPort 9030
ExitPolicy reject6 *:*, reject *:*
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you’re behind a NAT firewall, you could change the port number &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;auto&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;9030&lt;/code&gt; to suits your needs.
DirPort doesn’t need to listen on IPv6, it will return an error if you try to do that.&lt;/p&gt;

&lt;p&gt;If you don’t have an IPv6, remove the second “ORPort” and the “, reject6 &lt;em&gt;:&lt;/em&gt;”&lt;/p&gt;

&lt;p&gt;Skip to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Step 3&lt;/code&gt; from now&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;23-tor-relay-config&quot;&gt;2.3. Tor Relay config&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;SocksPort 0
RunAsDaemon 1
ORPort 9001
ORPort [INSERT_IPV6_ADDRESS]:9001
Nickname YourAwesomeRelayName123
ContactInfo YOUR_EMAIL_HERE [AT] DOMAIN [DOT] EXT
Log notice file /var/log/tor/notices.log
DirPort 9030
ExitPolicy  reject *:*, reject6 *:*
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;You should change the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Nickname&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ContactInfo&lt;/code&gt; as you’d like.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Nickname&lt;/code&gt; only allow 1 to 19 characters, only letters, and numbers, no spaces or other special characters.
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ContactInfo&lt;/code&gt; here you should put your email with slightly obfuscated so scrapper will not add your email to their
spam list, this emails will be used to contact you and will be published on Tor Atlas.&lt;/p&gt;

&lt;p&gt;If you’re behind a NAT firewall, you could change the port number &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;9001&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;9030&lt;/code&gt; to suits your needs.
DirPort doesn’t need to listen on IPv6, it will return an error if you try to do that.&lt;/p&gt;

&lt;p&gt;If you don’t have an IPv6, remove the second “ORPort” and the “, reject6 &lt;em&gt;:&lt;/em&gt;”&lt;/p&gt;

&lt;p&gt;Skip to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Step 3&lt;/code&gt; from now&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;24-tor-exit-config&quot;&gt;2.4. Tor Exit config&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;SocksPort 0
RunAsDaemon 1
ORPort 9001
ORPort [INSERT_IPV6_ADDRESS]:9001
Nickname YourAwesomeRelayName123
ContactInfo YOUR_EMAIL_HERE [AT] DOMAIN [DOT] EXT
DirPort 80
DirPortFrontPage /etc/tor/tor-exit-notice.html
ExitPolicy accept *:*, accept6 *:*
IPv6Exit 1
ExitRelay 1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You should change the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Nickname&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ContactInfo&lt;/code&gt; as you’d like.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Nickname&lt;/code&gt; only allow 1 to 19 characters, only letters, and numbers, no spaces or other special characters.
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ContactInfo&lt;/code&gt; here you should put your email with slightly obfuscated so scrapper will not add your email to their
spam list, this emails will be used to contact you and will be published on Tor Atlas.&lt;/p&gt;

&lt;p&gt;If you’re behind a NAT firewall, you could change the port number &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;9001&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;80&lt;/code&gt; to suits your needs.
DirPort doesn’t need to listen on IPv6, it will return an error if you try to do that.&lt;/p&gt;

&lt;p&gt;With Exit Relay, you also can put a little HTML page in the path of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DirPortFrontPage&lt;/code&gt; so whenever someone visited your
Exit Relay’s IPv4 Address they will be greeted with your HTML message, the common Tor Exit FrontPage HTML is &lt;a href=&quot;https://gitweb.torproject.org/tor.git/plain/contrib/operator-tools/tor-exit-notice.html&quot;&gt;HERE&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you don’t have an IPv6, remove the second “ORPort” and the “, accept6 &lt;em&gt;:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Continue to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Step 3&lt;/code&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;3-write-config-file-and-enable-tor&quot;&gt;3. Write config file and enable Tor&lt;/h3&gt;
&lt;p&gt;Now you’ve got your config file content, put it into &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/tor/torrc&lt;/code&gt;, you could even delete the default file if you want,
the configs in step 2. are already enough to get Tor run.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/setup_a_tor_exit_relay_bridge/1.torrc.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I also have added my FrontPage based on the one from TorProject’s, notice that in the FrontPage has some FIXME value that you’re
supposed to change them.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/setup_a_tor_exit_relay_bridge/2.exit-notice.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Save it all and now we’re going to get it up and running.&lt;/p&gt;

&lt;p&gt;Enable the Tor service startup with (skip this step if you don’t want Tor to run on startup)&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;root@tor-exit:~# systemctl &lt;span class=&quot;nb&quot;&gt;enable &lt;/span&gt;tor
Synchronizing state of tor.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install &lt;span class=&quot;nb&quot;&gt;enable &lt;/span&gt;tor
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And start Tor service&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;root@tor-exit:~# systemctl start tor
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Tor should be running now, check to see if the service still running with&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;root@tor-exit:~# systemctl status tor
● tor.service - Anonymizing overlay network &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;TCP &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;multi-instance-master&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   Loaded: loaded &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;/lib/systemd/system/tor.service&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; enabled&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; vendor preset: enabled&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   Active: active &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;exited&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; since Sun 2018-12-02 08:36:59 UTC&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 11min ago
  Process: 1810 &lt;span class=&quot;nv&quot;&gt;ExecStart&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/bin/true &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;code&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;exited, &lt;span class=&quot;nv&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0/SUCCESS&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
 Main PID: 1810 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;code&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;exited, &lt;span class=&quot;nv&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0/SUCCESS&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
    Tasks: 0 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;limit: 4915&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
   CGroup: /system.slice/tor.service

Dec 02 08:36:59 tor-exit.minhng99.cloud systemd[1]: Starting Anonymizing overlay network &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;TCP &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;multi-instance-master&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;...
Dec 02 08:36:59 tor-exit.minhng99.cloud systemd[1]: Started Anonymizing overlay network &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;TCP &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;multi-instance-master&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you see it’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;active&lt;/code&gt; that means there’s no error and it’s running in the background.&lt;/p&gt;

&lt;p&gt;Make sure you’ve forwarded port to your Tor relay properly, it won’t work without port forwarding.&lt;/p&gt;

&lt;p&gt;After around 12 hours, you could go to &lt;a href=&quot;https://metrics.torproject.org/rs.html&quot;&gt;Tor Relay Search&lt;/a&gt;, type in your relay’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Nickname&lt;/code&gt;
and see how it’s doing, it should look something like this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/setup_a_tor_exit_relay_bridge/3.atlas.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Your Tor relay will not be doing much work until 2 weeks later so just be patient.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;resources&quot;&gt;Resources:&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://jordan-wright.com/blog/2015/02/28/how-tor-works-part-one/&quot;&gt;How Tor works&lt;/a&gt;
&lt;a href=&quot;https://tor-relay.co/&quot;&gt;Tor config generator&lt;/a&gt;
&lt;a href=&quot;https://www.torproject.org/docs/debian&quot;&gt;TorProject’s Debian/Ubuntu instruction&lt;/a&gt;&lt;/p&gt;</content><author><name>Nguyen Quang Minh</name></author><summary type="html">Tor is an anonymity tool used by those who want to stay private and uncensored when browsing the Internet, it’s working like a proxy but your traffic will be passing through multiple servers before reaching its final destination, the entire network is made of routers operated by volunteer so if you have the bandwidth and a spare server you could help make the Tor network more secure and faster.</summary></entry><entry><title type="html">Debrick TP-Link Archer C7</title><link href="http://www.minhng99.cloud/debrick-tp-link-archer-c7/" rel="alternate" type="text/html" title="Debrick TP-Link Archer C7" /><published>2018-11-25T00:00:00+00:00</published><updated>2018-11-25T00:00:00+00:00</updated><id>http://www.minhng99.cloud/debrick-tp-link-archer-c7</id><content type="html" xml:base="http://www.minhng99.cloud/debrick-tp-link-archer-c7/">&lt;p&gt;TP-Link Archer line has a very cool recovery trick that makes it quite safe to do firmware flashing (not so much for bootloader flashing), here I’ll guide you how to recover your Archer from bad flashing or when you just want to go back to stock firmware from OpenWRT.&lt;/p&gt;

&lt;h3 id=&quot;requirements&quot;&gt;Requirements:&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;Ethernet cable&lt;/li&gt;
  &lt;li&gt;TP-Link Archer C7 router (I’m not sure if this will also work for other models)&lt;/li&gt;
  &lt;li&gt;A computer with an Ethernet port&lt;/li&gt;
  &lt;li&gt;The router is in “soft-bricked” state (the main u-boot bootloader hasn’t got ruined yet)&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;1-how-its-work&quot;&gt;1. How it’s work&lt;/h3&gt;

&lt;p&gt;This TP-Link router uses 2 separate u-boot, &lt;strong&gt;&lt;em&gt;factory-uboot&lt;/em&gt;&lt;/strong&gt; for initializing hardware, download recovery firmware from TFTP (when needed) and the secondary bootloader (u-boot) is for starting the Linux 
Kernel.&lt;/p&gt;

&lt;p&gt;Here’s the MTD partitions on my device:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;5 cmdlinepart partitions found on MTD device spi0.0
Creating 5 MTD partitions on &quot;spi0.0&quot;:
0x000000000000-0x000000020000 : &quot;factory-uboot&quot;
0x000000020000-0x000000040000 : &quot;u-boot&quot;
0x000000040000-0x000000f00000 : &quot;firmware&quot;
2 uimage-fw partitions found on MTD device firmware
0x000000040000-0x0000001e0000 : &quot;kernel&quot;
0x0000001e0000-0x000000f00000 : &quot;rootfs&quot;
mtd: device 4 (rootfs) set to be root filesystem
1 squashfs-split partitions found on MTD device rootfs
0x000000420000-0x000000f00000 : &quot;rootfs_data&quot;
0x000000f00000-0x000000ff0000 : &quot;config&quot;
0x000000ff0000-0x000001000000 : &quot;art&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Its boot sequence is &lt;strong&gt;&lt;em&gt;factory-uboot -&amp;gt; u-boot -&amp;gt; firmware (kernel)&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you update your firmware, only the &lt;strong&gt;&lt;em&gt;u-boot&lt;/em&gt;&lt;/strong&gt; and the &lt;strong&gt;&lt;em&gt;firmware&lt;/em&gt;&lt;/strong&gt; get updated, if one of those 2 gets corrupted then it will not boot normally thus you can’t access the web panel for firmware upgrade like normal.&lt;/p&gt;

&lt;p&gt;Fortunately, TP-Link has configured their factory-uboot so it can detect if you want to enter the firmware flashing mode directly and bypassing the rest, this makes recovery very easy without having to 
disassemble the device and use UART or JTAG to recover, we can trigger it with just the RESET button on the back side of the router.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;2-preparing-firmware-and-tftp&quot;&gt;2. Preparing firmware and TFTP&lt;/h3&gt;

&lt;p&gt;You’ll need to download the stock firmware from the official TP-Link website, make sure to get the latest one unless you know what you’re doing.&lt;/p&gt;

&lt;p&gt;You could even flash the custom firmware like OpenWRT directly and bypass the whole stock-firmware things, just download the one with “factory” in its name.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/debrick-tp-link-archer-c7/1.official-firmware-download.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here I’m getting the &lt;strong&gt;&lt;em&gt;Archer C7(US)_V4_180425&lt;/em&gt;&lt;/strong&gt;, make sure you’ve chosen the right firmware for your device, careful with the hardware version if your device has it.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/debrick-tp-link-archer-c7/2.extract-firmware.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The downloaded file is in ZIP format, you’ll need to extract it and get the .bin file, that’s what we need.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/debrick-tp-link-archer-c7/3.firmware-rename.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Create a new folder somewhere and put the .bin firmware file in it, rename it to &lt;strong&gt;&lt;em&gt;ArcherC7v4_tp_recovery.bin&lt;/em&gt;&lt;/strong&gt;, if your router is another model like C9 or different hardware version then just change the 
name accordingly, here I put mine into “/home/minh/firmware/.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/debrick-tp-link-archer-c7/4.static-ip.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now you have to set your Ethernet IP address to static and specify this IP:&lt;/p&gt;

&lt;p&gt;Address: 192.168.0.66
Netmask: 255.255.255.0&lt;/p&gt;

&lt;p&gt;You can skip the rest if you want, it’s not that important.&lt;/p&gt;

&lt;p&gt;Some OS need to restart the network interface to apply the new IP, just disable and then enable it again or don’t plug anything into the Ethernet port yet.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/debrick-tp-link-archer-c7/5.tftp-started.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now you need a TFTP server, here I’m using &lt;strong&gt;&lt;em&gt;atftpd&lt;/em&gt;&lt;/strong&gt; for it, you’ll need to find a suitable TFTP server for your OS.&lt;/p&gt;

&lt;p&gt;Remember: It has to be TFTP, regular FTP will &lt;strong&gt;&lt;em&gt;NOT&lt;/em&gt;&lt;/strong&gt; work.&lt;/p&gt;

&lt;p&gt;If you’re using atftp like me, you could use this command to run it.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;atftpd &lt;span class=&quot;nt&quot;&gt;--daemon&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;root &lt;span class=&quot;nt&quot;&gt;--group&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;root &lt;span class=&quot;nt&quot;&gt;--no-fork&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--logfile&lt;/span&gt; - /home/minh/firmware
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;I know that you should not run untrusted apps as root but you only need to keep this thing run until the recovery has finished so it’s not much of a problem.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;3-recovery-mode-and-flashing-firmware&quot;&gt;3. Recovery mode and flashing firmware&lt;/h3&gt;
&lt;p&gt;Now power off your router with the switch on its back, unplug every Ethernet cables, plug only 1 Ethernet cable into port #1 and then into your computer (where the TFTP server lies)&lt;/p&gt;

&lt;p&gt;Find a pin or a toothpick or something that’s small enough to fit into a hole which has the RESET button, find the RESET button on its back and try to push it with your object, if you feel it’s clicking then it’s the right hole.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Push and hold&lt;/em&gt;&lt;/strong&gt; the RESET button, power on the router using the back switch and wait until the WPS LED turn on (the LED which have 2 arrows in a circle), now it should be only the POWER LED and the WPS LED turning on, the rest will not light up.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/debrick-tp-link-archer-c7/6.serving-tftp.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;On your TFTP server, you will see something like this which means the router is currently downloading the firmware from your PC and it will flash it automatically, just wait about 5 minutes and the router will reboot itself automatically.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/debrick-tp-link-archer-c7/7.dhcp-ip.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now when the router has rebooted (other LEDs lights up), you could shut down the TFTP server and switch your Ethernet config to DHCP again.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/debrick-tp-link-archer-c7/8.stock-firmware.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Open your browser, navigate to http://192.168.0.1/ and you should be greeted with the password update page, that means your router has flashed firmware successfully and now it will work as normal.&lt;/p&gt;</content><author><name>Nguyen Quang Minh</name></author><summary type="html">TP-Link Archer line has a very cool recovery trick that makes it quite safe to do firmware flashing (not so much for bootloader flashing), here I’ll guide you how to recover your Archer from bad flashing or when you just want to go back to stock firmware from OpenWRT.</summary></entry><entry><title type="html">How to install Arch Linux with LUKS encrypted rootfs and boot with EFISTUB</title><link href="http://www.minhng99.cloud/How-to-install-arch-linux-with-luks-encrypted-rootfs-and-boot-with-efistub/" rel="alternate" type="text/html" title="How to install Arch Linux with LUKS encrypted rootfs and boot with EFISTUB" /><published>2018-11-18T00:00:00+00:00</published><updated>2018-11-18T00:00:00+00:00</updated><id>http://www.minhng99.cloud/How-to-install-arch-linux-with-luks-encrypted-rootfs-and-boot-with-efistub</id><content type="html" xml:base="http://www.minhng99.cloud/How-to-install-arch-linux-with-luks-encrypted-rootfs-and-boot-with-efistub/">&lt;p&gt;In this tutorial, I’ll show you how to install Arch Linux but with an encrypted rootfs (/) and with a bootloader-less setup (direct UEFI boot)&lt;/p&gt;

&lt;h3 id=&quot;requirements&quot;&gt;Requirements:&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Networking access&lt;/li&gt;
  &lt;li&gt;Machine &lt;strong&gt;&lt;em&gt;MUST&lt;/em&gt;&lt;/strong&gt; support UEFI (non-secured mode)&lt;/li&gt;
  &lt;li&gt;You have some knowledge about how things work (partitioning, UEFI, bootloader, …), you’re an Arch Linux user after all.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;note&quot;&gt;Note:&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;UEFI boot will save you some precious boot time… meanwhile it will be a pain to fix if something goes wrong and render your machine unbootable (bad kernel/initramfs).&lt;/li&gt;
  &lt;li&gt;If you’re using more than 1 OS, I’d recommend you to just stick with good-ol’ GRUB bootloader.&lt;/li&gt;
  &lt;li&gt;You must disable the secure boot mode of the UEFI because the kernel file is unsigned, you could sign it after the setup is done and then enable secure boot again.&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;1-booting-into-live-arch-linux&quot;&gt;1. Booting into Live Arch Linux&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/1.bootmenu-livearch.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Nothing special, just create a bootable media from Arch Linux ISO and then boot it, if you see a different menu than this with a fancy Arch Linux logo (GRUB menu) then your machine isn’t booted by using UEFI or something goes wrong while you create the boot media, try again until you see such similar menu as above.&lt;/p&gt;

&lt;p&gt;Select &lt;strong&gt;&lt;em&gt;Arch Linux archiso x86_64 UEFI CD&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/2.livearch-lsblk.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here you have the Arch Linux Live running on your PC, this is how the disk is configured on my PC, there’s only 1 20GB physical disk which is &lt;strong&gt;&lt;em&gt;sda&lt;/em&gt;&lt;/strong&gt; and it’s totally empty (no partition).&lt;/p&gt;

&lt;p&gt;Starting off by partitioning the disk with&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cfdisk /dev/sda
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/3.livearch-cfdisk-sel-table.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Chose &lt;strong&gt;&lt;em&gt;GPT&lt;/em&gt;&lt;/strong&gt; here, I don’t know if UEFI will boot with DOS or other kinds of partition table or not but just chose &lt;strong&gt;&lt;em&gt;GPT&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/4.livearch-cfdisk-create-parts.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Create partition as above.
Here I have 512MB partition #1 which we will use it for /boot to store the kernel and initramfs, the total of it will be just around 50MB so you could create as low as somewhere 80MB but I want to leave some extra space for backup/alternative kernel and such.
The second partition will be for LUKS encrypted rootfs so it will take up the rest.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;You need to create a separated /boot partition for UEFI to boot the kernel because UEFI don’t understand what LUKS is thus it can’t be merged into rootfs&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Do not create another partition for SWAP because it will be unencrypted, create SWAP as a file later on the encrypted rootfs if you want to use SWAP&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Write to the disk and exit &lt;strong&gt;&lt;em&gt;cfdisk&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/5.livearch-lsblk.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now we need to turn &lt;strong&gt;&lt;em&gt;/dev/sda2&lt;/em&gt;&lt;/strong&gt; into a LUKS container by&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cryptsetup luksFormat /dev/sda2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Open (decrypt) the LUKS container with&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cryptsetup open /dev/sda2 new_rootfs
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This is how LUKS works: It reads the encrypted data (raw disk format) on your block disk, decrypts it and put it to a virtual block device at &lt;strong&gt;&lt;em&gt;/dev/mapper/&lt;/em&gt;&lt;/strong&gt; so you need to interacts with the virtual block device and not the real block device itself (which containing LUKS).
Here I have the decrypted virtual block device at &lt;strong&gt;&lt;em&gt;/dev/mapper/new_rootfs&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/6.livearch-mkfs.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now we need to format it, it’s necessary for the &lt;strong&gt;&lt;em&gt;/boot&lt;/em&gt;&lt;/strong&gt; partition to be FAT32 for UEFI to read it so we need to format &lt;strong&gt;&lt;em&gt;/dev/sda1&lt;/em&gt;&lt;/strong&gt; with&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mkfs.vfat &lt;span class=&quot;nt&quot;&gt;-F32&lt;/span&gt; /dev/sda1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And the &lt;strong&gt;&lt;em&gt;decrypted sda2&lt;/em&gt;&lt;/strong&gt; block device (located at &lt;strong&gt;&lt;em&gt;/dev/mapper/new_rootfs&lt;/em&gt;&lt;/strong&gt;) which will contain the rootfs, you can use whatever the filesystem you like, as long as you add the necessary module to the kernel initramfs.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mkfs.ext4 /dev/mapper/new_rootfs
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/7.livearch-mount.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here notices:
You need to mount the rootfs &lt;strong&gt;&lt;em&gt;first&lt;/em&gt;&lt;/strong&gt; because we will need to mount the &lt;strong&gt;&lt;em&gt;/boot&lt;/em&gt;&lt;/strong&gt; over &lt;strong&gt;&lt;em&gt;/mnt/boot&lt;/em&gt;&lt;/strong&gt; and it doesn’t make sense if you do it in reverse, the /boot will get ignored and nothing will write to it if you do it in reverse&lt;/p&gt;

&lt;p&gt;Start by mounting rootfs:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mount /dev/mapper/new_rootfs /mnt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Create the /boot directory on the rootfs:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; /mnt/boot
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Mount &lt;strong&gt;&lt;em&gt;sda1&lt;/em&gt;&lt;/strong&gt; into the /mnt/boot so the pacstrap could install kernel into it:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mount /dev/sda1 /mnt/boot
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That’s it for the partition setup, now we will continue the next step on the actual Arch Linux installation.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;2-arch-linux-setup&quot;&gt;2. Arch Linux Setup&lt;/h3&gt;

&lt;p&gt;This step is fairly simple, just do install as you would do it with normal Arch Linux installation with &lt;strong&gt;&lt;em&gt;/mnt&lt;/em&gt;&lt;/strong&gt; as rootfs&lt;/p&gt;

&lt;p&gt;Starting with installing the base, you could add more package after &lt;strong&gt;&lt;em&gt;base-devel&lt;/em&gt;&lt;/strong&gt; if you’d like but here’s the basic.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;pacstrap /mnt base base-devel linux
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/8.livearch-pacstrap-slow.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;500KB/s??? Pacstrap is dumb and sometimes it cannot figure out what’s the best mirror to download from so here’s how you could manually select the nearest mirror:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/9.livearch-pacman-mirrorlist.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Edit the file &lt;strong&gt;&lt;em&gt;/etc/pacman.d/mirrorlist&lt;/em&gt;&lt;/strong&gt; and delete every other mirror except the closest one to you, I’m in Vietnam so here I kept the Vietnamese mirror and delete the rest.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/10.livearch-pacstrap-fast.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Save it, run pacstrap again, see how fast it is now?&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/11.livearch-genfstab.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Wait for the pacstrap to complete and then generate fstab file with:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;genfstab &lt;span class=&quot;nt&quot;&gt;-U&lt;/span&gt; /mnt &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; /mnt/etc/fstab
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/12.livearch-check-fstab.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now check if the fstab has properly generated, it must have the &lt;strong&gt;&lt;em&gt;rootfs (/)&lt;/em&gt;&lt;/strong&gt; and the &lt;strong&gt;&lt;em&gt;/boot&lt;/em&gt;&lt;/strong&gt; in there, these 2 should have been added automatically by genfstab but if it doesn’t, either you’ve done something wrong with the mounting step or genfstab is broken, try to add it manually.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;I’d recommend using UUID when interacting with fstab to prevent unexpected behavior&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/13.livearch-chroot.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here you have to &lt;strong&gt;&lt;em&gt;chroot&lt;/em&gt;&lt;/strong&gt; into the installed rootfs, what is &lt;strong&gt;&lt;em&gt;chroot&lt;/em&gt;&lt;/strong&gt;? It allows you to “join” into the installed rootfs environment as you were booted into it, meanwhile, the kernel still is from the host (Arch Linux Live), all the changes you made in here will be saved into your final installation disk (/dev/mapper/new_rootfs).&lt;/p&gt;

&lt;p&gt;Chroot into the installed directory with&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;arch-chroot /mnt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now when you’re inside the chroot, declaring the language and generate the locale with&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;LANG&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;en_US.UTF-8 &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /etc/locale.conf
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;en_US.UTF-8 UTF-8&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /etc/locale.gen
locale-gen
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I only do 1 step of adding locale because I’ve forgotten the rest when taking screenshots for this tutorial.
You could set up the Desktop environment and install things here if you like, I’ll skip it because that’s not what this tutorial is for.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/14.chroot-mkinitcpio-conf.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now the important step: While in chroot, edit the file &lt;strong&gt;&lt;em&gt;/etc/mkinitcpio.conf&lt;/em&gt;&lt;/strong&gt; and add &lt;strong&gt;&lt;em&gt;encrypt&lt;/em&gt;&lt;/strong&gt; to &lt;strong&gt;&lt;em&gt;HOOKS&lt;/em&gt;&lt;/strong&gt; as the picture above.&lt;/p&gt;

&lt;p&gt;You will need to add &lt;strong&gt;&lt;em&gt;keymap&lt;/em&gt;&lt;/strong&gt; before the &lt;strong&gt;&lt;em&gt;encrypt&lt;/em&gt;&lt;/strong&gt; if you want to use keymap other than the US standard keymap.&lt;/p&gt;

&lt;p&gt;Save the &lt;strong&gt;&lt;em&gt;mkinitcpio.conf&lt;/em&gt;&lt;/strong&gt; and to the next step&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/15.chroot-mkinitcpio.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now you will need to regenerate the initramfs for the kernel to be able to decrypt the encrypted rootfs with the added &lt;strong&gt;&lt;em&gt;encrypt&lt;/em&gt;&lt;/strong&gt; module.&lt;/p&gt;

&lt;p&gt;First, check your installed kernel version with&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; /usr/lib/modules
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;You can see the only installed kernel is &lt;strong&gt;&lt;em&gt;4.19.2-arch1-1-ARCH&lt;/em&gt;&lt;/strong&gt; (ignore the extramodules-ARCH)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;NOTE: Do not use uname -r to check for kernel version here, this command will return the current kernel which is used to boot and it’s from Arch Linux Live, it may or may not be the same version as the kernel which you’ve installed to the rootfs&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Get the name of the install kernel in /boot (vmlinuz-* for the kernel, initramfs-*.img for the initramfs) for use in the next step, if you use other kernels like Zen then the name will be different&lt;/p&gt;

&lt;p&gt;Generate new initramfs with&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mkinitcpio &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; /boot/initramfs-linux.img &lt;span class=&quot;nt&quot;&gt;-k&lt;/span&gt; 4.19.2-arch1-1-ARCH
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Modify the command as needed&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/16.livearch-exit.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now exit from &lt;strong&gt;&lt;em&gt;chroot&lt;/em&gt;&lt;/strong&gt; to the Arch Linux Live, I’m paranoid here so I’ve done another &lt;strong&gt;&lt;em&gt;sync&lt;/em&gt;&lt;/strong&gt; to make sure everything was flushed down the disk and then reboot, continue to boot with the Arch Linux bootable media.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;3-configure-efi-to-boot-the-kernel&quot;&gt;3. Configure EFI to boot the kernel&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/17.bootmenu-efishell.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;In the Arch Linux boot menu, chose &lt;strong&gt;&lt;em&gt;UEFI Shell x86_64 v2&lt;/em&gt;&lt;/strong&gt; this time to get into the EFI Shell&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/18.efishell-whatitlookslike.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here’s how the EFI Shell looks like, you could press &lt;strong&gt;&lt;em&gt;ESC&lt;/em&gt;&lt;/strong&gt; to skip startup.nsh if you’ve configured it to boot something else.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/19.efishell-map.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here types &lt;strong&gt;&lt;em&gt;map&lt;/em&gt;&lt;/strong&gt; to see which partition the EFI has recognized, it’s kinda similar to Linux, here I have &lt;strong&gt;&lt;em&gt;FS0&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;FS1&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/20.efishell-ls.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Use &lt;strong&gt;&lt;em&gt;ls fsX:&lt;/em&gt;&lt;/strong&gt; (with X is the FS# from the mapping table above)&lt;/p&gt;

&lt;p&gt;What you’re trying to find here is the partition which contains the kernel files (/boot)&lt;/p&gt;

&lt;p&gt;Here we found that the &lt;strong&gt;&lt;em&gt;fs0&lt;/em&gt;&lt;/strong&gt; is the one that we need, it has &lt;strong&gt;&lt;em&gt;vmlinuz&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;initramfs&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/21.efishell-bcfg.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;We need to add a new boot entry at &lt;strong&gt;&lt;em&gt;0&lt;/em&gt;&lt;/strong&gt; points to &lt;strong&gt;&lt;em&gt;vmlinuz-linux&lt;/em&gt;&lt;/strong&gt; so it will get booted first with the command:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;bcfg boot add 0 fs0:&lt;span class=&quot;se&quot;&gt;\v&lt;/span&gt;mlinuz-linux &lt;span class=&quot;s2&quot;&gt;&quot;Arch Linux&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/22.efishell-cmdline.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now create a new text file for storing the cmdline for the kernel with&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;edit fs0:&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;mdline.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Here you put the necessary kernel cmdline to boot your rootfs, in this example we have&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; cryptdevice=/dev/sda2:new_rootfs root=/dev/mapper/new_rootfs rw initrd=\initramfs-linux.img 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;NOTICE: Add extra spaces at the beginning of the line in the file. There is a byte order mark at the beginning of the line that will squash any character next to it which will cause an error when booting.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you use SSD for rootfs, you could add a flag to allow discarding on LUKS encrypted drive with &lt;strong&gt;&lt;em&gt;:allow-discards&lt;/em&gt;&lt;/strong&gt; added after the &lt;strong&gt;&lt;em&gt;cryptdevice&lt;/em&gt;&lt;/strong&gt;, it will becomes &lt;strong&gt;&lt;em&gt;cryptdevice=/dev/sda2:new_rootfs:allow-discards&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you want to use &lt;strong&gt;&lt;em&gt;intel-ucode&lt;/em&gt;&lt;/strong&gt;, you need to add an extra initrd before the actual linux initramfs, it will be something like this:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; cryptdevice=/dev/sda2:new_rootfs root=/dev/mapper/new_rootfs rw initrd=\intel-ucode.img initrd=\initramfs-linux.img 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Press &lt;strong&gt;&lt;em&gt;F2&lt;/em&gt;&lt;/strong&gt; to save and then &lt;strong&gt;&lt;em&gt;F3&lt;/em&gt;&lt;/strong&gt; to exit.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/23.efishell-addcmdline.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now insert the cmdline to the boot entry #0 with&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;bcfg boot &lt;span class=&quot;nt&quot;&gt;-opt&lt;/span&gt; 0 fs0:&lt;span class=&quot;se&quot;&gt;\c&lt;/span&gt;mdline.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;reboot your machine with &lt;strong&gt;&lt;em&gt;reset&lt;/em&gt;&lt;/strong&gt;, now you don’t need the Arch Linux bootable media anymore, you could pull it out and let your machine boot normally.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/24.archlinux-luks-passwd.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here you can see it’s booting and the kernel asked you to typing password for unlocking the rootfs&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_arch_linux_with_luks_and_boot_with_efistub/25.archlinux-booted.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;That’s it, that’s how you configure your machine to boot the kernel with UEFI meanwhile use LUKS for the rootfs. Comment below if you have any questions or stuck on somewhere along the line.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;resources&quot;&gt;Resources:&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://wiki.archlinux.org/index.php/EFISTUB&quot;&gt;EFISTUB&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system&quot;&gt;dm-crypt/Encrypting an entire system&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://itsfoss.com/install-arch-linux/&quot;&gt;How to Install Arch Linux&lt;/a&gt;&lt;/p&gt;</content><author><name>Nguyen Quang Minh</name></author><summary type="html">In this tutorial, I’ll show you how to install Arch Linux but with an encrypted rootfs (/) and with a bootloader-less setup (direct UEFI boot)</summary></entry><entry><title type="html">How to install/reinstall Linux on a VPS manually</title><link href="http://www.minhng99.cloud/How-to-reinstall-install-linux-on-a-vps-manually/" rel="alternate" type="text/html" title="How to install/reinstall Linux on a VPS manually" /><published>2018-11-13T00:00:00+00:00</published><updated>2018-11-13T00:00:00+00:00</updated><id>http://www.minhng99.cloud/How-to-reinstall-install-linux-on-a-vps-manually</id><content type="html" xml:base="http://www.minhng99.cloud/How-to-reinstall-install-linux-on-a-vps-manually/">&lt;p&gt;In this tutorial, I’ll show you how to reinstall or install another version or a completely different Linux OS for your VPS manually.&lt;/p&gt;

&lt;p&gt;This tutorial will come in handy if you want to install/upgrade to an unsupported Linux version from your hosting provider or wanted a customized partition scheme on your server.&lt;/p&gt;

&lt;h3 id=&quot;requirements&quot;&gt;Requirements:&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Networking access&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;VNC/KVM/IPMI access of the target machine which will handle the installation, UART/Serial console access might work with extra configuration&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;The targeted installation machine &lt;strong&gt;must&lt;/strong&gt; either be VPS using full virtualization (KVM/QEMU/VMware/VBOX) or is a dedicated server running on barebone hardware, &lt;strong&gt;OpenVZ or any kind of kernel virtualization or containers are not supported&lt;/strong&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;root access of the Linux server&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;note&quot;&gt;Note:&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;This tutorial might not always be working if the virtualization/hardware of the targeted machine is using some weird driver/non-standard hardware configuration.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Some VPS providers set Static IP for their clients, make sure you’ve written down the current IP configuration on the current pre-installed OS for later on, just in case!&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;1-getting-the-machine-to-boot-the-netboot-version-of-the-os-you-wanted-to-install&quot;&gt;1. Getting the machine to boot the &lt;strong&gt;netboot&lt;/strong&gt; version of the OS you wanted to install&lt;/h3&gt;
&lt;p&gt;Here you can see my pre-installed OS is Ubuntu 16.04 LTS, now I’ll try to get the beta version of Ubuntu which is 19.04 install on the same machine.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_reinstall_install_linux_on_a_vps_manually/1.os-info.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;First, you need to change the GRUB configuration so it will allow you to see the boot menu by editing the &lt;strong&gt;/etc/default/grub&lt;/strong&gt; and comment out (or delete) the line &lt;strong&gt;GRUB_TIMEOUT_STYLE=hidden&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_reinstall_install_linux_on_a_vps_manually/2.default_grub.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Then execute the command &lt;strong&gt;update-grub2&lt;/strong&gt; for generating the new boot config file.&lt;/p&gt;

&lt;p&gt;Then you check for the location of the first partition of your boot drive, here my VPS &lt;strong&gt;vda1&lt;/strong&gt; are mounted as &lt;strong&gt;/&lt;/strong&gt;, I’m going to download the &lt;strong&gt;netboot&lt;/strong&gt; version of Ubuntu which is just the 2 files&lt;strong&gt;linux&lt;/strong&gt; (kernel) and &lt;strong&gt;initrd.gz&lt;/strong&gt; (ramdisk) to &lt;strong&gt;/&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Those two files are located &lt;a href=&quot;http://archive.ubuntu.com/ubuntu/dists/disco/main/installer-amd64/current/assets/images/netboot/ubuntu-installer/amd64/&quot;&gt;HERE&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_reinstall_install_linux_on_a_vps_manually/3.download-initrd.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now you open the &lt;strong&gt;VNC/KVM/IPMI&lt;/strong&gt; of the VPS and then reboot it, it will look something like this&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_reinstall_install_linux_on_a_vps_manually/4.grub-counting.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This depends on your GRUB version, it might take you to the GRUB menu and start counting or it will be counting without showing the GRUB menu like what mine did, you could even holding [SHIFT] when the machine is booting for accessing the GRUB menu.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_reinstall_install_linux_on_a_vps_manually/5.grub-menu.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;You have to quickly press [ESC] for it to stop the automated boot and then press [c] for accessing the GRUB command-line&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_reinstall_install_linux_on_a_vps_manually/7.grub-console.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now you get to the command-line part, type it as above, you could remove the &lt;strong&gt;priority=low&lt;/strong&gt; for setup without &lt;strong&gt;Advanced mode&lt;/strong&gt;, for me I like the &lt;strong&gt;Advanced mode&lt;/strong&gt; so I put the &lt;strong&gt;priority=low&lt;/strong&gt; in there, the &lt;strong&gt;Advanced mode&lt;/strong&gt; will allow you to do much more customization for your installation like custom kernel selection, doesn’t force you to create standard user account…&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;2-install-the-os-using-netboot-installer&quot;&gt;2. Install the OS using netboot installer&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_reinstall_install_linux_on_a_vps_manually/8.ubuntu-installer.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now when you get to this part then it’s pretty easy down the line, just do what it asks you to do, starting off by &lt;strong&gt;Choose language&lt;/strong&gt; then it will take you to the next necessary step when you’ve finished it, don’t select the random step here if you don’t know what you are doing.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_reinstall_install_linux_on_a_vps_manually/9.diskpartition.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As I’ve said before, you could even do manual partitioning on the current disk of the server without any limitation, the setup is currently on RAM so it doesn’t care if the disk contents get nuked or anything &lt;strong&gt;!! Your old data will get nuked if you decide to format/erase the partitions !!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_reinstall_install_linux_on_a_vps_manually/10.kernel-selection.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;If you decided to go with the &lt;strong&gt;Advanced mode&lt;/strong&gt; as I do, you will get to this part which allows you to chose the appropriate kernel for your machine, usually select &lt;strong&gt;linux-generic&lt;/strong&gt; is fine but since this is a VPS and there won’t be any new device get connected to it, I choose the &lt;strong&gt;linux-virtual&lt;/strong&gt; for lightweight.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_reinstall_install_linux_on_a_vps_manually/11.initrd.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Also, this part if you’re using a VPS then I’d recommend to chose &lt;strong&gt;targeted&lt;/strong&gt; because it will make your boot process faster since the initrd will be smaller.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_reinstall_install_linux_on_a_vps_manually/12.ubuntu-desktop.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;You could even install a desktop environment or some recommended software suits your needs… But you can always install those later and I don’t want desktop environment on my server.&lt;/p&gt;

&lt;p&gt;After some waiting, the setup will say it’s finished, just do what it wanted you to do.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_reinstall_install_linux_on_a_vps_manually/13.finished.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;And setup finished, my VPS is running Ubuntu 19.04, now you have to install ssh server to remote it later on.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;heres-some-common-oss-netboot&quot;&gt;Here’s some common OS’s netboot:&lt;/h3&gt;
&lt;p&gt;Ubuntu: &lt;a href=&quot;http://archive.ubuntu.com/ubuntu/dists/disco/main/installer-amd64/current/assets/images/netboot/ubuntu-installer/amd64&quot;&gt;19.04&lt;/a&gt; &lt;a href=&quot;http://archive.ubuntu.com/ubuntu/dists/cosmic/main/installer-amd64/current/assets/images/netboot/ubuntu-installer/amd64/&quot;&gt;18.10&lt;/a&gt; &lt;a href=&quot;http://archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/current/assets/images/netboot/ubuntu-installer/amd64/&quot;&gt;18.04&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Debian: &lt;a href=&quot;http://ftp.debian.org/debian/dists/stretch/main/installer-amd64/current/assets/images/netboot/debian-installer/amd64/&quot;&gt;9.0&lt;/a&gt; &lt;a href=&quot;http://ftp.debian.org/debian/dists/jessie/main/installer-amd64/current/assets/images/netboot/debian-installer/amd64/&quot;&gt;8.0&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;CentOS: &lt;a href=&quot;http://mirror.centos.org/centos/7/os/x86_64/assets/images/pxeboot/&quot;&gt;7.0&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fedora: &lt;a href=&quot;https://dl.fedoraproject.org/pub/fedora/linux/releases/29/Server/x86_64/os/assets/images/pxeboot/&quot;&gt;29&lt;/a&gt;&lt;/p&gt;</content><author><name>Nguyen Quang Minh</name></author><summary type="html">In this tutorial, I’ll show you how to reinstall or install another version or a completely different Linux OS for your VPS manually.</summary></entry><entry><title type="html">How to install Windows on Linux server natively</title><link href="http://www.minhng99.cloud/How-to-install-Windows-on-Linux-server-natively/" rel="alternate" type="text/html" title="How to install Windows on Linux server natively" /><published>2018-11-12T00:00:00+00:00</published><updated>2018-11-12T00:00:00+00:00</updated><id>http://www.minhng99.cloud/How-to-install-Windows-on-Linux-server-natively</id><content type="html" xml:base="http://www.minhng99.cloud/How-to-install-Windows-on-Linux-server-natively/">&lt;p&gt;In this tutorial, I’ll show you how to install Windows Server on a VPS natively (without the need for virtualization software like VBOX, VMware…)&lt;/p&gt;

&lt;h3 id=&quot;requirements&quot;&gt;Requirements:&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;At least 2 machines (1 for sharing the setup data via Samba/Network Share, the other for installation)&lt;/li&gt;
  &lt;li&gt;Networking access between 2 machines&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;VNC/KVM/IPMI access of the target machine which will handle the installation, UART/Serial console access only will not work&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;The targeted installation machine &lt;strong&gt;must&lt;/strong&gt; either be VPS using full virtualization (KVM/QEMU/VMware/VBOX) or is a dedicated server running on barebone hardware, &lt;strong&gt;OpenVZ or any kind of kernel virtualization or container is not supported&lt;/strong&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;root access of the Linux server&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;note&quot;&gt;Note:&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;This tutorial might not always be working if the virtualization/hardware of the targeted machine is using some weird driver/non-standard hardware configuration.&lt;/li&gt;
  &lt;li&gt;I’ll also show you how to integrate VirtIO driver into Windows installation image for it to recognize network driver because Windows doesn’t have the driver for VirtIO built-in.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Some VPS providers set Static IP for their clients, make sure you’ve written down the current IP configuration on the Linux server that you’re going to install Windows on it, just in case!&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;1-integrating-virtio-driver-into-windows-iso&quot;&gt;1. Integrating VirtIO driver into Windows ISO&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Why we have to do this? Because on some common virtualization software which some VPS providers use, they use a specialized driver for their virtual devices and these devices doesn’t have driver pre-installed in Windows, the results could be somewhere from non-working network card to unbootable because of lacking disk driver&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You could download the latest VirtIO driver for the most variant of Windows &lt;a href=&quot;https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/&quot;&gt;HERE&lt;/a&gt;, chose the latest version, download the ISO file and extract it to get the driver files.&lt;/p&gt;

&lt;p&gt;If you know that the devices on the targeted machine use don’t need a specialized driver or you’re trying to install on a dedicated/bare-metal server, you could skip this step.&lt;/p&gt;

&lt;p&gt;You could do this with DISM and tons of command line… but to simplify the procedure I would recommend you to use &lt;a href=&quot;https://www.ntlite.com/&quot;&gt;NTLite&lt;/a&gt;. Here I’m using NTLite v1.7.1.6572 which is the latest version when this post is created.&lt;/p&gt;

&lt;p&gt;You’ll need a Windows setup ISO, here I’m using Windows Server 2019 evaluation downloaded from Microsoft’s website, after downloaded it you’ll need to &lt;strong&gt;extract&lt;/strong&gt; the content from it, you could use 7-Zip or some other ISO extract tools but here I’m just using Windows to mount it and then copy it out.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/1.mount-winiso.png&quot; alt=&quot;_config.yml&quot; /&gt;
&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/2.mount-winiso-explorer.png&quot; alt=&quot;_config.yml&quot; /&gt;
&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/3.copy-winiso-contents.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Why do I have to copy it out? Because NTLite (or Windows’s DISM) does not want to work with a read-only .wim file so you’ll have to copy it out somewhere writable.&lt;/p&gt;

&lt;p&gt;Now we will have to load it to NTLite for adding drivers into it.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/4.ntlite-add-image-dir.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Starting off by click &lt;strong&gt;Add&lt;/strong&gt; and then &lt;strong&gt;Image directory&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/5.ntlite-select-image-dir.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here choose the directory of the extracted content from the ISO file, I’ve copied the contents to &lt;strong&gt;C:\winiso-extract&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do not select the mounted, read-only drive&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/6.ntlite-load-os.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;NTLite will show how many variants of the OS is available inside the ISO files, there could be multiple selections here like for Pro/Core Installation/Datacenter… &lt;strong&gt;Select the one that you’re going to install, if you install the driver into the wrong version which you will not use for the actual setup then you’ll NOT get the driver that you’ve integrated&lt;/strong&gt; or you could integrate the driver for every variant of it… but it will need some time to do so, here my ISO only have Essential so I’ll just go with it&lt;/p&gt;

&lt;p&gt;Right-click into the variant you want to integrate driver under &lt;strong&gt;Operating systems | install.wim&lt;/strong&gt; and select &lt;strong&gt;Load&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/7.ntlite-add-driver-dir.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;After some time of waiting, the long menu on the left side will appear, now select &lt;strong&gt;Drivers&lt;/strong&gt;, &lt;strong&gt;Add&lt;/strong&gt;, &lt;strong&gt;Directory containing drivers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/8.ntlite-select-driver-dir.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now you have to select the appropriate driver for your OS version and architecture, select the wrong one could bring disaster so make sure it’s the right one.&lt;/p&gt;

&lt;p&gt;The driver folder which you select should’ve looked something like this inside:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/9.driver-example.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;For Windows to work on VirtIO virtualized properly, you have to have at least these 4 driver in it (Baloon, &lt;strong&gt;NetKVM&lt;/strong&gt;, VioSCSI, VIOStor), &lt;strong&gt;NetKVM is the important bit because you will be able to download those drivers later but without internet access on your targetted machine after install has finished then you have no way to download anything&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I’ll just be going to add as below…
&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/10.ntlite-driver-added.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now select the &lt;strong&gt;Apply&lt;/strong&gt; on the left side, chose the option as you want in the middle, you could skip the &lt;strong&gt;Create ISO&lt;/strong&gt; if you’re gonna to create a shared directory right after this… But it’s nice to have the ISO image for backing up somewhere so you don’t have to do this again.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/11.ntlite-apply.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;After you’ve done fiddling around, press the green &lt;strong&gt;Process&lt;/strong&gt; button on the top left corner for NTLite to do its job.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/13.ntlite-finished.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This could take a pretty long time to finish so just wait patiently and hopefully it will succeed in the end.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;2-create-a-shared-folder-of-the-windows-installation-iso&quot;&gt;2. Create a shared folder of the Windows Installation ISO&lt;/h3&gt;

&lt;p&gt;Now I’m assuming that you’ve succeeded in integrating the drivers into the Installation ISO? Good, now you’ll need to create a &lt;strong&gt;Shared folder&lt;/strong&gt; on another Windows machine, you could use &lt;strong&gt;Samba&lt;/strong&gt; to create a shared folder on Linux if you don’t have another Windows machine laying around but since I already have a Windows machine here so I’ll just use it.&lt;/p&gt;

&lt;p&gt;If you did not use &lt;strong&gt;Create ISO&lt;/strong&gt; with NTLite, it will save the driver integrated setup into the &lt;strong&gt;Image directory&lt;/strong&gt; which you’ve selected earlier, you could directly use it without any issue (the &lt;strong&gt;Image directory&lt;/strong&gt; is &lt;strong&gt;C:\winiso-extract&lt;/strong&gt; in my case) but here since I’ve created a new ISO so I’m gonna to mount it and serve the mounted drive as a &lt;strong&gt;Shared folder&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/14.mount-winvirtiso.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/15.share-winvirtiso.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;You’ll need to &lt;strong&gt;Disable Windows Firewall&lt;/strong&gt; for reaching the &lt;strong&gt;Shared folder&lt;/strong&gt; from outside the internet (which is what the targeted installation machine will do).
&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/16.disable-firewall.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;3-obtaining-winpe-iso&quot;&gt;3. Obtaining WinPE ISO&lt;/h3&gt;

&lt;p&gt;WinPE ISO is a very “mini” version of Windows which can run on RAM, you’ll need to install a big &lt;strong&gt;Windows Assessment and Deployment Kit (ADK)&lt;/strong&gt; which is around 1.5GB just to create a 300MB ISO file which is ridiculous, I’ll attach the WinPE ISO file with the VirtIO driver integrated here for easier for you to use it.&lt;/p&gt;

&lt;p&gt;But here’s the related docs if you curious on how to get the ISO file: &lt;a href=&quot;https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/download-winpe--windows-pe&quot;&gt;https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/download-winpe–windows-pe&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You also could use NTLite to add VirtIO driver to WinPE.&lt;/p&gt;

&lt;p&gt;Download my WinPE ISO integrated with VirtIO driver:
&lt;a href=&quot;https://drive.google.com/open?id=1p3BkUCXl6Dl98DYdeBHRLyM_YwzSGEM-&quot;&gt;winpe-with-virtio.iso&lt;/a&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;4-configure-grub-to-boot-winpe-on-linux-server&quot;&gt;4. Configure GRUB to boot WinPE on Linux server&lt;/h3&gt;

&lt;p&gt;The Linux OS I’m using is Ubuntu 18.04, other OS might involve different steps to generate new &lt;strong&gt;grub config file&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;First of, login to your Linux server using SSH using root.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/17.dirs.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Create a new dir called &lt;strong&gt;win&lt;/strong&gt; in &lt;strong&gt;/&lt;/strong&gt; by executing command:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; /win
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Download wimboot into the directory by using the command:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;wget https://www.minhng99.cloud/assets/files/wimboot &lt;span class=&quot;nt&quot;&gt;-O&lt;/span&gt; /win/wimboot
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Download and copy the &lt;strong&gt;winpe-with-virtio.iso&lt;/strong&gt; into &lt;strong&gt;/win/winpe-with-virtio.iso&lt;/strong&gt; also&lt;/p&gt;

&lt;p&gt;Now be careful with the partitions here, on my server there’s only 1 disk and 1 partition (your server might be different), and my &lt;strong&gt;/&lt;/strong&gt; is located on &lt;strong&gt;disk 0 partition 1&lt;/strong&gt;, if your grub bootloader is located on another partition then it will need a little bit of modification for it to work… I’ll tell you how to deal with different partition scheme later.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/18.default_grub.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now edit the file &lt;strong&gt;/etc/default/grub&lt;/strong&gt; to comment out (or delete) the line &lt;strong&gt;GRUB_TIMEOUT_STYLE=hidden&lt;/strong&gt; as above.&lt;/p&gt;

&lt;p&gt;Some other grub version might use &lt;strong&gt;GRUB_HIDDEN_TIMEOUT_QUIET=true&lt;/strong&gt;, comment out (or delete) that line also.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;nano /etc/default/grub
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Use Ctrl+O to save and Ctrl+X to exit.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/19.grub_40_custom.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now use edit the file &lt;strong&gt;/etc/grub.d/40_custom&lt;/strong&gt; and add the following code at the end of that file&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;menuentry &quot;wimboot winpe&quot; {
        set iso_path=&quot;/win/winpe-with-virtio.iso&quot;
        loopback loop $iso_path
        linux16 /win/wimboot
        initrd16 \
                newc:bootmgr:(loop)/bootmgr \
                newc:bcd:(loop)/Boot/BCD \
                newc:boot.sdi:(loop)/Boot/boot.sdi \
                newc:boot.wim:(loop)/sources/boot.wim
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Remember I said something with the partitioning? If your &lt;strong&gt;/&lt;/strong&gt; is not located on the same disk and partition as grub, you will have to do a little modification to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;set iso_path=&quot;/win/winpe-with-virtio.iso&quot;&lt;/code&gt; for pointing grub to the proper disk/partition by change it to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;set iso_path=&quot;(hd0,1)/win/winpe-with-virtio.iso&quot;&lt;/code&gt; here &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hd0,1&lt;/code&gt; means the ISO file is located on the disk 0 and partition 1, change those number as your partition scheme, also - there’s no partition 0, the first partition is 1.&lt;/p&gt;

&lt;p&gt;You need to modify the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;linux16 /win/wimboot&lt;/code&gt; to point it to the correct partition also.&lt;/p&gt;

&lt;p&gt;If your partition scheme is the same as mine then you can just copy and paste it in place.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/20.update-grub2.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;update-grub2&lt;/code&gt; to generate new &lt;strong&gt;grub config file&lt;/strong&gt;.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;5-installs-windows-by-using-winpe&quot;&gt;5. Installs Windows by using WinPE&lt;/h3&gt;

&lt;p&gt;Now you have to access the &lt;strong&gt;VNC/KVM/IPMI&lt;/strong&gt; of the Linux VPS you wanted to install Windows on it, this is a special feature and it’s available on most of hosting services which allow you to control the VPS/server even the network is down/system crash/kernel panic…, it works by capture the screen output from the machine and send it to you meanwhile capture your input and send it to the machine just like you are in front of it and access it physically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If you don’t have access to such feature then you will not be able to do setup.. at least with the method of this tutorial which involves manual setup&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/20.update-grub2.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Open the VNC from the VPS’s control panel, type &lt;strong&gt;reboot&lt;/strong&gt; in the SSH and you would see something like this&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/21.grub-bootmenu.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Use your &lt;strong&gt;[arrow keys]&lt;/strong&gt; and select the &lt;strong&gt;wimboot winpe&lt;/strong&gt; and &lt;strong&gt;[Enter]&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/22.winpe-booted.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now the WinPE is booted and you would see something like this, it’s fine, don’t panic. Now check the internet accessibility by pinging a known working IP address like 1.1.1.1 or 8.8.8.8&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/23.winpe-pingtest.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;If you see it reply then good, internet access is working and you may proceed to the next step, if the network is not working (request timed out or something else showing) then there might be error in somewhere, it could be your VPS provider doesn’t allow DHCP and you have to set the IP by using the command line, or it could be the network device not being recognized. You will have to diagnose this yourself, sorry.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/24.winpe-mountsmb.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now do you remember the &lt;strong&gt;Shared directory&lt;/strong&gt; we’ve created on step 2? You need it now.&lt;/p&gt;

&lt;p&gt;Mount the &lt;strong&gt;Shared directory&lt;/strong&gt; which is the contents of the Windows Setup to drive &lt;strong&gt;w:&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-batch highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;net&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;w&lt;/span&gt;: \\YOUR_SHARED_SERVER_IP\winiso &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;/USER&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;:WORKGROUP&lt;/span&gt;\YOUR_SHARED_DIRECTORY_USERNAME
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Type the password for &lt;strong&gt;YOUR_SHARED_DIRECTORY_USERNAME&lt;/strong&gt; then [Enter], if it say successfully as above then it’s good to go, otherwise you have to check the step 2 again.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/25.winpe-windowssetup.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now navigate to the Windows Setup drive which is &lt;strong&gt;w:&lt;/strong&gt; by typing&lt;/p&gt;

&lt;div class=&quot;language-batch highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;w&lt;/span&gt;:
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;and then run the setup with&lt;/p&gt;

&lt;div class=&quot;language-batch highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;.exe&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and proceed the installation process as you would do on a normal Windows Setup&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/26.winpe-deletepartition.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As for this step, select &lt;strong&gt;Delete&lt;/strong&gt; for deleting the Linux OS’s partition &lt;strong&gt;!! YOU WILL LOSE ALL OF YOUR LINUX OS’S DATA !!&lt;/strong&gt; and select &lt;strong&gt;Next&lt;/strong&gt; or you could create the partition as you’d like.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/27.winpe-installingwindows.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now it’s time to wait and hope that everything will be OK, the speed of this highly depends on your Linux server’s Download speed and the Shared server’s Upload speed (whichever is the slowest)&lt;/p&gt;

&lt;p&gt;Unfortunately… Windows Server 2019 somehow bugged and results in BSoD when the installation successful so I’ve redone it with Windows Server 2016, it’s basically the same.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/28.welcomescreen.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Woohoo, we got to this welcome screen now, just set things up yourself.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/29-network-check.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As we can see, the network device is recognized and working properly.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/how_to_install_windows_on_linux_server_natively/30-device-manager.png&quot; alt=&quot;_config.yml&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Also, there are no missing drivers.&lt;/p&gt;

&lt;p&gt;Now you just have to enable RDP or install TeamViewer or just… use VNC as is for remoting your server. With this tutorial, you can install Windows Server yourself on hosting providers which are not supported it or charging you ridiculous amount of “license fees”, but I don’t think that they’ll happy to see you’re running Windows Server without their permission :)&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;resources&quot;&gt;Resources:&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://ipxe.org/wimboot&quot;&gt;wimboot&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://drive.google.com/open?id=1rJgQ3h6aGycqHMViBGirmXW1t264MlF1&quot;&gt;Windows Server 2016 Standard/Datacenter ISO with VirtIO&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://drive.google.com/open?id=1p3BkUCXl6Dl98DYdeBHRLyM_YwzSGEM-&quot;&gt;Windows PE ISO with VirtIO&lt;/a&gt;&lt;/p&gt;</content><author><name>Nguyen Quang Minh</name></author><summary type="html">In this tutorial, I’ll show you how to install Windows Server on a VPS natively (without the need for virtualization software like VBOX, VMware…)</summary></entry></feed>