zoukankan      html  css  js  c++  java
  • ubuntu/centos网络配置

    UBUNTU网络配置
    
    配置临时的Ip
    
      ifconfig eth0 192.168.3.136/24
    
    其中24指的网络掩码24位。
    
      vim /etc/network/interfaces 添加下面内容
    
      auto eth0                   #开机自动连接
    
      iface eth0 inet static  #静态IP
    
      address 192.168.1.112
    
      netmask 255.255.255.0
    
      gateway 192.168.1.1
    
    如果是dhcp,添加
    
      auto eth0
    
      iface eth0 inet dhcp
    
    DNS配置:
    
    vim /etc/resolv.conf
    
          nameserver 202.96.128.166
    
      nameserver 202.96.134.133
    
      nameserver 8.8.8.8
    
    在resolv.conf文件中添加一些DNS服务器(例如电信)的IP地址即可。
    
    网络重启:
    
      sudo /etc/init.d/networking restart
    
    关闭网卡:
    
      sudo ifconfig eth0 down
    
    打开网卡
    
      sudo ifconfig eth0 up
    
     
    
    centos网络配置
    
    在networ-scripts目录下,不同的网卡对应不同的配置文件。
    
    sudo vim /etc/sysconfig/network-scripts/ifcfg-eth0
    
      DEVICE=eth0
    
      IPADDR=192.168.3.136
    
      NETMASK=255.255.255.0
    
      GATEWAY=192.168.3.1
    
      HWADDR=00:0C:29:C1:78:F6
    
      ONBOOT=yes      #开机启动
    
      NM_CONTROLLED=yes
    
      BOOTPROTO=static
    
    DNS配置
    
    vim /etc/resolv.conf
    
      nameserver 202.96.128.166
    
      nameserver 202.96.134.133
    
    服务重启:
    
          sudo service network restart
    
    启动
    
      sudo service network start
    
    关闭
    
      sudo service network stop
  • 相关阅读:
    数字三角形
    嵌套矩阵问题
    NKOJ1236 a^b
    历届试题 最大子阵
    【动态规划】最大连续子序列和,最大子矩阵和,最大m子段和
    历届试题 翻硬币
    历届试题 带分数
    用户模板和用户场景
    学习进度——第九周
    最大子数组——回调
  • 原文地址:https://www.cnblogs.com/helloworldtoyou/p/4769201.html
Copyright © 2011-2022 走看看