1、以DHCP方式配置网卡
编辑文件/etc/network/interfaces,用下面的行来替换有关eth0的行:
auto eth0
iface eth0 inet dhcp用如下命令使网络设置生效:
sudo /etc/init.d/networking restart也可以在命令行下直接输入下面的命令来获取地址
sudo dhclient eth0 22. 为网卡配置静态IP地址
编辑文件/etc/network/interfaces,保持有关lo的内容不变,即以下两行:
auto lo
iface lo inet loopback使用下面的行来替换有关eth0的行:
auto eth0
iface eth0 inet static
address 192.168.0.250
gateway 192.168.0.1
netmask 255.255.255.0将上面的ip地址等信息换成你自己的即可,然后使用用下面的命令使网络设置生效:
sudo /etc/init.d/networking restart如果没有eth0网卡,使用有效的网卡名称替换eth0即可