Iptables

iptables 操作

  1. 相应的配置文件在:/etc/sysconfig/iptables
  2. 可通过如下命令查看 iptables配置

    -t filter -L```
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30

    ````
    [root@dell sysconfig]# iptables -t filter -L
    Chain INPUT (policy ACCEPT)
    target prot opt source destination
    RH-Firewall-1-INPUT all -- anywhere anywhere

    Chain FORWARD (policy ACCEPT)
    target prot opt source destination
    RH-Firewall-1-INPUT all -- anywhere anywhere

    Chain OUTPUT (policy ACCEPT)
    target prot opt source destination

    Chain RH-Firewall-1-INPUT (2 references)
    target prot opt source destination
    ACCEPT all -- anywhere anywhere
    ACCEPT icmp -- anywhere anywhere icmp any
    ACCEPT ipv6-crypt-- anywhere anywhere
    ACCEPT ipv6-auth-- anywhere anywhere
    ACCEPT udp -- anywhere 224.0.0.251 udp dpt:5353
    ACCEPT udp -- anywhere anywhere udp dpt:ipp
    ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
    ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
    ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:http
    ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ftp
    REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
    ````
    0. 查看虚拟ip
    ```ip -f inet addr
  3. 重启iptables
    /etc/init.d/iptables restart

  4. 当一个server ip 能够ping的通,但是telnet对应的端口连不上,且服务器上本地telnet正常,那么很有可能是
    iptable限制端口的访问

坚持原创技术分享,您的支持奖鼓励我继续创作!