Debian有两种获取IP方式:DHCP自动获取、静态配置
打开文件
vim /etc/network/interfaces
修改
方法1:DHCP自动获取配置如下
auto eth0 # eth0指的是自己机器上ifconfig 输出对的网卡别名相符
iface eth0 inet dhcp # 表示获取ip方式为dhcp
方法2:配置静态IP
auto eth0 #对应修改的网卡
iface eth0 inet static
address 172.16.20.154
netmask 255.255.255.0
gateway 172.16.20.1
重启网络服务
./etc/init.d/networking restart