![dhcpcd を使用して手動で設定したインターフェースをリセットする](https://rvso.com/image/1254812/dhcpcd%20%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6%E6%89%8B%E5%8B%95%E3%81%A7%E8%A8%AD%E5%AE%9A%E3%81%97%E3%81%9F%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%BC%E3%83%95%E3%82%A7%E3%83%BC%E3%82%B9%E3%82%92%E3%83%AA%E3%82%BB%E3%83%83%E3%83%88%E3%81%99%E3%82%8B.png)
- dhcpcd を使用して IP アドレスを取得します (
dhcpcd -p eth0
) - IPアドレスを手動で変更する(
ifconfig eth0 x.x.x.x
) - dhcpcd を強制終了する (
dhcpcd -k eth0
) - dhcpcdを再起動します(
dhcpcd -p eth0
)
この場合、dhcpcd はインターフェースの IP アドレスを設定せず、インターフェースは手動で設定された IP アドレスで起動します。なぜインターフェースが設定されないのでしょうか?
dhcpcd -d eth0
表示:
eth0: dhcpcd 4.0.0-beta6 starting
eth0: hardware address = ##:##:##:##:##:##
eth0: broadcasting for a lease
eth0: sending DHCP_DISCOVER with xid 0x25fc838b
eth0: waiting for 3.241 seconds
eth0: offered 192.168.228.180 from 192.168.50.10
eth0: sending DHCP_REQUEST with xid 0x25fc838b
eth0: waiting for 7.224 seconds
eth0: lease of 192.168.228.180 acknowledged
eth0: sending ARP probe #1
eth0: waiting for 1.563 seconds
eth0: sending ARP probe #2
eth0: waiting for 1.442 seconds
eth0: sending ARP probe #3
eth0: waiting for 2.000 seconds
eth0: leased 192.168.228.180 for 691200 seconds
eth0: renew in 345600 seconds
eth0: rebind in 604800 seconds
eth0: adding IP address 192.168.228.180/23
eth0: adding route to 0.0.0.0/0 via 192.168.228.1
eth0: exec `/libexec/dhcpcd-run-hooks'
eth0: forking to background
答え1
インターフェースに有効な静的 IP アドレスが割り当てられている場合、dhcpcd はインターフェースを構成しないことが判明しました。
手順を追加: 3b. eth0 IP を無効な値に変更します (ifconfig eth0 0.0.0.0)
dhcpcd が再起動されると、インターフェースは DHCP によって割り当てられた IP アドレスに設定されます。