DNSMASQ配置PXE的方式

DNSMASQ做局域网内的pxe installl是最合适不过的软件了。不用单独搭建 tftpserver,用自建的即可。 而且支持给各种子网打标签,还可以按标签发送各种dhcp包的特定信息。 interface=eth0 bind-dynamic pxe-prompt="Rendoumi PXE System", 5 domain-needed bogus-priv no-resolv no-poll #address=/jump.dedi.jp/install/103.108.236.5 #UP Stream DNS Server server=114.114.114.114 server=202.106.196.115 server=202.106.0.20 strict-order dhcp-authoritative dhcp-sequential-ip dhcp-no-override log-facility=/var/log/dnsmasq.log log-dhcp log-queries enable-tftp tftp-root = /export/servers/tftpboot #only new add host is dynamic, delete or modify not. #dhcp-hostsfile=/etc/dhcp-host/hosts.conf dhcp-hostsdir=/etc/dhcp-host # #Setup different options for each of the unique subnets, since default gateways will be different #The format for this is: dhcp-options=<your_tags_here>,<option>,<option_value> - #3 is router #1:netmask, 15:domain-name, 3:router, 6:dns-server, #44:netbios-ns, 46:netbios-nodetype, 47:netbios-scope, #31:router-discovery, 33:static-route, 121:classless-static-route, #43:vendor-encap # dhcp-option=option:dns-server,172.18.30.1,172.18.30.2 dhcp-option=option:all-subnets-local,1 dhcp-option=option:T1,2m dhcp-option=option:T2,4m #dhcp-range=[tag:<tag>[,tag:<tag>],][set:<tag>,]<start-addr>[,<end-addr>|<mode>][,<netmask>[,<broadcast>]][,<lease time>] #vlan 1 native vlan #dhcp-range=set:net1,172.18.29.100,172.18.29.250,static,255.255.254.0,2m dhcp-range=set:net1,172.18.29.100,static,2m dhcp-option-force=tag:net1,option:router,172.18.29.254 #vlan 199 wuli #dhcp-range=set:net2,172.18.31.100,static,255.255.254.0,2m #dhcp-range=set:net2,172.18.31.100,255.255.254.0,2m dhcp-range=set:net2,172.18.31.100,static,2m dhcp-option-force=tag:net2,option:router,172.18.31.254 # set tag "ipxe" if request comes from iPXE ("iPXE" user class) dhcp-userclass=set:ipxe,iPXE # alternative way, look for option 175 #dhcp-match=set:ipxe,175 # gPXE/iPXE sends a 175 option. # if request comes from dumb firmware, send them iPXE (via TFTP) #dhcp-boot=tag:!ipxe,undionly.kpxe,boothost,172.18.29.2 dhcp-boot=tag:!ipxe,undionly.kpxe # if request comes from iPXE, direct it to boot from boot1.php #dhcp-boot=tag:ipxe,http://172.18.29.2/pxeboot/boot1.php #--dhcp-boot=[tag:<tag>,]<filename>,[<servername>[,<server address>|<tftp_servername>]] dhcp-boot=tag:ipxe,tag:net1,http://172.18.29.2/pxeboot/boot1.php,172.18.29.2 dhcp-boot=tag:ipxe,tag:net2,http://172.18.31.2/pxeboot/boot1.php,172.18.31.2 # Args add(old del) mac ip hostname # add ac:1f:6b:21:3e:d8 103.108.236.22 1403-s27 #dhcp-script=/bin/echo #dhcp-leasefile=/var/log/dnsmasq.leases # !!!! tag is alphanumeric label, fuck !!!!! 附上undionly.kpxe:undionly.kpxe ...

2022年12月22日 · 1 分钟 · 184 字 · 八戒

Dropbear配置SSH服务

合规审计经常需要给各种软件打补丁,比如openssh,如果是高版本还好说。如果让你补 centos 6的 openssh, 那恐怕就要喝一壶了。替代方案如下: git:https://github.com/mkj/dropbear 下载地址:https://matt.ucc.asn.au/dropbear/dropbear.html 一、介绍 dropbear作为一款基于ssh协议的轻量级sshd服务器,相比OpenSSH,其更简洁,更小巧,运行起来内存占用比也更小。在应用进程上,OpenSSH会开启两个sshd进程服务,而dropbear只开启一个进程,相较于OpenSSH,其对于硬件要求也更低,也更节约系统资源。 dropbear实现完整的SSH客户端和服务器版本2协议,不支持SSH版本1协议的向后兼容性,以节省空间和资源,并避免在SSH版本1的固有的安全漏洞。 dropbear主要有以下程序: 服务程序:dropbear(类似于Openssh的sshd) 客户程序:dbclinet(累世于Openssh的ssh) 密钥生成程序:dropbearkey 二、下载安装 wget https://matt.ucc.asn.au/dropbear/dropbear-2020.81.tar.bz2 tar jxvf dropbear-2020.81.tar.bz2 cd dropbear-2020.81 ./configure make PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp" make PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp" install mkdir /etc/dropbear/ dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key dropbear -E -p 2222 #启动ssh服务 dropbear -FE -p 2222 #-F指定前台运行 客户端连接: ssh 192.168.89.37 -p 2222 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 报错:zlib error 或者make PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp"出错 解决方法: wget https://www.zlib.net/fossils/zlib-1.2.10.tar.gz tar zxvf zlib-1.2.10.tar.gz cd zlib-1.2.10 ./configure --prefix=/usr/local/zlib ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...

2022年12月19日 · 1 分钟 · 106 字 · 八戒

docker镜像仓库harbor的搭建与使用

一:我们在公司内部建立了Docker内部镜像仓库: harbor是vmware出的一个docker镜像仓库,本质是一组容器的集合体,算是一个多容器的pod. 数据卷缺省是宿主机的/data,所以我们把iscsiu挂在/data 主机:172.18.31.28 首先安装docker-ce 添加docker-ce源: yum install epel-release yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo yum install docker-ce -y yum install ntp -y 启动自动同步时间: timedatectl set-ntp yes #此处可用yes,no,1或0 配置时区: timedatectl set-timezone Asia/Shanghai 配置Docker启动参数: mkdir -p /etc/docker cat << EOF >> /etc/docker/daemon.json { "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn/"] } EOF 之后装的所有Docker的宿主机,如果要用到这个私有仓库的话: cat << EOF >> /etc/docker/daemon.json { "insecure-registries":["172.18.31.28"], "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn/"] } EOF 启动docker systemctl enable docker && systemctl start docker ​ 安装Docker-compose ...

2022年12月19日 · 1 分钟 · 175 字 · 八戒

Docker的缺省网段冲突问题

docker默认网段是172.17,和公司的网段172.16和172.18有时候会冲突,解决方法就是换docker网段。 方案:不改docker网段,创建不和公司网段冲突的docker子网段 docker network create --driver=bridge --subnet=172.19.0.0/24 monitor_net 运行容器时指定 docker run -it --name <容器名> ---network monitor_net <镜像名> 在docker-compose同样通过networks指定,形式如下: version: '3' networks: monitor: #使用已经存在的网络 external: name: monitor_net services: prometheus: image: prom/prometheus container_name: prometheus hostname: prometheus privileged: true restart: always volumes: - /usr/local/src/config/prometheus.yml:/etc/prometheus/prometheus.yml - /usr/local/src/config/node_down.yml:/etc/prometheus/node_down.yml ports: - "9091:9090" networks: - monitor links: - alertmanager - node-exporter

2022年12月19日 · 1 分钟 · 54 字 · 八戒

Dell服务器设置远程文件共享

Dell服务器设置远程文件共享 用来加载iso文件,用于安装系统或者修复 输入172.18.31.2:/export/nfsshare/centos7-live-docker.iso 缺省是支持4种格式的共享: CIFS — //<IP to connect for CIFS file system>/<file path>/<image name> NFS — < IP to connect for NFS file system>:/<file path>/<image name> HTTP — http://<URL>/<file path>/<image name> HTTPs — https://<URL>/<file path>/<image name> 点击Connect 好的话,就会蹦出Success 然后启动虚拟控制台,Boot菜单选中启动:Virtual CD/DVD/ISO 重启,就可以进入centos7-live-docker.iso的系统了

2022年12月18日 · 1 分钟 · 42 字 · 八戒

Dell机器主板VLT0204故障处理以及内存插法

vlt0204, NDC瓦特超了,十有八九是网卡烧了,然后导致主板电压过载。 前面板日志:VLT0204,登录idrac看到日志: The system board NDC PG voltage is outside of range. 悲剧了,可能是主板烧了 处理方法如下: 一、主板放电 1、关机 2、拔电源线 3、长按电源开关半分钟不放手 4、半分钟后放手,接回电源线开机看看 如果以上方法不行,就必须采用第二种方法: 二、最小化负载排错 1、拔掉电源2 2、拔掉CPU2 3、拔掉所有内存(只留1条或2条) 4、拔掉网卡 5、启动看看 R740的内存插法: R730的内存插法:

2022年12月18日 · 1 分钟 · 29 字 · 八戒

升级CentOS7的kernel核心

CentOS7更新内核 内核下载地址:https://elrepo.org/linux/kernel/el7/x86_64/RPMS/ 内核包有两种,ml主流,lt长期支持。 我们升级核心肯定是为了主流的功能,lt还升它做甚。 #升级: rpm -ivh https://elrepo.org/linux/kernel/el7/x86_64/RPMS/kernel-ml-6.1.0-1.el7.elrepo.x86_64.rpm #查看可用内核 awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg #初始化第一个为默认内核 grub2-set-default 0 #重新创建内核配置 grub2-mkconfig -o /boot/grub2/grub.cfg reboot #后续有需要再装,不需要搞开发就别装! #更新kernel-ml-headers rpm -ivh https://elrepo.org/linux/kernel/el7/x86_64/RPMS/kernel-ml-headers-6.1.0-1.el7.elrepo.x86_64.rpm #更新kernel-ml-devel rpm -ivh https://elrepo.org/linux/kernel/el7/x86_64/RPMS/kernel-ml-devel-6.1.0-1.el7.elrepo.x86_64.rpm

2022年12月18日 · 1 分钟 · 37 字 · 八戒

合规要求之CentOS7的用户密码策略

各种合规要求中都对用户策略有着要求,什么PCI啊,上市审计啊,都有着密码复杂程度的要求: CentOS 7 的用户密码策略: 修改vi /etc/pam.d/system-auth 其中有一行: password requisite pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type= 后面加上: minlen=12 lcredit=-1 ucredit=-1 dcredit=-1 ocredit=-1 enforce_for_root 修改成为: password requisite pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type= minlen=12 lcredit=-1 ucredit=-1 dcredit=-1 ocredit=-1 enforce_for_root 意思是: 密码长度12,须包含:一个小写字符,一个大写字符,一个数字,一个特殊字符,强制root也遵守此规则 参数全部解释如下: retry=3: This option will prompt the user 3 times before exiting and returning an error. minlen=12: This specifies that the password cannot be less than 12 characters. maxrepeat=3: This allows implies that only a maximum of 3 repeated characters can be included in the password. ucredit=-1: The option requires at least one uppercase character in the password. lcredit=-1: The option requires at least one lowercase character in the password. dcredit=-1: This implies that the password should have at last a numeric character. ocredit=-1: The option requires at least one special character included in the password. difok=3: This implies that only a maximum of 3 character changes in the new password should be present in the old password. reject_username: The option rejects a password if it consists of the username either in its normal way or in reverse. enforce_for_root: This ensures that the password policies are adhered to even if it’s the root user configuring the passwords.

2022年12月18日 · 1 分钟 · 194 字 · 八戒

Dnsmasq配置一个域名对应多个ip

一:介绍: DNSMasq主要用来解决内网DNS域名缓存、DHCP、网络启动和路由通告功能,我们主要是将DNSMasq作为内网DNS域名劫持使用 系统环境:centos7.6 需求:一个域名对应多个ip 主机ip:(内网主机172.18.30.1和172.18.30.2) 二:配置方法 1,添加如下配置到/etc/dnsmasq.conf addn-hosts=/etc/ty.ddky.local addn-hosts:如果要支持一个域名对应多个 IP,就必须用 addn-hosts 选项 2,/etc/ty.ddky.local 文件内容如下: 172.18.33.100 ty.ddky.local 172.18.33.104 ty.ddky.local 3,修改完成后重启 DNSMasq systemctl restart dnsmasq.service

2022年12月18日 · 1 分钟 · 23 字 · 八戒

老版本cacti的图形filter突然失效的解决办法

网络工程师选择网络设备的监控工具是老牌的cacti,当然作为系统工程师的我,还是觉得librenms是个好选择,但是,librenms会对网络设备cpu造成比较大的压力。那还是遵从他的选择,最近网工报告说: 选择图形的时候时间Filter失效了。选择了以后图形无变化,崩溃,查了一下,都上古的玩意了。 修改方法: 修改graph_image.php unixtime = 1600000000,也就是到 2020-09-13 20:26:40。放大到 2600000000,也就是到2052-05-22 22:13:20,写这个php程序的人防越界,却没想到时间真的来到了这个节点。 注:Unix 时间戳是从1970年1月1日(UTC/GMT的午夜)开始所经过的秒数,不考虑闰秒。

2022年12月18日 · 1 分钟 · 13 字 · 八戒