Setting up DC Hub on Raspberry Pi

Aditya Pal came to my room to check out a Raspberry Pi that I recently got as a gift. I told him, it a small credit card size computer. It powers on as soon as you plug in and boots up fast. I was already using it as a server for other purposes (hosting BitZoom). Our hostel at college had a strange network issue. The intra-hostel network worked smoothly. But, we had to face a lot of issues outside of the hostel (especially at Hostel 7 when it was disconnected from the external network for a month). The college's official DC was on the external network and it was inaccessible for quite a long time whenever we faced network issues. Aditya suggested me the idea of setting up DC on Raspberry Pi for the students of the hostel. We worked together for a few days to finally set up DC on Raspberry Pi named Raspbian. It remained active for over a year unless the college administration finally decided to shut it down due to network congestion. There were already 4 active hubs drawing traffic. In this article, I would tell you the steps to set up a DC hub on Raspberry Pi. I would only provide you with abstract steps without digging into details. I assume that you are already well-versed with Linux (Debian dist), VNC and Networking.

Step 1: Install NOOBS operating system (Optional)

If you already have an operating system installed on Raspberry Pi, then you may skip this step. There are a lot of operating systems available for Raspberry Pi. I find NOOBS or Raspbian to be perfect to begin with. Go to and install your favourite operating system by following the steps. It is long and complex process to install an operating system on a system that doesn't have any I/O devices. The best way to get started would be to have an external monitor and USB keyboard and mouse connected to the Raspberry Pi till an operating system is installed.

Step 2: Set up VNC Server (Optional)

Once you have installed an operating system, it is recommended to install VNC server on Raspberry Pi. VNC server would let you access a system remotely. You no longer need to connect an external monitor or input devices. Tight VNC is a popular implementation of VNC that is available for Raspbian OS.

  • Power on Raspberry Pi and connect your computer to Raspberry Pi via Ethernet. Your PC will allocate a dynamic IP to Raspberry Pi.
  • Share your Internet with the Ethernet. This will allow Raspberry Pi to access the Internet.
  • Issue a address resolution using your terminal. You will get the dynamic IP address of Raspberry Pi.
         > arp -a
      • Use SSH to log in remotely to Raspberry Pi.
      • Once logged in, we can install Tight VNC. Run the following command in the SSH session to install Tight VNC.
                         > sudo apt-get update
              > sudo apt-get install tightvncserver
      • Next, we will start Tight VNC on port number 1. You will be prompted to set a password.
              > vncserver :1
      • Finally we will configure Pi to auto start Tight VNC upon startup.
              > cd /home/pi
              > cd .config
              > mkdir autostart
              > cd autostart
              > leafpad tightvnc.desktop

                Add the following to leafpad and save and exit. VNC will autostart from the next boot.

              [Desktop Entry]
              Exec=vncserver :1
      • Use a VNC viewer (e.g. Real VNC) on your PC to login to Pi on port 1.

      Step 3: Set up static IP (Optional)

      We won't like the hub to change its address whenever Pi starts up. So we will be setting up static IP for the same. Open /etc/dhcpcd.conf on Pi and add the following to the end:

      interface eth0
      static ip_address=<IP>/<subnet>
      static routers=<Router address>
      static domain_name_servers=<Nameserver address>

      Step 4: Install PtokaX

      PtokaX is a popular Direct Connect Hub. Here we will be installing PtokaX You can check the latest distribution from the website
      • Install the necessary build tools.
             > sudo apt-get install make g++ zlib1g-dev libtinyxml-dev
      • Install Lua, the default scripting language of PtokaX
             > sudo apt-get install liblua5.2-dev
      • Download, extract and build PtokaX
             > wget
             > tar -xf
             > cd PtokaX
             > make lua52
      • To run, simply run:
             > ./PtokaX -m
      • You may edit the Settings.pxt in cfg according to your needs.
      • To auto start PtokaX on startup add the following line to rc.local inside /etc folder.
             > cd PtokaX && ./PtokaX


      You have successfully set up your own DC Hub that can easily works days and night without stopping. I had left it running for about 5 months non-stop and faced no issues.


      Popular posts from this blog

      DDoS Attack on Bitotsav '19 Website

      Popular ethical hacking tricks on LAN

      Rendering Performance Evaluation - Android SDK vs React Native