iptables block access to port 8000 except from IP address

后端 未结 3 1608
被撕碎了的回忆
被撕碎了的回忆 2020-12-07 09:14

I\'ve never used iptables, and the documentation online seems a bit opaque.

I\'d like to block all requests to port 8000 on my server except those coming from a spec

3条回答
  •  無奈伤痛
    2020-12-07 09:33

    You can always use iptables to delete the rules. If you have a lot of rules, just output them using the following command.

    iptables-save > myfile
    

    vi to edit them from the commend line. Just use the "dd" to delete the lines you no longer want.

    iptables-restore < myfile and you're good to go.  
    

    REMEMBER THAT IF YOU DON'T CONFIGURE YOUR OS TO SAVE THE RULES TO A FILE AND THEN LOAD THE FILE DURING THE BOOT THAT YOUR RULES WILL BE LOST.

提交回复
热议问题