Ubuntu Server 12.04下cobbler + dnsmasq +tftpd-hpa的安装配置(二)

本文涉及的产品
云解析 DNS,旗舰版 1个月
全局流量管理 GTM,标准版 1个月
公共DNS(含HTTPDNS解析),每月1000万次HTTP解析
简介:

二、安装和配置dnsmasq和tftpd-hpa

1.安装dnsmasq和tftpd-hpa

1.1 安装dnsmasq

dnsmasq是一个轻量级的tFTP、DHCP、PXE和DNS服务器。其中PXE、DHCP和tFTP服务是PXE网卡网络启动安装程序所必须的。我们在这里使用它提供DHCP和DNS服务。

# apt-get install dnsmasq

1.2 安装tftpd-hpa

tfpd-hpa是另外一个tFTP服务器。我们用tftpd-hpa来提供tFTP服务。

# apt-get install tftpd-hpa


2 配置cobbler 接管dnsmasq和tftpd-hpa

cobbler本身具备管理dnsmasq和tftpd-hpa的功能。所以我们只需要配置cobbler就可以了。

2.1 配置cobbler接管DHCP、DNS和tFTP服务

修改配置文件 /etc/cobbler/settings

需修改和修改后的值如下:

manage_dhcp: 1

manage_dns: 1

manage_tftpd: 1

restart_dhcp: 1

restart_dns: 1

pxe_just_once: 1

next_server: <server's IP address>

server: <server's IP address>

修改后:

# egrep -v '^#|^$' /etc/cobbler/settings 
--- 
allow_duplicate_hostnames: 0 
allow_duplicate_ips: 0 
allow_duplicate_macs: 0 
anamon_enabled: 0 
build_reporting_enabled: 0 
build_reporting_sender: "" 
build_reporting_email: [ 'root@localhost' ] 
build_reporting_smtp_server: "localhost" 
build_reporting_subject: "" 
cheetah_import_whitelist: 
   - "random" 
   - "re" 
   - "time" 
   - "orchestra" 
createrepo_flags: "-c cache -s sha" 
default_kickstart: /var/lib/cobbler/kickstarts/ubuntu-server.preseed 
default_name_servers: [] 
default_ownership: 
    - "admin" 
default_password_crypted: "" 
default_virt_bridge: virbr0 
default_virt_file_size: 5 
default_virt_ram: 512 
default_virt_type: qemu 
enable_menu: 1 
func_auto_setup: 0 
func_master: overlord.example.org 
http_port: 80 
kernel_options: 
    ksdevice: bootif 
    lang: ' ' 
    text: ~ 
    locale: en_US 
    priority: critical 
kernel_options_s390x: 
    RUNKS: 1 
    ramdisk_size: 40000 
    root: /dev/ram0 
    ro: ~ 
    ip: off 
    vnc: ~ 
ldap_server: "ldap.example.com" 
ldap_base_dn: "DC=example,DC=com" 
ldap_port: 389 
ldap_tls: 1 
ldap_anonymous_bind: 1 
ldap_search_bind_dn: '' 
ldap_search_passwd: '' 
ldap_search_prefix: 'uid=' 
mgmt_classes: [] 
mgmt_parameters: 
   from_cobbler: 1 
puppet_auto_setup: 0 
sign_puppet_certs_automatically: 0 
puppetca_path: "/usr/sbin/puppetca" 
remove_old_puppet_certs_automatically: 0 
manage_dhcp: 1 
manage_dns: 1 
manage_tftpd: 1 
manage_rsync: 0 
manage_forward_zones: [] 
manage_reverse_zones: [] 
next_server: 192.168.88.253 
power_management_default_type: 'ether_wake' 
power_template_dir: "/etc/cobbler/power" 
pxe_just_once: 1 
pxe_template_dir: "/etc/cobbler/pxe" 
consoles: "/var/consoles" 
redhat_management_type: "off" 
redhat_management_server: "xmlrpc.rhn.redhat.com" 
redhat_management_key: "" 
redhat_management_permissive: 0 
register_new_installs: 0 
reposync_flags: "-l -m -d" 
restart_dns: 1 
restart_dhcp: 1 
run_install_triggers: 1 
scm_track_enabled: 0 
scm_track_mode: "git" 
server: 192.168.88.253 
snippetsdir: /var/lib/cobbler/snippets 
template_remote_kickstarts: 0 
use_gpxe: 0 
virt_auto_boot: 1 
webdir: /var/www/cobbler 
xmlrpc_port: 25151 
yum_post_install_mirror: 1 
yum_distro_priority: 1


2.2 指定接管的DHCP、DNS和tFTP服务器类型

修改配置文件/etc/cobbler/modules.conf

修改后

# egrep -v '^#|^[ \t]*$' /etc/cobbler/modules.conf

[authentication]

module = authn_configfile

[authorization]

module = authz_allowall

[dns]

module = manage_dnsmasq # uses dnsmasq

[dhcp]

module = manage_dnsmasq # uses dnsmasq

[tftpd]

module = manage_in_tftpd  # defaut, uses the system's tftp server, in this example, use tftpd-hpa

3 配置DHCP、DNS、tFTP服务

由于我们配置了cobbler接管DHCP、DNS和tFTP服务,所以我们不需要单独修改dnsmasq和tftpd-hpa的配置文件,只需要修改Cobbler中DHCP、DNS和tFTP相应的配置模板即可。

Cobbler会自动帮助我们做同步工作。

3.1 配置DHCP和DNS服务

3.1.1 修改配置

修改/etc/cobbler/dnsmasq.template

修改后:

# Cobbler generated configuration file for dnsmasq

# $date

#

# resolve.conf .. ?

#no-poll

#enable-dbus

read-ethers

addn-hosts = /var/lib/cobbler/cobbler_hosts

#domain=

dhcp-range=192.168.88.100,192.168.88.254

dhcp-option=3,$next_server

dhcp-lease-max=1000

dhcp-authoritative

dhcp-boot=pxelinux.0

dhcp-boot=net:normalarch,pxelinux.0

dhcp-boot=net:ia64,$elilo

$insert_cobbler_system_definitions

3.1.2 同步配置

同步配置到dnsmasq

# cobbler sync

3.2 配置tFTP服务

3.2.1 修改配置

修改配置文件/etc/cobbler/tftpd.template

修改后:

# default: off

# description: The tftp server serves files using the trivial file transfer \

#       protocol.  The tftp protocol is often used to boot diskless \

#       workstations, download configuration files to network-aware printers, \

#       and to start the installation process for some operating systems.

service tftp

{

disable                 = no

        socket_type             = dgram

        protocol                = udp

        wait                    = yes

        user                    = $user

        server                  = $binary

        server_args             = -B 1380 $args

        per_source              = 11

        cps                     = 100 2

        flags                   = IPv4

}

3.2.2 同步配置

同步配置到tftp-hpa

# cobbler sync

4. 检查前边的操作

4.1 检查端口开放

# netstat -tunlp 
Active Internet connections (only servers) 
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name 
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      7548/apache2  
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      8875/dnsmasq  
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      2217/sshd       
tcp        0      0 127.0.0.1:3350          0.0.0.0:*               LISTEN      1083/xrdp-sesman 
tcp        0      0 0.0.0.0:3389            0.0.0.0:*               LISTEN      1078/xrdp       
tcp        0      0 127.0.0.1:25151         0.0.0.0:*               LISTEN      8387/python 
tcp6       0      0 :::53                   :::*                    LISTEN      8875/dnsmasq    
tcp6       0      0 :::22                   :::*                    LISTEN      2217/sshd       
udp        0      0 0.0.0.0:53              0.0.0.0:*                           8875/dnsmasq    
udp        0      0 0.0.0.0:67              0.0.0.0:*                           8875/dnsmasq    
udp        0      0 0.0.0.0:69              0.0.0.0:*                           7274/in.tftpd  
udp        0      0 0.0.0.0:177             0.0.0.0:*                           1213/lightdm    
udp6       0      0 :::53                   :::*                                8875/dnsmasq    
udp6       0      0 :::177                  :::*                                1213/lightdm

服务说明

80 Aapche服务

53 dnsmasqt程序的dns服务

67 dnsmasq程序的DHCP服务

69  tftp-hpa程序的tftp服务

25151 Apache2 的cobbler-web站点支持

4.2 检查PXE网络启动

在与cobbler服务器同一个网络找一台机器,BIOS调整从网络启动:

SUSE Linux Enterprise 11 64-bit-2013-11-02-01-31-28

重新启动机器,正常情况下应该会进入Cobbler的网络启动菜单:

SUSE Linux Enterprise 11 64-bit-2013-11-02-21-37-04

如果不能进入这个菜单,首先需要检查前边的步骤是否正确。还可以检查cobbler程序的日志。


     本文转自xiaoyuwang 51CTO博客,原文链接:http://blog.51cto.com/wangxiaoyu/1322194,如需转载请自行联系原作者



相关文章
|
9天前
|
网络协议 Ubuntu 网络安全
|
14天前
|
消息中间件 监控 Ubuntu
大数据-54 Kafka 安装配置 环境变量配置 启动服务 Ubuntu配置 ZooKeeper
大数据-54 Kafka 安装配置 环境变量配置 启动服务 Ubuntu配置 ZooKeeper
47 3
大数据-54 Kafka 安装配置 环境变量配置 启动服务 Ubuntu配置 ZooKeeper
|
18天前
|
资源调度
Ubuntu22.04静态ip配置+yarn build后显示内存超限,变异失败
Ubuntu22.04静态ip配置+yarn build后显示内存超限,变异失败
31 2
Ubuntu22.04静态ip配置+yarn build后显示内存超限,变异失败
|
9天前
|
Ubuntu Linux 编译器
Linux/Ubuntu下使用VS Code配置C/C++项目环境调用OpenCV
通过以上步骤,您已经成功在Ubuntu系统下的VS Code中配置了C/C++项目环境,并能够调用OpenCV库进行开发。请确保每一步都按照您的系统实际情况进行适当调整。
114 3
|
1月前
|
Ubuntu 网络安全 开发工具
Ubuntu19.04的安装过程详解以及操作系统初始化配置
本文详细介绍了Ubuntu 19.04操作系统的安装过程、初始化配置、网络设置、软件源配置、SSH远程登录以及终端显示设置。
72 1
Ubuntu19.04的安装过程详解以及操作系统初始化配置
|
1月前
|
存储 Prometheus 监控
在Ubuntu系统上安装与配置Prometheus的步骤
通过以上步骤,您应该已经成功在Ubuntu系统上安装并配置了Prometheus。您现在可以开始使用Prometheus收集和分析您的系统和应用程序的指标数据了。
83 1
|
20天前
|
Ubuntu 网络协议 Linux
liunx各大发行版(centos,rocky,ubuntu,国产麒麟kylinos)网卡配置和包管理方面的区别
liunx各大发行版(centos,rocky,ubuntu,国产麒麟kylinos)网卡配置和包管理方面的区别
|
1月前
|
Ubuntu Oracle 关系型数据库
Oracle VM VirtualBox之Ubuntu 22.04LTS双网卡网络模式配置
这篇文章是关于如何在Oracle VM VirtualBox中配置Ubuntu 22.04LTS虚拟机双网卡网络模式的详细指南,包括VirtualBox网络概述、双网卡网络模式的配置步骤以及Ubuntu系统网络配置。
108 3
|
1月前
|
Ubuntu 开发工具 虚拟化
MacOS系统基于VMware Fusion配置Ubuntu 22.04LTS环境
这篇文章介绍了如何在MacOS系统上使用VMware Fusion虚拟化软件配置Ubuntu 22.04 LTS环境,包括自定义VMware Fusion网段、Ubuntu系统安装、配置root用户登录、设置静态IP地址、修改默认网卡名称、配置PS1变量、设置登录界面为字符界面、修改软件源和进行vim基础优化等步骤。
198 2
|
1月前
|
Ubuntu
树莓派 —— ubuntu上通过netplan配置网络
树莓派 —— ubuntu上通过netplan配置网络