Ubuntu Server 網路設定檔 /etc/network/interfaces

來源:互聯網
上載者:User

標籤:

對所有網卡的配置,基本上都在/etc/network/interfaces這個檔案中。如果你的通過DHCP來擷取IP地址的,預設的interfaces檔案看起來應該像這樣:

其中,裝置lo是TCP/IP定義的loopback虛擬網路裝置,使得TCP/IP能夠以127.0.0.1這個IP地址(主機名稱一般為localhost)來訪問自身。eth0是第一塊網卡,如果你有多塊網卡,將依次是eth1、eth2等。

上述配置中的auto關鍵字,使得網路裝置在系統啟動時會自動啟動;iface是interface的縮寫,意為“介面”裝置。而dhcp的意思就是說,該網路裝置要通過DHCP來擷取IP配置資訊。如果要手工指定IP地址等資訊,則要把dhcp關鍵字改為static:

auto eth0iface eth0 inet static   address 192.168.1.10   netmask 255.255.255.0   gateway 192.168.1.1

其中,address關鍵字指定IP地址,netmask指定子網路遮罩,gateway指定網關。

檔案配置好後,需要重新啟動網路以使其生效:

$ sudo /etc/init.d/networking restart

如果你要單獨控制某塊網卡,則可以用ifdown/ifup命令:

$sudo ifdown eth0$sudo ifup eth0

Ubuntu Server 網路設定檔 /etc/network/interfaces

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.