• centos7 jexus在vmware下能访问,主机访问不了解决方案


    能PING通,访问不了web,先在CMD测试telnet ip 80看看是否是防火墙的问题.

     修改防火墙,打开指定端口

    1 安装iptables

    [root@centos ~]# yum install iptables-services

    设置防火墙规则 (增加80端口)

    [root@centos ~]# vim /etc/sysconfig/iptables

    打开文件,增加80端口那一行

    *filter
    :INPUT ACCEPT [0:0]
    :FORWARD ACCEPT [0:0]
    :OUTPUT ACCEPT [0:0]
    -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
    -A INPUT -p icmp -j ACCEPT
    -A INPUT -i lo -j ACCEPT
    -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
    -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
    -A INPUT -j REJECT --reject-with icmp-host-prohibited
    -A FORWARD -j REJECT --reject-with icmp-host-prohibited
    COMMIT

    :wq #保存退出

    2 默认firewall作为防火墙的设置

    #禁止firewall开机启动

    [root@centos ~]# systemctl disable firewalld.service

    #设置防火墙开机启动

    [root@centos ~]# systemctl enable iptables.service 

    #停止firewall 

    [root@centos ~]# systemctl stop firewalld.service 

    #重启防火墙使配置生效

    [root@centos ~]# systemctl restart iptables.service (必须重启)

    3 查看当前系统打开的端口

    [root@centos ~]# netstat -lntp

    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp     0   0   127.0.0.1:25     0.0.0.0:*   LISTEN     2157/master
    tcp     0   0   0.0.0.0:22        0.0.0.0:*   LISTEN     1292/sshd
    tcp6   0   0   ::1:25              :::*           LISTEN     2157/master
    tcp6   0   0   :::22                :::*           LISTEN     1292/sshd

  • 相关阅读:
    gcc 编译
    UltraEdit 添加到右键菜单
    linux 编译错误:undefined reference to `__gxx_personality_v0'
    UltraEdit 取消生成.bak文件
    容器
    Windows CEvent事件
    Windows _beginthreadex 线程类与线程池
    C++ 工厂模式
    Mutex linux线程锁
    windows CRITICAL_SECTION 线程锁
  • 原文地址:https://www.cnblogs.com/fujinliang/p/4218802.html
Copyright © 2020-2023  润新知