iptables -t nat -A POSTROUTING -s 172.16.10.0/24 -o eth0 -j MASQUERADE 

规则备份与恢复:
service iptables save 这样会保存到/etc/sysconfig/iptables 
iptables-save > myipt.rule 可以把防火墙规则保存到指定文件中
iptables-restore < myipt.rule  这样可以恢复指定的规则

4. Linux系统任务计划
/etc/crontab  cron的主配置文件,可以定义PATH
cron格式如下:
# .----------------分钟 (0 - 59)
# |  .------------- 小时 (0 - 23)
# |  |  .----------  日 (1 - 31)
# |  |  |  .-------  月 (1 - 12)
# |  |  |  |  .----   周 (0 - 6) (周日=0 or 7) 
# |  |  |  |  |
# * *  * *  * user-name command to be executed
cron 也是一个服务,所以需要先启动服务才能生效:service crond start; service crond status 

任务计划练习题:
每天凌晨1点20分清除/var/log/slow.log这个文件
每周日3点执行 “/bin/sh /usr/local/sbin/backup.sh”
每月14号4点10分执行 “/bin/sh /usr/local/sbin/backup_month.sh”
每隔8小时执行 “ntpdate time.windows.com”
每天的1点,12点,18点执行 “/bin/sh /usr/local/sbin/test.sh”
每天的9点到18点执行 “/bin/sh /usr/local/sbin/test2.sh”  

相关文章:

  • 2022-12-23
  • 2021-12-08
  • 2021-11-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-25
  • 2021-05-15
  • 2021-06-24
相关资源
相似解决方案