Raspberry is a microcomputer board of small dimensions to which we will be able to give several uses.

It appeared in 2012, selling more than 500.00 units by August of that same year. This first unit had a 700 Hz processor, a 256 MB RAM, a 26-pin GPIO connector, video output by HDMI or RCA, plus a 3.5 mm connector for audio.

In addition to continuing with the same reduced structure during the following years, all versions were receiving updates to make them more modern and functional, but without forgetting their reduced price.

It uses the Raspbian operating system, based on Linux and special to take advantage of the hardware of this microcomputer, as well as a multitude of accessories such as boxes with passive cooling and peripherals to connect to its GPIO pins, such as cameras, tuners, touch screens, WiFi, etc.

It is a device that serves to take computing anywhere, being able to surf the Internet, view emails, photos, videos, etc. for very little money, incorporating, if you like, peripherals such as a monitor, keyboard, or mouse, among many other things.

That said, it is clear that we are facing an extremely interesting device to take you on a trip, also knowing that it can become our portable WiFi router. Which will mean that we do not have to use the hotel where we are again, to give you an example.

Let's see how we can make it a portable Travel WiFi router.



First things first

Although we can use any operating system that is based on Linux, the truth is that it is best to do it with Raspbain, and if you can, that it is the latest version.

We must have the Raspberry configured with Raspbain and connected to the Internet through RJ-45. if this is met, the first thing we must do is update everything necessary such as software, system, and application sources. For that we must put the following:

  • sudo apt-get update
  • sudo apt-get upgrade
  • sudo apt-get dist-upgrade

Once these commands are executed, we can continue with the rest.

What we have just done is not that it is paramount, but it is very convenient to have the latest and ensure total success in what we are going to carry out.

We must buy a USB WiFi card to connect it to the Raspberry Pi to be able to have a wireless connection, always being sure that there are drivers compatible with our device.

To know if it detects the card we type lsusb.

If it appears in the list, we must check that it can work in AP mode, putting iw list.

Now we must observe if Mode: AP comes out on the screen, which means that it is compatible.

The software

Virtually everything we need already comes in Raspbain.

Even so, we could have difficulties with the DHCP server and access points, so we must type the following:

  • sudo apt-get install ISC-DHCP-server hostapd

In addition, we must install Hostapd, free software with which we can put a WPA2 or WP3 password, although we advise you to use WPA2 at first, in case there are incompatible problems.

Now is the best time to restart your computer and get ready to set it up.

Let's configure

Then we must make certain configurations in a certain order:

So follow the indications and so we will get to have everything complete.

  • sudo cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.orig
  • sudo nano /etc/dhcp/dhcpd.conf

In this way we configure the DHCP server.

Now we comment on a series of lines as follows:

  • #option domain-name "example.org";
  • #option domain-name-servers ns1.example.org, ns2.example.org;

Next, we must write authoritative;

To finish we configure the network as follows:

  • subnet 192.168.2.0 netmask 255.255.255.0 {
  • range 192.168.2.2 192.168.2.30;
  • option broadcast-address 192.168.2.255;
  • option routers 192.168.2.1;
  • default-lease-time 600;
  • max-lease-time 7200;
  • option domain-name "local";
  • option domain-name-servers 8.8.8.8, 8.8.4.4;
  • }

Now we close the file.

We open a new server configuration file;

  • sudo cp /etc/default/isc-dhcp-server /etc/default/isc-dhcp-server.orig
  • sudo nano /etc/default/isc-dhcp-server

We must look for INTERFACE=» and change it to INTERFACES="wlan0"

We continue to configure because there is less and less to finish.

WLAN and Ethernet

In this section the first thing to discount the WiFI card with sudo ifdown wlan0

Then it is time to open the Interfaces file by typing:

  • sudo cp /etc/network/interfaces /etc/network/interfaces.Orig
  • sudo nano /etc/network/interfaces

Once inside you have to type a series of things to modify it.

You have to leave it like this:

  • auto lo
  • iface lo inet loopback
  • iface eth0 inet DHCP
  • allow-hotplug wlan0
  • iface wlan0 inet static
  • address 192.168.2.1
  • netmask 255.255.255.0

For the changes to take effect we must type sudo ifconfig wlan0 192.168.2.1

Now we continue to configure the access point.



Access point

There is less and less left and that is why what we are going to do is configure the access point.

We start by typing the following to edit another file:

  • sudo cp /etc/hostapd/hostapd.conf /etc/hostapd/hostapd.conf.orig
  • sudo nano /etc/hostapd/hostapd.conf

We delete and paste what is necessary so that it remains as we want.

That is, in this way:

  • interface=wlan0
  • ssid=RaspiAP
  • hw_mode=g
  • channel=6
  • macaddr_acl=0
  • auth_algs=1
  • ignore_broadcast_ssid=0
  • wpa=2
  • wpa_passphrase=password
  • wpa_key_mgmt=WPA-PSK
  • wpa_pairwise=TKIP
  • rsn_pairwise=CCMP

The truth is that the name of the network can be modified by the one we want (SSID) so that way we customize it a little more.

The port is another thing that we can change and what is wpa_passphrase (the password) can also be modified.

It would only be necessary to open another file by typing:

  • sudo cp /etc/default/hostapd /etc/default/hostapd.orig
  • sudo nano /etc/default/hostapd

We must change the line #DAEMON_CONF=»» to: DAEMON_CONF="/etc/hostapd/hostapd.conf"

Now we save and restart in the absence of the last details to achieve our goal.

To finish

Although the access point is already configured and operational, it still cannot be connected via the Internet, so we need to fix that as follows.

The first thing we must achieve is that the Raspberry forwards the packets to the router. For that we open and edit:

  • sudo cp /etc/sysctl.conf /etc/sysctl.conf.Orig
  • sudo nano /etc/sysctl.conf

Replacing "#net.ipv4.ip_forward=1" with net.ipv4.ip_forward=1

Now we must type Sudo sysctl -p /etc/sysctl.conf and enable the function by putting sudo iptables -t nat -A POSTROUTING -j MASQUERADE

Once we have done this, we will make the access point and DHCP start automatically.

That is why you must put:

  • sudo update-RC.d hostapd enable
  • sudo update-RC.d ISC-DHCP-server enable

And to finish all the configurations and finally get to have a Raspberry that is a travel router, we must move a problematic file so that it does not generate any incident.

It is achieved by writing the following:

  • sudo mv /usr/share/dbus-1/system-services/fi.epitest.hostap.WPASupplicant.service /home/pi

We have already configured the Raspberry as a router and, therefore, it can be used wherever we want.

Tell us what you thought of all these tutorials on our social networks, we want to know your opinion.