3

The computer in question has a Linux SO and is connected to a local network that has DHCP service active. I configured a public ip address to be given to that computer by the DHCP and I can ssh into it using this ip address. Now comes the weird part.

ifconfig returns a 169.254.x.x address. I have read that 169.254.x.x is given to a computer when DHCP fails to give it a proper address. But it did give a proper address, I can ssh to it (using the public IP address) and sites as http://www.whatsmyip.org/ tell me the computer has the public ip address I configured on the DHCP.

How can this be possible and what details should I include in this post?

When I asked my colleague to restart his network

/etc/init.d/net.eth0 restart

this was his output:

 * Caching service dependencies  ...                [ ok ]
 * Unmounting network filesystems ...               [ ok ]
 * Bringing down interface eth0
 *   Stopping dhcpcd on eth0 ...                    [ ok ]
 * Bringing up interface eth0
 *   dhcp ...
 *     Running dhcpcd ...
control_open: Connection refused
eth0: adding address fe80::f85f:1ef7:db63:7475
eth0: waiting for carrier
eth0: carrier acquired
DUID 00:01:00:01:1b:ef:52:ea:dc:85:de:20:38:fa
eth0: IAID a9:04:2c:82
eth0: soliciting an IPv6 router
eth0: rebinding lease of 193.136.136.136
eth0: probing for an IPv4LL address
eth0: DHCP lease expired
eth0: soliciting a DHCP lease
eth0: using IPv4LL address 169.254.78.15
eth0: adding route to 169.254.0.0/16
forked to background, child pid 6332                [ ok ]
 *     received address 169.254.78.15/16            [ ok ]
* Mounting network filesystems ...

The output of ifconfig is as follows:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 169.254.78.15  netmask 255.255.0.0  broadcast 169.254.255.255
        inet6 fe80::f85f:1ef7:db63:7475  prefixlen 64  scopeid 0x20<link>
        ether 48:85:a3:04:2d:81  txqueuelen 1000  (Ethernet)
        RX packets 113090  bytes 80195148 (76.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 39425  bytes 7462270 (7.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 2259  bytes 217008 (211.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2259  bytes 217008 (211.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether df:83:de:11:37:fb  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ip addr shows both IPs, 169.x.x.x and 193.x.x.x. Still haven't discover why 169.x.x.x is given by DHCP server.

  • How do you mean you configured a public IP address to be given by the DHCP? As you're running Linux, are you using a network manager or are you using the /etc/network/interfaces file to manage your connections? – Kinnectus Aug 11 '15 at 9:11
  • I did not configure the IP in the computer, I did it in the DHCP server. – rmarques Aug 11 '15 at 9:32
  • Because I can ssh to that computer using 193.136.136.136, the address that I wanted. – rmarques Aug 11 '15 at 9:54
  • What is the output of ifconfig? – Niall Aug 11 '15 at 10:13
  • And: what does ifconfig return when used on the other computers? – Arjan Aug 11 '15 at 11:13
3

IP's from the range 169.254.x.x are an indication that an address has not been obtained from the DHCP.

From Wikipedia on the 169.254.x.x range;

In IPv4, link-local addresses are codified in RFC 6890 and RFC 3927. Their utility is in self-autoconfiguration by network devices when Dynamic Host Configuration Protocol (DHCP) services are not available and manual configuration by a network administrator is not desirable.

The block 169.254.0.0/16 is reserved for this purpose, with the exception of the first and the last /24 subnets in the range. If a host on an IEEE 802 (ethernet) network cannot obtain a network address via DHCP, an address from 169.254.1.0 to 169.254.254.255 may be assigned pseudorandomly. The standard prescribes that address collisions must be handled gracefully.

Your IPs are listed by ifconfig and the public (visible externally) is being identified by http://www.whatsmyip.org/.

It is very typical that the internal or local network is on a different (and often private) IP address range to the external network. The external IP may be limited and NATing is used to route the external traffic to your internal device/PC.

  • Comments are not for extended discussion; this conversation has been moved to chat. – Sathyajith Bhat Aug 11 '15 at 13:52
  • @Arjan moving it to chat helps keep the question/answer clear while still retaining the comments in a nice place to talk to or reference later ;) also noticed you're back in action - good to have you again – Sathyajith Bhat Aug 13 '15 at 11:21
3

You’re using the deprecated ifconfig command. It shows only one IPv4 address per interface even though one interface can have multiple addresses assigned.

Try the ip command instead:

user@host ~ $ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
    inet x.x.x.x peer x.x.x.x/32 scope global eth0
       valid_lft forever preferred_lft forever
    inet x.x.x.x/32 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 2a01:xxxx:xxxx:xxxx::4/128 scope global
       valid_lft forever preferred_lft forever
    inet6 2a01:xxxx:xxxx:xxxx::3/128 scope global
       valid_lft forever preferred_lft forever
    inet6 2a01:xxxx:xxxx:xxxx::2/128 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::xxxx:xxxx:xxxx:xxxx/64 scope link
       valid_lft forever preferred_lft forever

You can also set dhcpcd to not set a IPv4LL address, see the man page.

  • I would not call obsolete command , only that there is a better option on Linux, since in freebsd and other unix command continues being ifconfig – Francisco Tapia Aug 11 '15 at 13:05
  • @FranciscoTapia It’s just that Linux is not Unix. ;) It’s a completely different command on other operating systems, so it’s not really comparable. ifconfig on Linux is a relict of the past. Sure it’s easy to use, but that’s really all there is. – Daniel B Aug 11 '15 at 13:19
  • do not take my comment as a criticism, i've tested for my self all advantages of ip command, im just claiming respect for the oldies ;) PD: Man pages show the folowing note: " This program is obsolete! For replacement check ip addr and ip link. For statistics use ip -s link. " :o – Francisco Tapia Aug 11 '15 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.