2018年10月

为debian 9 的 FAI dd 包手动设置网卡IP地址

drserver.net的独立服务器是需设置静态IP地址,不能自动从dhcp里获取到IP地址。多数dd包是自动获取IP的,如FAI生成的debian9也是。

过程:

1.在急救模式里,dd好debian9的镜像

2.mount /dev/sda1 /mnt/custom/ # 先不急着退出急救模式,挂载debian9的文件系统

3.rm -rf /mnt/custom/etc/network/interfaces # 删除原有的网络配置文件

4.重新生成包含静态IP的网络配置文件,

echo "auto lo eth0" >> /mnt/custom/etc/network/interfaces
echo "iface lo inet loopback" >> /mnt/custom/etc/network/interfaces
echo "iface eth0 inet static" >> /mnt/custom/etc/network/interfaces
echo " address 144.172.126.32" >> /mnt/custom/etc/network/interfaces
echo " netmask 255.255.255.0" >> /mnt/custom/etc/network/interfaces
echo " gateway 144.172.126.1" >> /mnt/custom/etc/network/interfaces

echo "nameserver 8.8.8.8" >> /mnt/custom/etc/resolv.conf 

static-ip-1.png
5.退出急救模式,重启机子

6.用设置的静态IP,成功登录到debian9系统
static-ip-2.png

参考:https://github.com/cobbler/cobbler/issues/1640