1 DHCP模式
更改配置文件 /etc/network/interfaces
auto eth0
iface eth0 inet dhcp
2 靜態模式
auto eth0
iface eth0 inet static
address 192.168.1.4
netmask 255.255.255.0
gateway 192.168.1.1
更改配置文件後需要重啓網絡服務,sudo /etc/init.d/networking
如果重啓不成功,可以嘗試 sudo ifconfig eth0 down,sudo ifconfig eth0 up