ubuntu-10.10 修改 dhcp 为 static 后,IP仍会周期变为dhcp获取ip [論壇 - Ubuntu基本設定]
正在瀏覽:
1 名遊客
dugu
|
ubuntu-10.10 修改 dhcp 为 static 后,IP仍会周期变为dhcp获取ip |
|
---|---|---|
Anon:dugu
|
Version:
ISO: ubuntu-10.10-server-i386 Linux userver96 2.6.35-22-generic-pae #33-Ubuntu SMP Sun Sep 19 22:14:14 UTC 2010 i686 GNU/Linux 安装OS,使用的是 DHCP 获取IP,之后想修改为 Static, /etc/network/interfaces 内容如下: auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet static address 172.16.96.115 netmask 255.255.255.0 gateway 172.16.96.1 auto eth0:1 iface eth0:1 inet static address 192.168.130.210 netmask 255.255.255.0 然后 restart 网卡,确实 static ip 立即生效了,但问题是,过几天后,ip 又会变为之前 dhcp 申请的那个ip,实在不知道 dhcp 还需要关闭那些地方,才能完全禁止?
2010/11/23 11:13
| 921b9 6ee0a 8094d b6090
|
|
![]() |
回覆: ubuntu-10.10 修改 dhcp 为 static 后,IP仍会周期变为dhcp获取ip |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() 註冊日期:
2009/12/6 10:32 所屬群組:
已註冊使用者 等級: 71
HP : 1053 / 1756
![]() |
可能是 DHCP 租約期限 的問題 ( 一般預設最長 86400 秒 )
在時限快到時 DHCP 伺服器 會通知要更新租約 否則 DHCP 可以透過 MAC 的比對來提供 Static IP (或稱為靜態 IP),否則通常提供用戶端 dynamic IP (或稱為動態 IP); 檢查一下 你的 DHCP 伺服器 ( 或說 IP 分享器 或 路由器 ) 設定頁 有沒有 透過 MAC 的比對來提供 Static IP (或稱為靜態 IP) 的選項 如果你已在 DHCP 伺服器 設定 透過 MAC 的比對來提供 Static IP 在 /etc/network/interfaces 設定 dhcp 即可
2010/11/23 11:55
|
||||||||||
![]() |
dugu
|
回覆: ubuntu-10.10 修改 dhcp 为 static 后,IP仍会周期变为dhcp获取ip |
|
---|---|---|
Anon:dugu
|
谢谢回复
问题是,Router 提供的 DHCP server 功能,怎么会影响到 我 PC 上设置为 static 方式的网卡? PC interface 设置为 static 后,DHCP client 功能应该已经关闭了吧,那么对于 dhcp server 发送的任何租、续 报文 应该 都不做响应吧? 当然,实际情况是,pc 仍然响应了收到的dhcp报文,并修改了IP,所以,我的疑问是,PC 作为 DHCP Client 的功能,如果想禁用的话,除了修改 /etc/network/interfaces 中 dhcp 改为 static ,还需要修改什么地方,才能真的禁用 dhcp client?因为 DHCP Server 在 Router 上,不可能让普通用户上去修改什么的啦。
2010/11/23 12:25
| 921b9 6ee0a 8094d b6090
|
|
![]() |
回覆: ubuntu-10.10 修改 dhcp 为 static 后,IP仍会周期变为dhcp获取ip |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() 註冊日期:
2009/12/6 10:32 所屬群組:
已註冊使用者 等級: 71
HP : 1053 / 1756
![]() |
可能是 DHCP 租約期限 的問題 是我自己猜測的 還沒找到具體的文章支持這種講法 但是從下列文章建議要移除 dhcp3-client, 說明這個懷疑的方向也有可能誤打誤中 終究 你的網路線 是插在 DHCP 上 不受它的影響 也難 我如果找到 正面的支持文件 再貼給你參考 如果你能從 dhcp 伺服器中修改 才是 一勞永逸 的辦法 從 interfaces 設定 要考慮 區網中 會不會 與別臺電腦 相沖 的問題 參考 change Ubuntu Server from DHCP to a Static IP Address 建議: sudo vim /etc/resolv.conf sudo apt-get remove dhcp3-client # 原文 sudo apt-get remove dhcp-client DHCP 伺服器
2010/11/23 13:28
|
||||||||||
![]() |
回覆: ubuntu-10.10 修改 dhcp 为 static 后,IP仍会周期变为dhcp获取ip |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員一級
![]() ![]() 註冊日期:
2010/11/23 16:17 所屬群組:
已註冊使用者 等級: 1
HP : 0 / 11
![]() |
谢谢!
Refer to this words: You need to also remove the dhcp client for this to stick (thanks to Peter for noticing). You might need to remove dhcp-client3 instead. 所以 Dhcp client 一直运行的话,确实可能更改 static ip。 我试一下 apt-get remove dhcp3-client ,观察几天后看结果如何,再来更新进展!
2010/11/23 16:19
|
||||||||||
![]() |
回覆: ubuntu-10.10 修改 dhcp 为 static 后,IP仍会周期变为dhcp获取ip |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() 註冊日期:
2009/12/6 10:32 所屬群組:
已註冊使用者 等級: 71
HP : 1053 / 1756
![]() |
2010/11/23 16:32
|
||||||||||
![]() |
回覆: ubuntu-10.10 修改 dhcp 为 static 后,IP仍会周期变为dhcp获取ip |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員一級
![]() ![]() 註冊日期:
2010/11/23 16:17 所屬群組:
已註冊使用者 等級: 1
HP : 0 / 11
![]() |
Oh, this problem reported at 2001... I think it must be fixed.
而且,这只是一个 关于使用了 fixed-address 后,dhcp client 存在的问题,和我遇到的问题不一样,当然,我想,这也许是另一个 dhcp client 的bug: 当 iface eth0 inet static 时,dhcp client对于来自 eth0 的 dhcp packets 应该直接 drop
2010/11/23 16:46
|
||||||||||
![]() |
回覆: ubuntu-10.10 修改 dhcp 为 static 后,IP仍会周期变为dhcp获取ip |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() 註冊日期:
2009/12/6 10:32 所屬群組:
已註冊使用者 等級: 71
HP : 1053 / 1756
![]() |
如果你的電腦中 裝有 dhcp3-client 的套件 經常檢查一下 這個檔案的記錄
sudo gedit /var/lib/dhcp3/dhclient.leases 如果有疑問 man dhclient.leases
2010/11/23 17:02
|
||||||||||
![]() |
回覆: ubuntu-10.10 修改 dhcp 为 static 后,IP仍会周期变为dhcp获取ip |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員一級
![]() ![]() 註冊日期:
2010/11/23 16:17 所屬群組:
已註冊使用者 等級: 1
HP : 0 / 11
![]() |
Thanks very much!
However, I've already uninstall dhcp3-client. If this problem disappeared, I will install dhcp3-client again and check 'dhclient.leases' to see whether it is a bug for dhcp3-client.
2010/11/23 17:30
|
||||||||||
![]() |
回覆: ubuntu-10.10 修改 dhcp 為 static 後,IP仍會週期變為dhcp獲取ip |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員五級
![]() ![]() 註冊日期:
2008/6/15 2:56 所屬群組:
已註冊使用者 等級: 38
HP : 0 / 945
![]() |
dugu 寫到: 先說我網路相關設定不是很懂… 你這樣設定在dhcp server看到應該172.16.96.115 192.168.130.210都是你那台電腦? eth0:1←是虛擬網卡設定,直接設定這樣試試? auto eth0 iface eth0 inet static address 192.168.130.210 netmask 255.255.255.0 gateway 192.168.130.1
2010/11/24 15:01
|
||||||||||
![]() |
您可以查看帖子.
您不可發帖.
您不可回覆.
您不可編輯自己的帖子.
您不可刪除自己的帖子.
您不可發起投票調查.
您不可在投票調查中投票.
您不可上傳附件.
您不可不經審核直接發帖.