Cobbler多網卡環境部署實現指南
在Cobbler服務器上配置多網卡,確保每塊網卡對應不同的網絡平面(如內網、外網)。以CentOS系統為例,通過nmcli
或直接修改網絡配置文件實現:
192.168.1.100/24
),作為Cobbler的server
和next_server
地址;10.0.0.100/24
)或DHCP獲取。systemctl restart network
,并通過ip a
驗證網卡狀態。yum install -y cobbler dhcp tftp-server xinetd httpd syslinux pykickstart
systemctl enable --now cobblerd httpd xinetd
cobbler check
,重點修復以下問題:
/etc/cobbler/settings
中的server
字段修改為服務器內網IP(如192.168.1.100
);next_server
字段修改為TFTP服務器IP(通常與server
一致);cobbler get-loaders
下載。Cobbler需通過DHCP向客戶端分配IP并指向TFTP服務器,需修改DHCP配置(/etc/cobbler/dhcp.template
):
subnet 192.168.1.0 netmask 255.255.255.0 { # 內網網段,需與內網網卡同一網段
option routers 192.168.1.1; # 內網網關
option domain-name-servers 8.8.8.8; # DNS服務器
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.1.100 192.168.1.200; # 內網動態IP范圍
filename "/pxelinux.0"; # PXE引導文件路徑
next-server $next_server; # 指向Cobbler服務器(內網IP)
}
若需Cobbler管理DHCP,需將/etc/cobbler/settings
中的manage_dhcp
設置為1
,并重啟Cobbler同步配置:cobbler sync
。
注意:若DHCP服務運行在其他服務器,需確保其filename
指向Cobbler的TFTP路徑(/pxelinux.0
),且next-server
為Cobbler內網IP。
通過Cobbler的system
命令為每臺客戶端配置多網卡信息,核心是用MAC地址區分網卡:
cobbler system add \
--name=node1 \
--mac=00:50:56:b7:00:57 \ # 主網卡MAC地址
--interface=eth0 \ # 內網網卡名
--ip-address=192.168.1.10 \ # 內網靜態IP
--subnet=255.255.255.0 \ # 內網子網掩碼
--gateway=192.168.1.1 \ # 內網網關
--static=1 \ # 靜態IP
--profile=CentOS-7-x86_64 \ # 使用的Kickstart profile
--netboot-enabled=true # 啟用PXE啟動
cobbler system edit \
--name=node1 \
--interface=eth1 \ # 副網卡名
--ip-address=10.0.0.10 \ # 外網靜態IP
--subnet=255.255.255.0 \ # 外網子網掩碼
--gateway=10.0.0.1 \ # 外網網關(若有)
--static=1 # 靜態IP
--static-routes
參數配置:cobbler system edit \
--name=node1 \
--interface=eth1 \
--static-routes="192.168.99.0/24:10.0.0.254" # 目標網絡:下一跳
關鍵說明:
--name
需唯一;--mac
地址必須與客戶端物理網卡一致,用于PXE識別;eth1
),確保IP、子網掩碼、網關正確。systemctl restart cobblerd dhcpd httpd tftp
cobbler sync # 同步配置到TFTP、DHCP等服務
ip a
命令驗證副網卡是否獲取到正確IP。filename
是否為/pxelinux.0
,next-server
是否為Cobbler內網IP;system edit
中的--interface
與客戶端網卡名一致,MAC地址是否正確;ip route
),確保內網、外網流量走向正確。通過以上步驟,Cobbler可實現多網卡環境下的自動化部署,滿足客戶端同時接入多個網絡的需求。