Network and Firewall

Since we are setting up node infrastructure, we will need to use static IP configurations with tight firewall rules.

First, we are going to give our device a static IP. Find the name of your ethernet adapter.

ip a

Ours is named eth0.

Now, let's edit our network interfaces configuration file.

sudo nano /etc/network/interfaces

Please edit your file similar to the following, replacing the placeholder text with your IP information, as well as replacing eth0 with the appropriate adapter name if necessary.

Also, please feel free to delete or remove the comments at the top of the interfaces file as they are not necessary.

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
 address <your IP address>
 netmask <your netmask, class C will be 255.255.255.0>
 gateway <your gateway>
 dns-nameservers <your DNS, 8.8.8.8 (google) works fine here>

Restart the networking service.

sudo systemctl restart networking.service

Firewall

For convenience, we are going to use UFW (Uncomplicated Firewall), which is a front-end for iptables (a utility that allows configuration fo the Linux Kernel Firewall). Earlier, we installed ufw with apt. Now we are going to do some basic firewall configuration.

Let's set some defaults.

At this point, you should be able to ssh into your Raspberry Pi and continue configuration from there. While plugged in, please SSH into your Raspberry Pi with the following command from another machine.

You will then be prompted for the password you created when you added the user.

Once you have successfully connected to your device with SSH you may move transfer it to a more permanent location and we will continue configuration over SSH.

Last updated