A robust, distribution-independent bash script that configures static IP addresses across any Linux system. Works with Ubuntu, Debian, CentOS, RHEL, Fedora, and virtually any Linux distribution!
- ✨ Universal compatibility across Linux distributions
- 🔍 Multiple methods for interface detection
- 🛠️ Support for various network configuration systems:
- Netplan (Ubuntu 17.10+)
- NetworkManager
- Traditional network scripts
- Debian/Ubuntu interfaces
- 🔄 Automatic fallback mechanisms
- 💾 Automatic configuration backup
- ✅ Comprehensive verification checks
- Root privileges
- Basic network connectivity
- One of the following:
ip
command (iproute2 package)route
command (net-tools package)netstat
command (net-tools package)
Run directly from GitHub:
curl -sSL https://raw.githubusercontent.com/shahedfardous/staticIP/main/configure_ip.sh | sudo bash -s 192.168.1.100/24 192.168.1.1
sudo ./configure_ip.sh <ip_address/cidr> <gateway>
sudo ./configure_ip.sh 192.168.1.100/24 192.168.1.1
-
Modern Systems
- NetworkManager (GUI systems)
- Netplan (Ubuntu 17.10+)
-
Traditional Systems
- Network scripts (RHEL/CentOS)
- interfaces file (Debian/Ubuntu)
-
Fallback Methods
- Direct interface configuration
- System-specific methods
- Multiple methods for interface detection:
ip route
route -n
netstat -rn
- Direct system interface enumeration
- Automatic backup of existing configurations
- Progressive fallback for network commands
- Comprehensive error checking
The script will automatically:
- Detect your Linux distribution
- Identify available networking tools
- Choose the most appropriate configuration method
- Apply the configuration using the best available method
- Verify the changes using available tools
- Always review scripts before running them directly from the internet
- Backup your network configuration before running
- Have physical access to the system in case of misconfiguration
- Some configurations may require a system restart
If the script fails:
- Check if required networking tools are installed
- Verify root privileges
- Ensure interface name is correct
- Check system logs for errors
Contributions are welcome! Please feel free to submit issues and pull requests.
GPL-3.0 license - feel free to use in your projects!
If you find this script helpful, please star the repository!
Last updated: January 2025
- Added multiple interface detection methods
- Improved distribution compatibility
- Enhanced error handling
- Added fallback mechanisms