答案1
将以下行添加到/etc/network/interfaces
文件中:
使用 DHCP
示例1:
# The loopback network interface
auto lo
iface lo inet loopback
示例2:
# The loopback network interface
auto lo eth0
iface lo inet loopback
# The primary network interface
iface eth0 inet dhcp
将 eth0 替换为您的网络接口卡
使用以下命令重新启动网络服务
sudo /etc/init.d/networking restart
静止的:
# The loopback network interface
auto lo eth0
iface lo inet loopback
# The primary network interface
iface eth0 inet static
address xx.xx.xx.xx
netmask 255.255.255.0
broadcast xx.xx.xx.xy
network xx.xx.xx.xz
gateway yy.yy.yy.yy
dns-nameservers yy.yy.yy.yy
例子:
# The loopback network interface
auto lo eth0
iface lo inet loopback
# The primary network interface
iface eth0 inet static
address 192.168.0.77
gatway 192.168.0.1
netmask 255.255.255.0
broadcast 192.168.0.254
network 192.168.0.0
dns-nameservers 192.168.0.254
重新启动网络服务:
sudo /etc/init.d/networking restart