Skip to content

This repository provides a comprehensive set of rules for routing Iranian IP traffic in OpenWRT using the luci-app-pbr package. It helps to differentiate traffic based on geographic location, allowing users to route Iranian traffic through specific pathways like a VPN for improved privacy and security.

Notifications You must be signed in to change notification settings

WhoisGray/openwrt-pbr-iran-rules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

openwrt-pbr-iran-rules ๐Ÿ‡ฎ๐Ÿ‡ท

This repository provides a comprehensive set of rules to route Iranian IP traffic on OpenWRT using luci-app-pbr. These rules enable you to segregate domestic traffic (from Iran) from VPN or other routes, offering more precise control over your internet traffic.

๐Ÿš€ Installation Guide

1. Install Required Packages:

  • On your OpenWRT router, install the following packages:
    • luci-app-pbr
    • pbr

2. Download the Custom Script:

  • SSH into your router and download the appropriate script to the path /usr/share/pbr/:

  • Online Version: If you want to fetch the list of Iranian IPs dynamically from an online source, run the following command:

    wget -P /usr/share/pbr/ https://raw.githubusercontent.com/WhoisGray/openwrt-pbr-iran-rules/main/pbr.user.iran.sh
  • Offline Version: If you prefer using an offline version, which includes predefined Iranian IP ranges, use the following command instead:

    wget -P /usr/share/pbr/ https://raw.githubusercontent.com/WhoisGray/openwrt-pbr-iran-rules/main/pbr.user.iran.offline.sh
  • Important: If you encounter the error Change output directory: No such file or directory, create the necessary directory:

    mkdir -p /usr/share/pbr/

3. Configure Policy Routing:

  • Access your routerโ€™s Web Admin (LuCI) interface.
  • Navigate to Services > Policy Routing.
  • Add a new Custom User File and specify the following path:
    /usr/share/pbr/pbr.user.iran.sh
    
  • If you used the offline version, the path would be /usr/share/pbr/pbr.user.iran.offline.sh.
  • Enable the rule and click Done to save the configuration.

4. Save and Reboot:

  • After adding and enabling the custom script, save the changes and reboot your router for the configuration to take effect.

โš™๏ธ Configuration

This script fetches a list of Iranian IP addresses and creates policy routing rules to handle the segregation of domestic traffic. The list of IPs is dynamically retrieved from a reliable source and regularly updated to ensure accuracy.

๐ŸŒ Iranian IP Source

The Iranian IP list is sourced from MrAriaNet/Get-IP-Iran.

๐ŸŒ Offline Version

If you prefer to use an offline version or if the online repository becomes unavailable, you can download the offline script, which includes the IP ranges directly within the script itself.


๐Ÿ”ง Troubleshooting

If you experience issues or have suggestions for improvements, feel free to open an issue or submit a pull request on the GitHub repository.

๐Ÿ“œ License

This project is licensed under the MIT License.

About

This repository provides a comprehensive set of rules for routing Iranian IP traffic in OpenWRT using the luci-app-pbr package. It helps to differentiate traffic based on geographic location, allowing users to route Iranian traffic through specific pathways like a VPN for improved privacy and security.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages