心有多大舞臺便有多大

          Embrace changes, pursue excellence, share niceness.

          dhcp client問題

          最近家里的電腦除了個怪問題.家里用的是東方有線的網絡,系統是ubuntu 6 server,系統開機后一段時間,網絡就自動斷了.ifconfig查看網卡信息,ip地址是對的.但ping不通外面的網絡.然后再過一段時間,網絡又重新回復,查看syslog,message等日志,只發現這樣的日志:
          Apr 20 22:26:10 localhost dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
          Apr 20 22:26:10 localhost dhclient: DHCPOFFER from 10.119.16.1
          Apr 20 22:26:10 localhost dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67
          Apr 20 22:26:10 localhost dhclient: DHCPACK from 10.119.16.1
          Apr 20 22:26:10 localhost dhclient: bound to xxx.xxx.xxx.xxxx(我的ip地址) -- renewal in 1595 seconds.
          初步分析應該是ubuntu的dhclient有問題,暫時解決不了.
          先寫個腳本解決下問題吧.(bash不怎么熟悉,只好用perl了)
          fixnetwork.pl:
          #/usr/bin/perl
          use Net::Ping;
          my $ip = "xxx.xxx.xxx.xxx";#隨便寫個公網上能ping通的ip地址
          my $p = Net::Ping->new("tcp", 4);
          while (1) {
          if ($p->ping($ip)) {
          print "$ip answered\n";
          } else {
          print "$ip did not answer\n";
          system("ifdown eth0");
          system("ifup eth0");
          }
          sleep(1);
          }
          然后執行:sudo fixnetwork.pl > fixnetwork.log &
          現在暫時網絡是能用了,但不知道這個dhclient的問題什么時候能解決:(

          posted on 2008-04-21 10:27 pony 閱讀(2679) 評論(0)  編輯  收藏 所屬分類: linux

          主站蜘蛛池模板: 巨野县| 南雄市| 百色市| 镇雄县| 沅江市| 米易县| 睢宁县| 巢湖市| 宝丰县| 屏南县| 齐河县| 金湖县| 晋中市| 时尚| 临潭县| 连山| 华宁县| 政和县| 伽师县| 怀仁县| 隆昌县| 大连市| 五家渠市| 稻城县| 苗栗市| 香格里拉县| 安丘市| 子洲县| 张家口市| 安义县| 商城县| 壤塘县| 定州市| 额济纳旗| 柞水县| 勐海县| 呈贡县| 吴川市| 恩施市| 五河县| 赤城县|