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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM