差異處
這裏顯示兩個版本的差異處。
Both sides previous revision 前次修改 下次修改 | 前次修改 | ||
osprovision:kickstart:ubuntu:networkproblem:basic [2016/10/06 22:52] tony [Multiple NICs Warning] |
osprovision:kickstart:ubuntu:networkproblem:basic [2023/06/25 09:48] (目前版本) |
||
---|---|---|---|
行 1: | 行 1: | ||
{{tag>Ubuntu kickstart Os_Provision}} | {{tag>Ubuntu kickstart Os_Provision}} | ||
- | ====== Ubuntu-server Network Setting Of The Automated Installation (Working..) ====== | + | ====== Ubuntu-server Network Setting Of The Automated Installation ====== |
===== Basic Process ===== | ===== Basic Process ===== | ||
在RHEL/CentOS、VMWare ESXI與SLES的自動安裝系統流程中,都有pre與post階段。Ubuntu的kickstart檔案,也提供了pre與post區塊;但Ubuntu與其它distribution最大差異在於: pre階段並沒載入網卡驅動。它的流程像這樣: | 在RHEL/CentOS、VMWare ESXI與SLES的自動安裝系統流程中,都有pre與post階段。Ubuntu的kickstart檔案,也提供了pre與post區塊;但Ubuntu與其它distribution最大差異在於: pre階段並沒載入網卡驅動。它的流程像這樣: | ||
行 30: | 行 30: | ||
network --bootproto=dhcp --device=em2 | network --bootproto=dhcp --device=em2 | ||
</code> | </code> | ||
+ | 這個問題我目前的解決方式是在%post的區塊去設定網卡。我提供設定dhcp的方式給大家參考: | ||
+ | <code bash> | ||
+ | %post --interpreter=/bin/bash | ||
+ | FILE_NET_CONFIG=/etc/network/interfaces | ||
+ | |||
+ | network_devices=($(ls -I lo /sys/class/net)) | ||
+ | for device in ${network_devices[@]}; | ||
+ | do | ||
+ | check_config=`cat $FILE_NET_CONFIG | grep $device` | ||
+ | if [ ! "$check_config" ]; then | ||
+ | echo auto $device >> $FILE_NET_CONFIG | ||
+ | echo iface $device inet dhcp >> $FILE_NET_CONFIG | ||
+ | |||
+ | dhclient -r $device | ||
+ | dhclient $device | ||
+ | |||
+ | ifconfig $device down | ||
+ | |||
+ | status="up"; | ||
+ | until [ -z "$status" ] | ||
+ | do | ||
+ | status=$(ifconfig |grep -e '^$device ') | ||
+ | sleep 1 | ||
+ | done | ||
+ | |||
+ | ifconfig $device up | ||
+ | fi | ||
+ | done | ||
+ | </code> | ||
+ | 設定static ip的方式等到我有做再分享。 | ||
===== Reference ===== | ===== Reference ===== | ||
* [[http://askubuntu.com/questions/617558/preseed-doesnt-automatically-select-network-interface-on-ubuntu-14-04-automate|automatically select network interface problem]] | * [[http://askubuntu.com/questions/617558/preseed-doesnt-automatically-select-network-interface-on-ubuntu-14-04-automate|automatically select network interface problem]] | ||
+ | ====== ====== | ||
+ | ---- | ||
+ | \\ | ||
+ | ~~DISQUS~~ |