zoukankan      html  css  js  c++  java
  • Linux基本网络配置

    基于CentOS的Linux基本网络配置,包括网卡eth0、DNS、Host等

    http://www.voidcn.com/article/p-tghbqwno-dz.html

    Debian-Linux配置网卡网络方法

    https://www.cnblogs.com/saryli/p/11807223.html

    Debian不同于centos系统,网卡配置不是在/etc/sysconfig/network-scrip里面,而是在/etc/network/interfaces里面

    vi /etc/sysconfig/network-scripts/ifcfg-eth0

    vi /etc/network/interfaces

    在ubuntu下,还可以指定控制哪个网卡(其中eth0为网卡名):指定网卡重启
    ifdown eth0
    ifup eth0
    在ubuntu下,网络重启 /etc/init.d/networking restart service networking restart

    Linux 下网卡重启的命令为:

    /etc/init.d/network restart 或者是 /etc/init.d/networking restart
    或者重启网络服务:
    service network restart

    systemctl restart network




    #ifdown <interface_name> && ifup <interface_name>

    ifdown eth0 && ifup eth0

    特别是在ssh登录远程主机的情况下,一定要像上面这样在一条命令里执行ifdown和ifup,否则,如果先执行ifdown,则再也没有机会执行ifup了。

    配置为静态IP
    auto eth0 #开机自动启动
    iface eth0 inet static #静态IP设置
    address 192.168.0.10 #本机IP
    netmask 255.255.255.0 #子网掩码
    gateway 192.168.0.1 #网关

    root@debian:~# cat /etc/network/interfaces
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).

    source /etc/network/interfaces.d/*

    # The loopback network interface
    auto lo
    iface lo inet loopback

    # The primary network interface
    allow-hotplug eth0
    iface eth0 inet dhcp
    root@debian:~# cat /etc/resolv.conf
    domain DHCP
    search DHCP HOST
    nameserver 103.85.85.188
    nameserver 114.114.114.114
    root@debian:~#

  • 相关阅读:
    IOS
    XCode
    Android Studio
    Android Studio
    Cordova
    Delphi
    Cordova
    Delphi
    JQuery Mobile
    twitter ads_campaign management(图示)
  • 原文地址:https://www.cnblogs.com/tonggc1668/p/13682331.html
Copyright © 2011-2022 走看看