**AFWall+ (Android Firewall+)** is a powerful, open-source firewall application for rooted Android devices. Built on Linux's robust `iptables` framework, AFWall+ provides **granular network control** at the system level - something impossible with standard Android permissions.
### 🎯 **Core Purpose**
- **Block unwanted network access** by apps, even when they have internet permission
- **Prevent data leaks** and unauthorized background connections
- **Monitor network activity** with comprehensive logging
- **Save battery and data** by controlling which apps can connect when
- **Enhance privacy** by blocking tracking and analytics
### 🛡️ **How It Works**
AFWall+ operates at the **Linux kernel level** using `iptables` rules to:
1.**Intercept all network requests** before they leave your device
2.**Apply custom firewall rules** based on your preferences
3.**Allow or block connections** per app, per network type (WiFi, mobile, VPN)
4.**Log blocked attempts** for monitoring and analysis
This approach is **far more powerful** than app-level solutions because it works regardless of how apps try to connect to the internet.
- **Requires root access** - No root = no functionality
- **Not an antivirus** - Doesn't scan files for malware
- **Not an ad-blocker** - Blocks network access, not ads within allowed connections
- **VPN conflicts** - Some VPN apps may interfere with firewall rules
- **System-level apps** - Some system processes may bypass rules if they have root access
---
## 🚀 Quick Start Guide
### 1. **Pre-Installation**
```bash
# Verify root access
su -c "id"
# Should return: uid=0(root) gid=0(root)
```
### 2. **Installation**
- Install AFWall+ from your preferred source
- Grant root permission when prompted
- Enable firewall in main screen
### 3. **Basic Configuration**
1.**Enable the firewall** - Toggle the main switch
2.**Configure apps** - Tap apps to allow WiFi (green) or mobile data (orange)
3.**Apply rules** - Tap the apply button (firewall icon)
4.**Test connectivity** - Verify apps work as expected
### 4. **Essential Settings**
- **Boot startup delay**: Prevents rule conflicts during boot
- **Notification settings**: Control alert behavior
- **Log settings**: Enable if you want connection monitoring
---
## 🔧 Advanced Configuration
### 📝 **Custom Rules**
AFWall+ supports custom iptables rules for advanced users:
```bash
# Example: Allow specific IP range
-A afwall-wifi -d 192.168.1.0/24 -j ACCEPT
# Example: Block specific port
-A afwall -p tcp --dport 443 -j REJECT
```
### 🔄 **Profiles**
Create different rule sets for different scenarios:
- **Home**: Relaxed rules for trusted network
- **Work**: Restrictive rules for corporate network
- **Public**: Maximum security for public WiFi
- **Travel**: Balanced rules for mobile use
### 📊 **Logging Configuration**
- **Packet logging**: Uses nflog for detailed connection tracking
- **Log rotation**: Automatic cleanup of old logs
- **Export options**: Save logs for external analysis
---
## 🌍 Language Support
AFWall+ is available in **40+ languages** thanks to our community translators:
🇺🇸 English • 🇪🇸 Español • 🇫🇷 Français • 🇩🇪 Deutsch • 🇮🇹 Italiano • 🇷🇺 Русский • 🇨🇳 中文 • 🇯🇵 日本語 • 🇰🇷 한국어 • 🇵🇹 Português • 🇳🇱 Nederlands • 🇵🇱 Polski • 🇹🇷 Türkçe • 🇸🇦 العربية • 🇮🇳 हिंदी • And many more!
**Want to help translate?** Join our [Crowdin translation project](http://crowdin.net/project/afwall).
---
## 🛠️ Development
### 🏗️ **Building from Source**
#### **Prerequisites**
- Android SDK (API level 21+)
- Java 17+
- Git
- Android NDK (for native binaries)
#### **Quick Build**
```bash
git clone https://github.com/ukanth/afwall.git
cd afwall
./gradlew clean assembleDebug
```
#### **Native Binaries**
To compile iptables, busybox, and other native components:
```bash
# Requires Android NDK
export NDK=/opt/android-ndk-r25
make -C external NDK=$NDK
```
### 📁 **Project Structure**
```
afwall/
├── app/src/main/java/dev/ukanth/ufirewall/
│ ├── Api.java # Core iptables interface
│ ├── MainActivity.java # Main UI
│ ├── InterfaceTracker.java # Network state monitoring