Sunday, August 26, 2007

IP address is 169.254.*.* even though it's addressed statically

In my office, I connect to the network 192.168.50.32/27.

Even though I set my IP address statically, when I execute ifconfig:

$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:08:02:D6:FA:FA
inet addr:169.254.147.105 Bcast:169.254.255.255 Mask:255.255.0.0
inet6 addr: fe80::208:2ff:fed6:fafa/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4287 errors:0 dropped:0 overruns:0 frame:0
TX packets:4414 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3240523 (3.0 MiB) TX bytes:805926 (787.0 KiB)
Interrupt:10 Base address:0x800

That address is a temporary one for when the device cannot get IP address from DHCP server, no?

However, my /etc/network/interfaces has static address...

$ cat /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.50.39
netmask 255.255.255.224
gateway 192.168.50.33

And in this situation, I CAN connect to internet.

After restarting /etc/init.d/networking, the address turn to 192.168.50.39, the static address I set.
$ sudo /etc/init.d/networking restart
Password:
* Reconfiguring network interfaces... [ ok ]
jocv@jocv:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:08:02:D6:FA:FA
inet addr:192.168.50.39 Bcast:192.168.50.63 Mask:255.255.255.224
inet6 addr: fe80::208:2ff:fed6:fafa/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6978 errors:0 dropped:0 overruns:0 frame:0
TX packets:7132 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5267012 (5.0 MiB) TX bytes:1299465 (1.2 MiB)
Interrupt:10 Base address:0x800
It's causally related to zeroconf.
zeroconf is a tecnology that can let some device connect to network without configuration.
First, zeroconf request an IP address to DHCP server. If the server doesn't exist, zeroconf give an IP address of 169.254.0.0/16 automatically. I uninstalled zeroconf and now everything is fine.

At any rate, even though the result of ifconfig is 169.254.*.*, IP address is absolutely 192.168.50.* because it connected to network...why? I'm no longer able to believe ifconfig?

No comments: