diff --git a/Install/common/bird4-bgp.conf b/Install/common/bird-bgp.conf similarity index 63% rename from Install/common/bird4-bgp.conf rename to Install/common/bird-bgp.conf index 84aa8fd..fcadecf 100644 --- a/Install/common/bird4-bgp.conf +++ b/Install/common/bird-bgp.conf @@ -1,10 +1,12 @@ protocol bgp antifilter { - table route_vpn1; - import all; - export none; local as 64999; neighbor BPGIPINPUT as BGPASINPUT; multihop; hold time 240; + ipv4 { + table route_vpn1; + import all; + export none; + }; } \ No newline at end of file diff --git a/Install/common/func.sh b/Install/common/func.sh index 4ea06e0..717c6e0 100644 --- a/Install/common/func.sh +++ b/Install/common/func.sh @@ -6,7 +6,7 @@ ROUTE_FORCE_VPN1=$SYSTEM_FOLDER/etc/bird4-force-vpn1.list ROUTE_FORCE_VPN2=$SYSTEM_FOLDER/etc/bird4-force-vpn2.list ROUTE_BASE_VPN=$SYSTEM_FOLDER/etc/bird4-base-vpn.list ROUTE_USER_VPN=$SYSTEM_FOLDER/etc/bird4-user-vpn.list -BIRD_CONF=$SYSTEM_FOLDER/etc/bird4.conf +BIRD_CONF=$SYSTEM_FOLDER/etc/bird.conf VPNTXT=$HOMEPATH/lists/user-vpn.list VPN1TXT=$HOMEPATH/lists/user-vpn1.list VPN2TXT=$HOMEPATH/lists/user-vpn2.list @@ -111,10 +111,10 @@ ipr_func() { #RESTART BIRD FUNCTION restart_bird_func() { if [[ "$DEBUG" == 1 ]]; then echo -e "\n########### $(date) STEP_5: restart bird ###########\n" >&2; fi - if [ "$(cat $MD5_SUM)" != "$(md5sum $SYSTEM_FOLDER/etc/bird4*)" ]; then - md5sum $SYSTEM_FOLDER/etc/bird4* > $MD5_SUM + if [ "$(cat $MD5_SUM)" != "$(md5sum $SYSTEM_FOLDER/etc/bird*)" ]; then + md5sum $SYSTEM_FOLDER/etc/bird* > $MD5_SUM echo "Restarting bird" - killall -s SIGHUP bird4 + killall -s SIGHUP bird fi } diff --git a/Install/double_vpn/bird4.conf b/Install/double_vpn/bird.conf similarity index 71% rename from Install/double_vpn/bird4.conf rename to Install/double_vpn/bird.conf index e381af1..18b5af5 100644 --- a/Install/double_vpn/bird4.conf +++ b/Install/double_vpn/bird.conf @@ -3,17 +3,19 @@ log stderr all; router id IDINPUT; -table route_force; -table route_vpn1; -table route_vpn2; +ipv4 table route_force; +ipv4 table route_vpn1; +ipv4 table route_vpn2; protocol direct { interface "VPN1INPUT", "VPN2INPUT"; } protocol device { scan time 15; } + template kernel KERNEL_BASE { learn; scan time 60; - import none; + ipv4 { import none; }; } + filter pref_50_force { preference = 50; accept; @@ -30,29 +32,35 @@ filter pref_150_vpn2 { } protocol kernel kernel_force from KERNEL_BASE { - export filter pref_50_force; - table route_force; kernel table 1000; + ipv4 { + table route_force; + export filter pref_50_force; + }; } protocol kernel kernel_vpn1 from KERNEL_BASE { - export filter pref_100_vpn1; - table route_vpn1; kernel table 1001; + ipv4 { + export filter pref_100_vpn1; + table route_vpn1; + }; } protocol kernel kernel_vpn2 from KERNEL_BASE { - export filter pref_150_vpn2; - table route_vpn2; kernel table 1002; + ipv4 { + export filter pref_150_vpn2; + table route_vpn2; + }; } protocol static static_force { - table route_force; + ipv4 { table route_force; }; include "bird4-force-isp.list"; include "bird4-force-vpn1.list"; include "bird4-force-vpn2.list"; } -protocol static static_vpn { - table route_vpn1; +protocol static static_vpn1 { + ipv4 { table route_vpn1; }; include "bird4-base-vpn.list"; include "bird4-user-vpn.list"; } diff --git a/Install/install_func.sh b/Install/install_func.sh index 09bfed2..f567a1e 100644 --- a/Install/install_func.sh +++ b/Install/install_func.sh @@ -3,7 +3,7 @@ install_packages_func(){ $SYSTEM_FOLDER/bin/opkg update $SYSTEM_FOLDER/bin/opkg upgrade busybox # Installing packages - $SYSTEM_FOLDER/bin/opkg install bird1-ipv4 curl cron bind-dig bind-libs iprange whois diffutils patch + $SYSTEM_FOLDER/bin/opkg install bird2 bird2c curl cron bind-dig bind-libs iprange whois diffutils patch } # Create start folders @@ -14,10 +14,20 @@ create_folder_func(){ # Stop service if exist stop_func(){ + # Stop and remove old bird if exist if [ -f "$SYSTEM_FOLDER/etc/init.d/S04bird1-ipv4" ]; then echo "Stop bird" $SYSTEM_FOLDER/etc/init.d/S04bird1-ipv4 stop + $SYSTEM_FOLDER/bin/opkg --force-removal-of-dependent-packages remove bird1-ipv4 + rm $SYSTEM_FOLDER/etc/bird4.conf + install_packages_func fi + # Stop bird2 + if [ -f "$SYSTEM_FOLDER/etc/init.d/S70bird" ]; then + echo "Stop bird2" + $SYSTEM_FOLDER/etc/init.d/S70bird stop + fi + # Stop table service if [ -f "$SYSTEM_FOLDER/etc/init.d/S02bird-table" ]; then echo "Stop bird-table" $SYSTEM_FOLDER/etc/init.d/S02bird-table stop @@ -78,10 +88,10 @@ fill_folder_and_sed_func(){ # Copying the bird configuration file copy_bird_config_func(){ - if [ ! -f "$SYSTEM_FOLDER/etc/bird4.conf-opkg" ]; then - mv $SYSTEM_FOLDER/etc/bird4.conf $SYSTEM_FOLDER/etc/bird4.conf-opkg; + if [ ! -f "$SYSTEM_FOLDER/etc/bird.conf-opkg" ]; then + mv $SYSTEM_FOLDER/etc/bird.conf $SYSTEM_FOLDER/etc/bird.conf-opkg; fi - cp $HOME_FOLDER/Install/$CONFFOLDER/bird4.conf $SYSTEM_FOLDER/etc/bird4.conf + cp $HOME_FOLDER/Install/$CONFFOLDER/bird.conf $SYSTEM_FOLDER/etc/bird.conf } # Select mode @@ -125,7 +135,7 @@ configure_file_mode_func(){ # BGP mode configure_bgp_mode_func(){ configure_file_mode_func - cat $HOME_FOLDER/Install/common/bird4-bgp.conf >> $SYSTEM_FOLDER/etc/bird4.conf + cat $HOME_FOLDER/Install/common/bird-bgp.conf >> $SYSTEM_FOLDER/etc/bird.conf if [ "$1" != "-u" ] && [ -z "$BGP_IP" ] && [ -z "$BGP_AS" ]; then echo -e "Which BGP service do you want to use\n 1 - antifilter.download 45.154.73.71 (default) \n 2 - antifilter.network 51.75.66.20 \n 3 - antifilter.network with vpn 10.75.66.20 ( you need install vpn first https://antifilter.network/vpn )" read BGP @@ -138,7 +148,7 @@ configure_bgp_mode_func(){ fi fi echo -e "You are select BGP $BGP_IP AS$BGP_AS" - sed -i 's/BPGIPINPUT/'$BGP_IP'/; s/BGPASINPUT/'$BGP_AS'/' $SYSTEM_FOLDER/etc/bird4.conf + sed -i 's/BPGIPINPUT/'$BGP_IP'/; s/BGPASINPUT/'$BGP_AS'/' $SYSTEM_FOLDER/etc/bird.conf sed -i 's/BPGIPINPUT/'$BGP_IP'/; s/BGPASINPUT/'$BGP_AS'/' $SCRIPTS/*.sh } @@ -162,7 +172,7 @@ config_isp_func(){ ISP_IP="123.123.123.123"; fi sed -i 's/ISPINPUT/'$ISP'/' $SCRIPTS/*.sh - sed -i 's/IDINPUT/'$ISP_IP'/' $SYSTEM_FOLDER/etc/bird4.conf + sed -i 's/IDINPUT/'$ISP_IP'/' $SYSTEM_FOLDER/etc/bird.conf } # Config VPN1 @@ -173,7 +183,7 @@ config_vpn1_func(){ fi echo "Your are select VPN1 $VPN1" sed -i 's/VPN1INPUT/'$VPN1'/' $SCRIPTS/*.sh - sed -i 's/VPN1INPUT/'$VPN1'/' $SYSTEM_FOLDER/etc/bird4.conf + sed -i 's/VPN1INPUT/'$VPN1'/' $SYSTEM_FOLDER/etc/bird.conf } # Config VPN2 @@ -184,7 +194,7 @@ config_vpn2_func(){ fi echo "Your are select VPN2 $VPN2" sed -i 's/VPN2INPUT/'$VPN2'/' $SCRIPTS/*.sh - sed -i 's/VPN2INPUT/'$VPN2'/' $SYSTEM_FOLDER/etc/bird4.conf + sed -i 's/VPN2INPUT/'$VPN2'/' $SYSTEM_FOLDER/etc/bird.conf } # Organizing scripts into folders @@ -206,6 +216,6 @@ run_func(){ $SYSTEM_FOLDER/etc/init.d/S02bird-table restart $SCRIPTS/add-bird4_routes.sh -i $SYSTEM_FOLDER/etc/init.d/S10cron restart - $SYSTEM_FOLDER/etc/init.d/S04bird1-ipv4 restart + $SYSTEM_FOLDER/etc/init.d/S70bird restart $SCRIPTS/add-bird4_routes.sh } \ No newline at end of file diff --git a/Install/one_vpn/bird4.conf b/Install/one_vpn/bird.conf similarity index 62% rename from Install/one_vpn/bird4.conf rename to Install/one_vpn/bird.conf index b109aa9..a556ed8 100644 --- a/Install/one_vpn/bird4.conf +++ b/Install/one_vpn/bird.conf @@ -3,16 +3,18 @@ log stderr all; router id IDINPUT; -table route_force; -table route_vpn1; +ipv4 table route_force; +ipv4 table route_vpn1; protocol direct { interface "VPN1INPUT"; } protocol device { scan time 15; } + template kernel KERNEL_BASE { learn; scan time 60; - import none; + ipv4 { import none; }; } + filter pref_50_force { preference = 50; accept; @@ -24,22 +26,26 @@ filter pref_100_vpn1 { } protocol kernel kernel_force from KERNEL_BASE { - export filter pref_50_force; - table route_force; kernel table 1000; + ipv4 { + table route_force; + export filter pref_50_force; + }; } -protocol kernel kernel_vpn from KERNEL_BASE { - export filter pref_100_vpn1; - table route_vpn1; +protocol kernel kernel_vpn1 from KERNEL_BASE { kernel table 1001; + ipv4 { + table route_vpn1; + export filter pref_100_vpn1; + }; } protocol static static_force { - table route_force; + ipv4 { table route_force; }; include "bird4-force-isp.list"; include "bird4-force-vpn1.list"; } -protocol static static_vpn { - table route_vpn1; +protocol static static_vpn1 { + ipv4 { table route_vpn1; }; include "bird4-base-vpn.list"; } diff --git a/README.md b/README.md index ddc2295..ce3d06e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Bird4Static -Здесь выложены файлы для работы bird4 с сервисами antifilter.download или antifilter.network +Здесь выложены файлы для работы bird с сервисами antifilter.download или antifilter.network Есть 3 режима работы - скачивание файла с нужного сервиса, установка бгп соединения с одним из сервисов, и работа только с пользовательскими файлами diff --git a/install.sh b/install.sh index 2e55c30..b55f591 100644 --- a/install.sh +++ b/install.sh @@ -1,6 +1,6 @@ #!/bin/sh -VERSION="v3.7.1" +VERSION="v3.8.0" while true; do echo -e "\nBegin install? y/n" diff --git a/uninstall.sh b/uninstall.sh index 16eaf1d..7f609dc 100644 --- a/uninstall.sh +++ b/uninstall.sh @@ -17,11 +17,16 @@ while true; do # Stop Services $SYSTEM_FOLDER/etc/init.d/S02bird-table stop -$SYSTEM_FOLDER/etc/init.d/S04bird1-ipv4 stop +if [ -f "$SYSTEM_FOLDER/etc/init.d/S04bird1-ipv4" ]; then + $SYSTEM_FOLDER/etc/init.d/S04bird1-ipv4 stop + $SYSTEM_FOLDER/bin/opkg --force-removal-of-dependent-packages remove bird1-ipv4 +fi +if [ -f "$SYSTEM_FOLDER/etc/init.d/S70bird" ]; then + $SYSTEM_FOLDER/etc/init.d/S70bird stop + $SYSTEM_FOLDER/bin/opkg --force-removal-of-dependent-packages remove bird2 +fi # Remove packages -# bird -$SYSTEM_FOLDER/bin/opkg remove bird1-ipv4 # curl answer=0; echo "Do you want remove 'curl'? 0 - no 1 - yes (default: no)"; read answer if [ "$answer" = "1" ]; then $SYSTEM_FOLDER/bin/opkg remove curl; fi