124

I have always noticed an IP something "169.254.x.x" in my routing table even when I am not connected to any network in my Windows operating system.

In Linux, when I list my routing table.

$ ip route show 

I get an entry like

169.254.0.0/16 dev eth0  scope link  metric 1000 

Can somebody explain me what is this IP address actually. Whether its something like the 127.0.0.0/8 family.

Edit: In ec2, each instance can get meta-data regarding their own by making HTTP requests to this IP.

$ curl -s http://169.254.169.254/user-data/

So can someone tell me to whom this IP address is actually assigned ?

4
  • 5
    Since you say that you see this in your Windows OS, it sounds like you're referring to APIPA (Automatic Private IP Addressing). More info here or here.
    – venomin
    Aug 14, 2015 at 3:30
  • 8
    Very relevant: A Technical Analysis of the Capital One Hack "By combining the SSRF attack from earlier with the knowledge that an AWS EC2 server has access to a metadata endpoint containing temporary credentials, the attacker was able to trick the server into making a request to the following URL: 169.254.169.254/iam/security-credentials. This endpoint returned a role name... " Aug 6, 2019 at 9:01
  • This Stackoverflow question has a more understandable answer. PS: Ironically, that question was closed because being considered "off-topic" there.
    – RayLuo
    Jul 28, 2020 at 19:31
  • Similarly in Microsoft Azure a VM can get metadata about itself by connecting to that IP: docs.microsoft.com/en-us/azure/active-directory/… $response = Invoke-WebRequest -Uri 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/' -Method GET -Headers @{Metadata="true"}
    – masterxilo
    Nov 28, 2021 at 20:07

5 Answers 5

153

These are dynamically configured link-local addresses. They are only valid on a single network segment and are not to be routed.

Of particular note, 169.254.169.254 is used in AWS, Azure, GCP and other cloud computing platforms to host instance metadata service.

6
  • 31
    The blue text means a link that you can click on for more information. Please do so. Sep 13, 2012 at 10:06
  • But there is nothing mentioned to whom this ip is assigned to ..regarding the internals in terms of virtualization. Sep 13, 2012 at 10:13
  • 9
    @pradeepchhetri It's not assigned to anyone. It's a special-use address. Sep 13, 2012 at 10:18
  • 3
    @pradeepchhetri, to answer the specific question of "who", it's Amazon themselves (though the caveat of it being a private IP applies); in the same way that Charter "owns" 192.168.100.1 in many households (only Charter uses it for the modem WebUI rather than to Amazon's service of dispensing metadata). Jul 19, 2017 at 15:59
  • 1
    Like 127.0.01 it is assigned locally on EC2 instances..
    – mckenzm
    Apr 19, 2018 at 20:04
23

In almost all circumstances that's a IP assigned automatically by an interface that's set to get its IP via DHCP but can't get one.

0
14

It's a IPv4 link local address, as defined in rfc3927. Usually ZeroConfig/Bonjour/mdns et al enabled boxes are setup to have IPv4 ll address to enable (home) networking without the presence of an DHCP or unicast DNS server.

10

This is a special case of an APIPA address. The OP is not asking for 169.254.x.x

As well as being an APIPA address, this is the internal address used by AWS EC2 instances for EC2META queries via HTTP (curl, say).

curl http://169.254.169.254/latest/meta-data/instance-id

will return the instance id without a newline, and this is useful for scripting. It is not used for "distributing" the metadata. Instead, it is used for querying these attributes.

6
  • 2
    "This is a special case of an APIPA address. Such a use is not allowed by the RFC. The addresses in 169.254.0.0/16 are not allowed to be assigned in a fixed manner, the range cannot be subnetted, and packets in the range cannot be routed. I would not use anything that violates the standard.
    – Ron Maupin
    Apr 19, 2018 at 20:22
  • 1
    @RonMaupin, APIPA are used in MS when no IP is configured on an interface (either manually or dhcp). More info is available here which seems to show it follows the RFC though I haven't tested it for compliance. Apr 19, 2018 at 20:30
  • 2
    "Note that addresses in the 169.254/16 prefix SHOULD NOT be configured manually or by a DHCP server. Manual or DHCP configuration may cause a host to use an address in the 169.254/16 prefix without following the special rules regarding duplicate detection and automatic configuration that pertain to addresses in this prefix." That means that you cannot set a fixed address in that range. A host needs to randomly select an address in the range.
    – Ron Maupin
    Apr 19, 2018 at 20:38
  • 2
    "Administrators wishing to configure their own local addresses (using manual configuration, a DHCP server, or any other mechanism not described in this document) should use one of the existing private address prefixes [RFC1918], not the 169.254/16 prefix"
    – Ron Maupin
    Apr 19, 2018 at 20:43
  • 6
    It says SHOULD NOT, not MUST NOT. Technically you can violate a SHOULD and still be considered conforming to spec. See RFC2919: "SHOULD NOT This phrase, or the phrase "NOT RECOMMENDED" mean that there may exist valid reasons in particular circumstances when the particular behavior is acceptable or even useful, but the full implications should be understood and the case carefully weighed before implementing any behavior described with this label." :)
    – mmalone
    Jun 22, 2018 at 23:30
6

Found some info from this IANA page that is probably easier to digest than the RFC3927. Quoted below:

Special-Use Addresses

  • "Autoconfiguration" IP Addresses:

      169.254.0.0 - 169.254.255.255
    

    Addresses in the range 169.254.0.0 to 169.254.255.255 are used automatically by most network devices when they are configured to use IP, do not have a static IP Address assigned and are unable to obtain an IP address using DHCP.

    This traffic is intended to be confined to the local network, so the administrator of the local network should look for misconfigured hosts. Some ISPs inadvertently also permit this traffic, so you may also want to contact your ISP. This is documented in RFC 6890.

And, its following section provides a side-by-side comparison, for OP's second question "Can somebody explain me what is this IP address actually. Whether its something like the 127.0.0.0/8 family."

  • "Loopback" IP addresses:

      127.0.0.0 - 127.255.255.255
    

    Each computer on the Internet uses 127.0.0.0/8 to identify itself, to itself. 127.0.0.0 to 127.255.255.255 is earmarked for what is called "loopback". This construct allows a computer to confirm that it can use IP and for different programs running on the same machine to communicate with each other using IP. Most software only uses 127.0.0.1 for loopback purposes (the other addresses in this range are seldom used). All of the addresses within the loopback address are treated with the same levels of restriction in Internet routing, so it is difficult to use any other addresses within this block for anything other than node specific applications, generally bootstraping. This is documented in RFC 6890.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .