Win2000 重新開機後,設定好的 IP 位址 會跳回 DHCP 模式

剛把一台主機版故障的電腦上 Win2000 系統移到另一台備用電腦上,所有的驅動設定都已經抓到了。也設定上去先前的IP位址,關機完後把機子送回去給使用者,他過了一回打電話給我說。IP設定好了之後,只要重開機又會變回去 DHCP 模式!!

開始找問題,發現 reltek 8139 已沒有此網卡了(在壞掉的舊電腦上),但裝置管理員裏卻還看的到它的存在。而且無法正常移除這個裝置!!

最後發現,Win2000 安裝了 reltek 8139 的網卡驅動程式與軟體。且對於 Windows2000 來說它是屬於系統開機必要的裝置無法從裝置管理員中移除。須先由新增移除軟體中將reltek的網卡驅動程式先移除之後,才能把已不存在的reltek網卡從裝置管理員中移除。


Ubuntu hostapd dhcp 實現 wifi access point service

Making a WiFi Hotspot / Access Point using Linux & wifi lan card/USB adapter

If you have a wifi LAN card / USB adapter, then you can use it as an access point so that other machines can connect to the internet via your machine using Wifi. The process is fairly simple, but requires you to have a compatible set of drivers which allow a wifi lan card to come into “Master” mode.

It didn’t work well for

Linksys WUSB54GC v3 USB adapter. Till Ubuntu 10.04, there were no good drivers for use with hostapd (supporting mac80211 / nl80211). In Ubuntu 10.10, though the drivers were working, but the connection was highly unstable – in fact unusable. The drivers that I tried were rt2800usb (which allowed the adapter to come into Master mode), and rt2870sta which didn’t allow the adapter to come into “Master” mode. It always remained “Auto” or “Managed” (checked via iwconfig). Need to test in 11.04 when it arrives.
What worked pretty well

02:00.0 Ethernet controller: Atheros Communications Inc. AR5001 Wireless Network Adapter (rev 01), using ath5k drivers. hostapd didn’t complain at all and all was smooth. This was in Ubuntu 10.04.
There’s an application called hostapd which allows converting a wifi adapter into an access point and provide privileges such as WPA authentication and ssid name definition etc. I used it and it worked well.
When a client connects to the access point, apart from authentication it’ll require IP addresses to be assigned. For that a DHCP server is used.
You need to have 2 interfaces, one which accesses the net (e.g. eth0), and other which provides the access point services (e.g. wlan0).
You start the wlan interface, assign it an IP address, start the dhcp server, setup firewall/nat and start hostapd. That’s all to it. Your devices would be able to use the wifi adapter as the access point.

apt-get install dhcp3-server hostapd

Modify /etc/hostapd/hostapd.conf and put the following
wpa_pairwise=TKIP CCMP

The dhcpd.conf section in /etc/dhcp3/dhcpd.conf would have something like the following

subnet netmask {
option domain-name-servers,;
option routers;

Modify /etc/default/dhcp3-server

Check what name your adapter got via iwconfig. You can change the name also and make it persistent via /etc/udev/rules.d/70-persistent-net.rules so that it always gets a single type of name. In our example we’re assuming wlan0, but it could be changed. Make necessary changes in your configuration too.

Configure the new interface
ifconfig wlan0

The above could also be done in a better way via the /etc/network/interfaces file, but didn’t try it out. In any case if you shutdown hostapd, the network interface (wlan0) loses its address, so need to put a script which assigns it again before hostapd is started. An example could be

iface wlan0 inet static

Restart the dhcp3-server. It should now be ready to serve addresses and is also bound to the network interface too.

Allow ip masquerading

echo “1″ > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Now start hostapd and see the messages that it shows

hostapd -dd /etc/hostapd/hostapd.conf
Wait for a few seconds, it should show some probes being done by other wifi devices. If it shows, then probably you’re in good luck.

Now try to connect via your device to this access point. It should work.

To make this work on boot, can put the relevant config in /etc/default/hostapd

and also put the firewall rules in /etc/rc.local (make sure its executable).

Remember – if you shutdown your hostapd, the network card would lose its address. So you have to assign that again before starting hostapd. The usual practice would be

Stop hostapd
Stop dhcp server
Restart network (or rather ifup wlan0 / ifconfig wlan0 would do)
Restart dhcp server
Start hostapd

You can check the wifi interfaces via

To set a wifi adapter into master mode, try the following. If it doesn’t work and shows an error that it’s not possible or something, fret not – use hostapd as that’ll do that in any case.
iwconfig wlan0 mode Master

Network Manager could create issues, though in my test environment – instead of using an ethernet interface, I used two wlan interfaces, one being controlled by Network Manager for internet access, and other for making it an access point.
modprobe -r ath5k / modprobe -r rt2800usb etc. is to be used for unloading the modules.

If you wish to proceed without using authentication so that you can test it easy, then put the following in /etc/hostapd/hostapd.conf


How To Install Windows XP througth network (Ubuntu + dhcpd + tftpd-hpa + syslinux + samba)

透過網路開機 PXE 來安裝 Windows XP 、Windows 2003、Windows 2000 都能採用這樣的方法來做。以下就是使用 Ubuntu 來做為 NIS 伺服器的安裝 XP 的步驟。

Ubuntu 須要有兩個網路介面(對外、DHCP用),如果只有一個網路介面可用虛擬網卡設置。

僅一網卡的設置,可能要移除 network-manager 並重新設定網路配置產生虛擬網卡。

sudo apt-get purge network-manager

sudo vim /etc/network/interface

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static

auto eth0:0
iface eth0:0 inet static


sudo /etc/init.d/networking restart

Ubuntu 10.04 安裝必要的套件 dhcpd 、tftp-hpa、syslinux、samba。

sudo apt-get install dhcp3-server tftpd-hpa syslinux samba