华三 服务器 的ipmi的web提供了nfs挂载iso去安装,也是我之前使用的,发现研发给的镜像在4g以上(镜像基于centos7.3改的,我之前测试都是用的minimal镜像890M左右)。安装的时候报错,然后当面测试得出结论nfs的网速原因,其次也是我们这边办公网是百兆。。。

办公网被it接管了,交换机密码不给,自己找了台5130交换机,下面接服务器和我自己电脑搭建测了下定制iso的pxe流程

这是组网情况

10.96.4.1/24

+------------+

| switch |

| |

+-+--------+-+

| |

| |

+------+ +--------+

| |

| |

v v

+----+------+ +------+------+

| h3c server| | my pc |

+-----------+ +-------------+

10.96.4.2

叫同事帮忙配置下交换机的dhcp,我虚机桥接的,虚机ip配置为4.2。起初 ? 看到有 nextserver 还有个 tftp-server 两命令,以为 nextserver 是dhcp中继的命令,而 tftp-server 是指定pxe下载 pxelinux.0 的tftp ip,也就是一开始下面的配置

[H3C-S5130-dhcp-pool-1] bootfile-name pxelinux.0

[H3C-S5130-dhcp-pool-1] next-server 10.96.4.2

pxe的dhcp直接用交换机的,tftp和web我用docker起的,网上的做法基本都不能识别进到菜单界面,最后在 http://blog.chinaunix.net/uid-22621471-id-4980582.html 找到启发,复制EIF/BOOT下文件到tftp的根目录,并且bootfile-name设置为 BOOTX64.EFI 。 http/cvk 下是iso解压的,vmlinuz和initrd是镜像 /EFI/BOOT/ 里复制到tftp根目录的

.

├── docker-compose.yml

├── http

│ └── cvk

| .....

├── nginx-conf.d

│ └── default.conf

└── tftp

├── BOOTX64.EFI

├── fonts

│ ├── TRANS.TBL

│ └── unicode.pf2

├── grub.cfg

├── grubx64.efi

├── HDM-1.11.29_signed.bin //华三的HDM固件,忽略

├── initrd.img

├── MokManager.efi

├── TRANS.TBL

└── vmlinuz

docker-compose.yml

version: '3.4'

services:

nginx:

image: nginx:alpine

hostname: nginx

volumes:

- /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime:ro

- ./http:/usr/share/nginx/html

- ./nginx-conf.d:/etc/nginx/conf.d

network_mode: "host"

logging:

driver: json-file

options:

max-file: '3'

max-size: 100m

tftp:

image: pghalliday/tftp

hostname: tftp

volumes:

- /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime:ro

- ./tftp:/var/tftpboot

command:

["--verbose", "--foreground", "--secure", "/var/tftpboot"]

network_mode: "host"

logging:

driver: json-file

options:

max-file: '3'

max-size: 100m

default.conf

server {

listen 80;

server_name localhost;

location / {

root /usr/share/nginx/html;

index index.html index.htm;

autoindex on;

}

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root /usr/share/nginx/html;

}

}

在交换机的dhcp里设置 bootfile-name BOOTX64.EFI 后pxe进入的菜单是 grub.cfg 的内容,而一般的官方的启动选项为

linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 quiet

initrdefi /images/pxeboot/initrd.img

里面的 inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 是指向带label的hard disk,这里需要修改为url,这里我改为

linuxefi vmlinuz inst.repo=http://10.96.4.2/cvk ks=http://10.96.4.2:81/ks.cfg inst.ks.sendmac inst.ks.sendsn quiet

initrdefi initrd.img

url是从我自己 go 写的一个web,ks会在访问web渲染后返回获取的,详情上一篇,ks文件里得加一行指定安装源

url --url="http://10.96.4.2/cvk"

一般网上的老资料都说在append后加启动选项 ksdevice=eth0 的指定获取ks的默认网卡,现在的centos里的anaconda已经改了逻辑会从每张网卡去retry获取,根本不需要指定,指定也可以,但是不是说不指定下会弹出选择需要人为去选择网卡

f6dfdb7052be28291484322996b1a66d.png

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐