码迷,mamicode.com
首页 > 系统相关 > 详细

Linux命令

时间:2019-02-24 10:23:08      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:方式   bsp   nbsp   目标   访问   地址   就是   tab   top   

软链接部分:

  ln -snf /usr/bin/python2.6 /usr/bin/python2  # ln -snf  【新链接地址】 【旧地址链接地址】

  ln -s 【源文件或目录】 【目标文件或目录】

防火墙部分:

  查看防火墙版本:iptables --version

  查看防火墙规则:iptables --list

  查看防火墙状态:/etc/init.d/iptables status

  开启防火墙:service iptables start

  重启防火墙:service iptables restart

  关闭防火墙:
    两种方式:
    1)重启后生效:chkconfig iptables off        ( 对应的开启防火墙命令为: # chkconfig iptables on )
    2)即时生效,但重启后防火墙会再次启动:service iptables stop        ( 对应的开启防火墙命令为: # service iptables start )
  
  要访问某个端口可以用两种方式,一个是关闭防火墙,另一个就是让防火墙开放某个端口。
  开放 port 端口:
    方法一:
        # iptables -I INPUT -i eth0 -p tcp --dport 3306 -j ACCEPT
      # iptables  -I OUTPUT -o eth0 -p tcp --sport 3306 -j ACCEPT
     对应阻止3306端口的命令为:
      # iptables -I INPUT -i eth0 -p tcp --dport 3306 -j DROP
      # iptables -I OUTPUT -o eth0 -p tcp --sport 3306 -j DROP
     然后保存
      # /etc/rc.d/init.d/iptables save
    方法二:
      修改/etc/sysconfig/iptables文件,增加如下一行:
      -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
  然后重启防火墙:service iptables restart
 
待续。。。
 

Linux命令

标签:方式   bsp   nbsp   目标   访问   地址   就是   tab   top   

原文地址:https://www.cnblogs.com/ice-image/p/10423966.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!