Raspberry Pi 4 — Network configuration
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:
- Setup static IP
- Turn off Wlan and Bluetooth
- Disable IPv6
Let take a look on the current network configuration
ifconfig
In most of the home configuration the Raspberry Pi directly connected to the router and doesn’t need advanced configuration.
- 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
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
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.
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
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.