天天看點

linux 配置網絡

ubuntu 下配置 網路

DHCP 配制方法

在終端中輸入:

sudo vi  /etc/network/interfaces

打開interfaces檔案後按“i”

然後在檔案末尾追加

auto eth0

iface eth0 inet dhcp

auto eth1

ifacce eth1 inet dhcp

靜态IP位址的配制方法

iface eth0 inet static

        address 192.168.1.1

        netmask 255.255.255.0

        network 192.168.1.0

        broadcast 192.168.1.255

       gateway 192.168.1.1

iface eth01 inet static

        address 192.168.1.2

或者

ifconfig eth0 192.168.1.1 netmask 255.255.255.0 up

ifconfig eth1 192.168.1.2 netmask 255.255.255.0 up

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/etc/resolv.conf

該檔案是DNS域名解析的配置檔案,它的格式很簡單,每行以一個關鍵字開頭,後接配置參數。resolv.conf的關鍵字主要有四個,分别是:

/etc/resolv.conf的一個示例:

最主要是nameserver關鍵字,如果沒指定nameserver就找不到DNS伺服器,其它關鍵字是可選的。

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

進入etc/init.d/networking restart或restart

 //重新運作網路//

繼續閱讀