天天看點

ubuntu 設定靜态IP GW

網卡配置靜态IP位址 

編輯檔案/etc/network/interfaces: 

sudo vi /etc/network/interfaces 

并用下面的行來替換有關eth0的行:# The primary network interface 

auto eth0 

iface eth0 inet static 

address 192.168.3.90 

gateway 192.168.3.1 

netmask 255.255.255.0 

#network 192.168.3.0 

#broadcast 192.168.3.255 

将上面的ip位址等資訊換成你自己就可以了.用下面的指令使網絡設定生效: 

sudo /etc/init.d/networking restart 

DHCP版本

auto eth0

source-directory /etc/network/interfaces.d

iface eth0 inet dhcp