差異處
這裏顯示兩個版本的差異處。
osprovision:kickstart:ubuntu:networkproblem:dhcptimeout [2016/10/06 15:17] tony [使用udhcpc] |
osprovision:kickstart:ubuntu:networkproblem:dhcptimeout [2023/06/25 09:48] |
||
---|---|---|---|
行 1: | 行 1: | ||
- | {{tag>Ubuntu kickstart Os_Provision}} | ||
- | ====== Ubuntu-server在執行kickstart安裝時的DHCP Timeout設定(工作中) ====== | ||
- | ===== Problem ===== | ||
- | Ubuntu在安裝過程中,會在這個階段去設定網路:\\ | ||
- | {{:osprovision:kickstart:ubuntu:networkproblem:ubnutu_config_dhcp.png|}}\\ | ||
- | 而我們曾遇過幾次DHCP取不到的問題。本篇文章主要告訴你,如何去設定DHCP Timeout。 | ||
- | ===== Diagnostic Result ===== | ||
- | 首先是確認Ubuntu使用什麼工具去透過DHCP取得IP,通常都是使用dhclient。檢查/var/log/syslog可以確定是dhclient:(以下的圖有將timeout改為40秒)\\ | ||
- | {{:osprovision:kickstart:ubuntu:networkproblem:ubuntu_discover_dhclient_duration.png|}}\\ | ||
- | 接著就是確認dhclient設定檔。通常dhclient設定檔會放在/etc/dhclient.conf或/etc/dhcp/dhclient.conf中,而在整個安裝過程中,你可能會找到三個dhclient設定檔: | ||
- | - /mnt/etc/dhcp/dhclient.conf | ||
- | - /target/etc/dhcp/dhclient.conf | ||
- | - /etc/dhclient.conf | ||
- | 第一個是安裝來源(如光碟)所攜帶的;第二個是安裝完系統上的;第三個則是安裝環境使用的。去檢查/etc/dhclient.conf可以發現預設timeout為30秒。 | ||
- | |||
- | ===== How to resolve? ===== | ||
- | ==== 使用preseed ==== | ||
- | 首先在isolinux.cfg的append中加入preseed檔案路徑:(以檔名test.seed為例) | ||
- | <code bash> | ||
- | append file=/cdrom/test.seed initrd=/install/initrd.gz ks=cdrom:/ks.cfg | ||
- | </code> | ||
- | 而test.seed內要包含以下設定: | ||
- | <code bash> | ||
- | d-i netcfg/dhcp_timeout string 60 | ||
- | d-i netcfg/dhcpv6_timeout string 60 | ||
- | </code> | ||
- | 在安裝過程中,可以去檢查/etc/dhclient.conf,會改成你所設定的值:\\ | ||
- | {{:osprovision:kickstart:ubuntu:networkproblem:ubuntu_dhclient_conf.png|}} | ||
- | ==== 使用udhcpc ==== | ||
- | 假如不想透過preseed的方式,且要在pre階段去設定網路,就可以透過udhcpc。udhcpc是BusyBox內建的DHCP client程式,你可以這樣去設定timeout: | ||
- | <code bash> | ||
- | udhcpc -i eno2 -T 90 -n | ||
- | </code> | ||
- | -T是timeout;-n則是代表發生錯誤後就離開。 | ||
- | ==== 使用dhclient ==== | ||
- | |||
- | ===== Reference ===== | ||
- | * [[https://www.debian.org/releases/lenny/example-preseed.txt|example-preseed]] | ||
- | * [[http://felix-lin.com/linux/busybox-%E6%87%89%E7%94%A8-udhcpc|udhcpc的使用]] | ||
- | |||
- | ===== ===== | ||
- | ---- | ||
- | \\ | ||
- | ~~DISQUS~~ | ||