Raspberry Pi 4 — Network configuration

Andor Markus
3 min readAug 20, 2019

--

source: https://unsplash.com/photos/ISG-rUel0Uw

Lets start:

Previously we installed Raspbian and Docker on Raspberry Pi 4: https://medium.com/@markus.andor/raspberry-pi-4-home-docker-server-headless-installation-f76ed5f8c3d5

In these these tutorial we are going to configure the Raspbian for better performance and stability.

We are going to configure the followings:

  1. Setup static IP
  2. Turn off Wlan and Bluetooth
  3. Disable IPv6

Let take a look on the current network configuration

ifconfig
Raspberry Pi connected via ethernet and wlan is not in use

In most of the home configuration the Raspberry Pi directly connected to the router and doesn’t need advanced configuration.

  1. Setup static IP address between the router and Raspberry Pi

First you have to configure your router to assign static IP to a specific MAC id. Please read the manual of you router.

Configure static IP for Raspberry Pi

sudo ifconfig eth0 192.168.XXX.XXX netmask 255.255.255.0 up
You can use any IP address you want until it matches with the setup on the router side

2. Turn off Wifi/Wlan and Bluetooth permanently

For this operation we have to edit the config.txt file

sudo nano /boot/config.txt

In nano to the end of the file and insert the following lines. For Raspberry Pi 4 you have to use “pi3” configuration

dtoverlay=pi3-disable-wifi 
dtoverlay=pi3-disable-bt
config.txt after inserting the new configurations

CTRL + O to write out the setting and CTRL + X to exit nano.
To all of the changes go live you have to reboot the Raspberry Pi

sudo reboot

To check the result run <ifconfig> command again and wlan0 adapter should be disabled.

Successful configuration

3. Disable IPv6

As preciously you run <ifconfig> command you could see under the “inet6” you IPv6 address. For most of home network you don’t need it.

Open sysctl.conf in nano.

sudo nano /etc/sysctl.conf

In nano to the end of the file and insert the following lines.

net.ipv6.conf.all.disable_ipv6 = 1
sysctl.conf after inserting the new configurations

CTRL + O to write out the setting and CTRL + X to exit nano.
To all of the changes go live you have to reboot the Raspberry Pi

sudo reboot

To check the result run <ifconfig> command again and wlan0 adapter should be disabled.

To check the result run <ifconfig> command again and wlan0 adapter should be disabled.

“inet6” line is no longer present

--

--

Andor Markus

Big Data Engineer. Open source advocate. Currently helping Marc O’Polo to build next generation cloud data platform.