更新于 

Linux常用指令备忘

防火墙iptables&firewall
#firewall

firewall-cmd –permanent –add-rich-rule="rule family="ipv4" source address="172.16.110.55/24" accept"
firewall-cmd –reload

#iptables
iptables -I INPUT -s 192.168.1.0/24 -p tcp -j ACCEPT
service iptables save

#firewall
firewall-cmd --add-port=443/tcp --permanent
firewall-cmd --reload

#iptables
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
service iptables save


#firewall
firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address="111.225.0.0/16" drop'
firewall-cmd --permanent --remove-port=3389/tcp
firewall-cmd --reload

#iptables
#--line-number参数会显示策略编号,该编号在删除策略时使用
iptables -L -n --line-number
#2是--line-number查到的,此句会删除第2条策略
iptables -D INPUT 2
service iptables save

CentOS设置路由
#添加临时路由

route add -net 172.31.255.0/24 gw 172.31.255.250

#添加永久路由
[root@agent ~]# cat /etc/sysconfig/static-routes
any net 172.31.255.0/24 gw 172.31.255.250

route del  -net 172.31.255.0/24 gw 172.31.255.250

git

git命令速查表