dns Cheatsheet
最近需要配置一个IP地址,dns很灵活。值得花时间把常用用法掌握学习。firewalld是iptables的一个上层封装。有时候不明白为什么的时候,看看iptables的规则库,就理解了。这里把我常用的iptables命令做个汇总。
封ip
iptables -I INPUT -s 211.1.2.1 -j DROP
对应的解封
iptables -L --line-numbers
iptables -D INPUT 1
端口转发
本机端口转发
iptables -t nat -A OUTPUT -d localhost -p tcp --dport 80 -j REDIRECT --to-ports 8080
注意这样配置,在本机是不能访问80端口的。如果要本机也能访问,要这么配(但下面配法我没实践过。不知可行否。)
iptables -t nat -A OUTPUT -d localhost -p tcp --dport 80 -j REDIRECT --to-ports 8080