The following warnings occurred:
Warning [2] "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? - Line: 613 - File: inc/plugins/myadvertisements.php PHP 7.3.33 (Linux)
File Line Function
/inc/class_plugins.php 38 errorHandler->error
/inc/class_plugins.php 38 require_once
/inc/init.php 239 pluginSystem->load
/global.php 20 require_once
/showthread.php 28 require_once
Warning [2] "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? - Line: 654 - File: inc/plugins/myadvertisements.php PHP 7.3.33 (Linux)
File Line Function
/inc/class_plugins.php 38 errorHandler->error
/inc/class_plugins.php 38 require_once
/inc/init.php 239 pluginSystem->load
/global.php 20 require_once
/showthread.php 28 require_once
Warning [2] "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? - Line: 701 - File: inc/plugins/myadvertisements.php PHP 7.3.33 (Linux)
File Line Function
/inc/class_plugins.php 38 errorHandler->error
/inc/class_plugins.php 38 require_once
/inc/init.php 239 pluginSystem->load
/global.php 20 require_once
/showthread.php 28 require_once
Warning [2] "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? - Line: 749 - File: inc/plugins/myadvertisements.php PHP 7.3.33 (Linux)
File Line Function
/inc/class_plugins.php 38 errorHandler->error
/inc/class_plugins.php 38 require_once
/inc/init.php 239 pluginSystem->load
/global.php 20 require_once
/showthread.php 28 require_once
Warning [2] "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? - Line: 801 - File: inc/plugins/myadvertisements.php PHP 7.3.33 (Linux)
File Line Function
/inc/class_plugins.php 38 errorHandler->error
/inc/class_plugins.php 38 require_once
/inc/init.php 239 pluginSystem->load
/global.php 20 require_once
/showthread.php 28 require_once




Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to block Ip ranges in Linux server
#1
Hi, 

Can any one let me know the exact command if I want to block the range 192.168.x.x ?
Reply
#2
If you have CSF firewall Installed , then you can simply use the below format

Note : Please replace the ip and ip ranges with the needed ones

To block 192.xxx.xxx.xxx range, use following rule

# csf -d 192.0.0.0/8

To block 192.168.xxx.xxx range, use following rule

# csf -d 192.168.0.0/16

To block 192.168.1.xxx range, use following rule

# csf -d 192.168.1.0/24

If you have no extra firewall softwares installed, then you can block using the below iptables command


To block one single ip in iptables, use the below command

# iptables -I INPUT -s 192.168.1.1 -j DROP

To block 192.xxx.xxx.xxx range, use following rule

# iptables -I INPUT -s 192.0.0.0/8 -j DROP

To block 192.168.xxx.xxx range, use following rule

# iptables -I INPUT -s 192.168.0.0/16 -j DROP

To block 192.168.1.xxx range, use following rule

# iptables -I INPUT -s 192.168.1.0/24 -j DROP

To remove the ip blocks , you can use the below
    
# iptables -D INPUT -s 192.168.1.1 -j DROP

# iptables -D INPUT -s 192.168.1.0/24 -j DROP
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)