Ubuntu IP的網絡配置檔案是:/etc/network/interfaces
1.配置dhcp擷取IP, eth0為網卡接口
auto eth0
iface eth0 inet dhcp
2.配置靜态ip位址
auto eth0
iface eth0 inet static
address 192.168.1.103
gateway 192.168.1.1
netmask 255.255.255.0
完成後輸入
sudo /etc/init.d/networking restart
重新開機網卡,OK