差異處
這裏顯示兩個版本的差異處。
osprovision:kickstart:rhel_centos:networkproblem:dhcptimeout_rhel_7 [2016/10/05 14:05] tony [Problem] |
osprovision:kickstart:rhel_centos:networkproblem:dhcptimeout_rhel_7 [2023/06/25 09:48] |
||
---|---|---|---|
行 1: | 行 1: | ||
- | {{tag>RHEL CentOS kickstart Os_Provision}} | ||
- | ====== RHEL/CentOS7 DHCP Timeout設定 ====== | ||
- | ===== Problem ===== | ||
- | 本篇主要說明如何在RHEL/CentOS7上設定DHCP Timeout。首先在安裝系統或找某個既有系統,觀察某張抓不到DHCP網卡的log:\\ | ||
- | {{:osprovision:kickstart:rhel_centos:networkproblem:centos7_dhcp_activated.png|}}\\ | ||
- | 以上圖測試結果,並且確認過Anaconda的source code,可以得知預設timeout為45秒。在寫本篇文章之前,已經試過了以下幾種方式且失敗: | ||
- | - kickstart中加入--dhcptimeout。 | ||
- | - 在/etc/dhclient.conf與/etc/dhcp/dhclient.conf加入timeout。 | ||
- | - 在NetworkManager.conf加入ipv4.dhcp-timeout設定。 | ||
- | - 也透過nmcli試圖修改ipv4.dhcp-timeout設定,但在CentOS7.2上找不到此設定。 | ||
- | 以上方法測試於CentOS7.2中。 | ||
- | ===== How to resolve? ===== | ||
- | 經由尋找解答與測試過程中,得知RHEL/CentOS7的安裝環境,網路是透過NetworkManager控制與設定:\\ | ||
- | {{:osprovision:kickstart:rhel_centos:networkproblem:centos7_nm_dhclient_cmdline.png|}}\\ | ||
- | 而在網卡還沒正常啟動前,NetworkManager每隔一段時間就會透過dhclient重新偵測此網卡。假如你的DHCP Server有機會能在45秒內完成配置,那就不會有問題;如果不行,那請繼續看下去。經過研究一番,我在[[https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7-Beta/html/7.3_Release_Notes/new_features_networking.html|RHEL7.3 beta release note]]中,發現是可以在ifcfg設定檔中,加入IPV4_DHCP_TIMEOUT設定dhcp timeout: | ||
- | <code> | ||
- | DHCP timeout in NetworkManager is configurable | ||
- | The faster fallback in a Dynamic Host Configuration Protocol (DHCP) negotiation is useful in case a | ||
- | server is not present. With this update, the user can set the value of the ipv4.dhcp-timeout | ||
- | property or the IPV4_DHCP_TIMEOUT option in the ifcfg files. As a result, NetworkManager waits | ||
- | for a response from the DHCP server only for a given time. (BZ#1262922) | ||
- | </code> | ||
- | 另外一個方式是自己下dhclient並加入timeout參數: | ||
- | <code bash> | ||
- | dhclient eno1 -timeout 90 | ||
- | </code> | ||
- | 目前我的做法是在kickstart %pre中使用dhclient。而做這些動作前,請記得先檢查網路線是否有插。([[linux:shell_script:get_local_ip|檢查網路線狀態]]) | ||
- | ===== Refference ===== | ||
- | * [[https://github.com/rhinstaller/anaconda/blob/567dca6671226e38cd249a642585d00446a12231/pyanaconda/network.py|Github - Anaconda - network]] | ||
- | * [[https://developer.gnome.org/NetworkManager/stable/NetworkManager.conf.html|NetworkManager config]] | ||
- | * [[https://wiki.gnome.org/Projects/NetworkManager/SystemSettings|Reload NetworkManager Configuration for connection setting]] | ||
- | * [[https://github.com/lcp/NetworkManager/blob/master/src/dhcp-manager/nm-dhcp-manager.c|nm-dhcp-manager.c]] | ||
- | * [[https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7-Beta/html/7.3_Release_Notes/new_features_networking.html|7.3_Release_Notes - Beta]] | ||
- | ===== ===== | ||
- | ---- | ||
- | \\ | ||
- | ~~DISQUS~~ |