This script is designed by U/NORD IT and authored by Gorm Reventlow. It is intended for use by U/NORD Carlsbergvej students to streamline the setup of Wi-Fi connections and hostname configurations on Raspberry Pi devices.
- Automated Hostname Setup: Easily set a custom hostname for your Raspberry Pi.
- Static IP Configuration: Configure a static IP address with predefined network settings.
- Mandatory Wi-Fi Configuration: Ensure your Raspberry Pi connects to the designated Wi-Fi network.
- Configuration Validation: Verifies all necessary parameters are correctly set before applying changes.
- Backup Creation: Automatically backs up existing network configuration files for safety.
- A Raspberry Pi 4 running a compatible Linux distribution (e.g., Raspberry Pi OS).
git
installed on your Raspberry Pi.- Sudo privileges to execute scripts with administrative rights.
Follow these steps to clone the repository, set up permissions, configure your network settings, and run the script.
Open a terminal and clone directlyh down to the Raspberry Pi or a USB drive:
git clone https://github.com/unord/cbv-rpi-student-setup
Navigate to the cloned directory and make the script executable:
cd network-config
chmod +x setup_static_ip.sh
chmod 600 network_config.conf
setup_static_ip.sh
: Grants execute permissions to run the script.network_config.conf
: Secures the configuration file by restricting read and write permissions to the owner only.
Edit the network_config.conf
file to input your specific network settings:
nano network_config.conf
Update the following parameters as needed:
# ------------------------------
# Wi-Fi Configuration
# ------------------------------
SSID="" # Get SSID from [email protected] for raspbery pi projects at CBV
PSK="" # Your Wi-Fi password from [email protected] for raspberry pi projects
COUNTRY="DK" # Keep the country code to "DK" unless you are trying somthing funky
# ------------------------------
# Wi-Fi Static IP Configuration
# ------------------------------
SUBNET_WLAN="/20" # Subnet mask for vlan 192 is "/20" if using another VLAN contact [email protected]
GATEWAY_WLAN="10.126.192.1" # Default gateway IP for VLAN 192, if using another VLAN contact [email protected]
DNS_WLAN="10.255.1.4 8.8.8.8 8.8.4.4" # DNS servers separated by spaces. Here we first trying EFIF DNS and if it fails it uses Googles
Important: Ensure all fields are correctly filled out to avoid configuration errors.
Execute the script with sudo
to apply the network configurations:
sudo ./setup_static_ip.sh
Follow the on-screen prompts to:
- Enter your desired hostname.
- Specify the static IP address for your Raspberry Pi.
- Confirm the application of changes and optionally reboot the system to apply configurations immediately.
If you encounter any issues during the setup process, please reach out to our IT support:
📧 Email: [email protected]
Provide a detailed description of the problem, including any error messages received, to receive prompt assistance.
Contributions are welcome! If you have suggestions for improvements or encounter bugs, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License.