zoukankan      html  css  js  c++  java
  • linux配置网络,关闭防火墙命令操作

    Linux配置网络:

    配置修改
    1:先找到设备配置文件,对于以太网第一个设备,配置文件一般命名为ifcfg-eth0,如下所示:/etc/sysconfig/network-scripts/ifcfg-eth0

    [root@DB-Server network-scripts]# more ifcfg-eth0
    DEVICE=eth0            --物理设置名,eth0是第一个网卡、如果有双网卡或更多,依次为eth1、eth*
    IPADDR=172.20.32.93        --IP地址配置
    NETMASK=255.255.248.0       --子网掩码配置
    [NETWORK=***.***.***.**]     --网络地址:可选项
    [BROADCAST=***.***.***.***]   --广播地址:可选项
    GATEWAY=172.20.39.251      --网关配置
    DNS1=172.20.0.11         --DNS服务配置
    ONBOOT=yes             --引导时是否激活设备
    HWADDR=50:e5:49:df:b0:8b     --物理地址
    BOOTPROTO=none            --[none|static|bootp|dhcp](引导时不使用协议|静态分配|BOOTP协议|DHCP协议)
    TYPE=Ethernet           --网络类型
    IPV6INIT=no           --IPV6
    USERCTL=no            --非root用户是否可以控制该设备

    2: 修改网关配置:网关配置也可以在/etc/sysconfig/network-scripts/ifcfg-eth0中配置

    [root@DB-Server sysconfig]# more /etc/sysconfig/network
    NETWORKING=yes
    HOSTNAME=DB-Server
    GATEWAY=172.20.39.251

    3: 修改DNS配置:DNS配置也可以在/etc/sysconfig/network-scripts/ifcfg-eth0中配置

    [root@DB-Server sysconfig]# more /etc/resolv.conf
    nameserver 172.20.0.11

    4:重新启动网络配置

    4.1
    [root@DB-Server ~]# service network restart #重新启动网络
    Shutting down interface eth0: [ OK ]
    Shutting down loopback interface: [ OK ]
    Bringing up loopback interface: [ OK ]
    Bringing up interface eth0: [ OK ]

    4.2
    [root@DB-Server ~]#ifdown eth0 #关闭eth0网卡

    [root@DB-Server ~]#ifup eth0 #启动eth0网卡

    Determining IP information for eth0....done

    4.3 方法3:使用ifconfig停启服务

    [root@DB-Server ~]#ifconfig eth0 down

    [root@DB-Server ~]#ifconfig eth0 up

     
     
     
    下面是red hat/CentOs7关闭防火墙的命令!
    1:查看防火状态
    systemctl status firewalld
    service  iptables status
    2:暂时关闭防火墙
    systemctl stop firewalld
    service  iptables stop
    3:永久关闭防火墙
    systemctl disable firewalld
    chkconfig iptables off
    4:重启防火墙
    systemctl enable firewalld
    service iptables restart 
    5:永久关闭后重启
    //暂时还没有试过
    chkconfig iptables on

    原文链接:
    https://blog.csdn.net/qq_35971258/article/details/79318842
    https://www.cnblogs.com/kerrycode/archive/2012/12/17/2821836.html
  • 相关阅读:
    关于项目架构设计的一些规范
    Repository 返回 IQueryable?还是 IEnumerable?
    EntityFramework DbContext 线程安全
    ASP.NET 页面禁止被 iframe 框架引用
    2015-写给明年现在的自己
    RESTful API URI 设计: 查询(Query)和标识(Identify)
    深入探讨:标签(Tag)的各种设计方案
    RESTful API URI 设计: 判断资源是否存在?
    iPhone 6/plus iOS Safari fieldset border 边框消失
    追根溯源:EntityFramework 实体的状态变化
  • 原文地址:https://www.cnblogs.com/Xiaomoml/p/12368866.html
Copyright © 2011-2022 走看看