zoukankan      html  css  js  c++  java
  • Ubuntu 网络配置

    网络配置

    静态IP

    root@ubuntu:~# 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
    auto ens33
    iface ens33 inet static
        address 10.0.0.50
        netmask 255.255.255.0
        network 10.0.0.0
        broadcast 10.0.0.255
        gateway 10.0.0.2
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 10.0.0.
    

    DHCP动态IP

    以DHCP方式配置网卡

    编辑文件
    vi /etc/network/interfaces
    
    并用下面的行来替换有关eth0的行:
    # The primary network interface - use DHCP to find our address
    auto eth0
    iface eth0 inet dhcp
    

    用下面的命令使网络设置生效

    /etc/init.d/networking restart

    设置主机名称(hostname)

    使用下面的命令来设置当前主机的主机名称:

    vim /bin/hostname
    

    newname系统启动时,它会从/etc/hostname来读取主机的名称.

    配置DNS

    vim /etc/resolv.conf
    
  • 相关阅读:
    CF110A Nearly Lucky Number
    Max Sum Plus Plus HDU – 1024
    洛谷 p1003 铺地毯
    poj-1226
    Where is the Marble? UVA – 10474
    Read N Characters Given Read4
    Guess Number Higher or Lower && 九章二分法模板
    Intersection of Two Arrays II
    Reverse Vowels of a String
    Meeting Rooms
  • 原文地址:https://www.cnblogs.com/syavingcs/p/8729269.html
Copyright © 2011-2022 走看看