ifplugd檢測eth0拔插訊息

2021-06-16 22:55:05 字數 1986 閱讀 5566

為了檢測固定網線口的拔插訊息,在busybox裡配置了ifplugd

ptions:

-n              don't daemonize

-s              don't log to syslog

-i iface        inte***ce

-f/-f           treat link detection error as link down/link up

(otherwise exit on error)

-a              don't up inte***ce at each link probe

-m              monitor creation/destruction of inte***ce

(otherwise it must exist)

-r prog         script to run

-x arg          extra argument for script

-i              don't exit on nonzero exit code from script

-p              don't run script on daemon startup

-q              don't run script on daemon quit

-l              run script on startup even if no cable is detected

-t secs         poll time in seconds

-u secs         delay before running script after link up

-d secs         delay after link down

-m mode         api mode (mii, priv, ethtool, wlan, iff, auto)

-k              kill running daemon

系統起來後執行ifplugd -ni -i eth0 -r /etc/network/if.sh會在當前shell啟動ifplugd並檢測網口狀態

# ifplugd -ni -i eth0 -r /etc/network/if.sh

ifplugd(eth0): started: busybox v1.16.1 (2011-01-28 11:42:48 hkt)

ifplugd(eth0): using siocethtool detection mode

ifplugd(eth0): link is up

ifplugd(eth0): executing '/etc/network/if.sh eth0 up'

ifplugd(eth0): exit code: 0

gmac:eth0: link is down

ifplugd(eth0): link is down

ifplugd(eth0): executing '/etc/network/if.sh eth0 down'

ifplugd(eth0): exit code: 0

gmac:eth0 : link is up

ifplugd(eth0): link is up

ifplugd(eth0): executing '/etc/network/if.sh eth0 up'

ifplugd(eth0): exit code: 0

去掉-n會以daemon方式後台執行。

本文出自 「葉落花開」 部落格,請務必保留此出處

配置busybox:

執行測試:

ubuntu ifconfig沒有eth0網絡卡

配置nfs伺服器的時候開發板一直連不上主機,用的是localhost127.0.0.1,但是一直被拒絕鏈結,然後想到是沒有用ip來連的問題,主機ifconfig的時候沒有eth0,也就沒有ip的資訊,而且ubuntu的結構和其他發行版都有點不太一樣,網絡卡的配置檔案不再 etc sysconfig ...

CentOS修改eth0配置

檔案位置 etc sysconfig network scripts ifcfg eth0 啟用 高爾夫onboot no 改為onboot yes 重啟服務 service network restart eth0 device eth0 bootproto none bootproto dhcp...

關於eth0的問題

解決 vi etc resolv.conf 然後修改新增nameserver 8.8.8.8 nameserver 8.8.4.4 修改操作 首先點a 修改完畢 點esc 然後點 再點wq 儲存 不儲存點ctrl z 使用vmware 開啟複製過來的作業系統檔案,vmware會為新產生的虛擬機器配置...