15

How do routers get their external IP address? Is it assigned by a central service? Is it decided by the ISP? I have googled this problem, but have only found how to change my IP address, which is not what I am after.

2
  • 6
    If you're talking about a router connected to an ISP, then yes, the ISP ultimately controls which external addresses can be used to contact your router through its services. Jul 30, 2021 at 5:03
  • 2
    ISP defines does you must use some definite WAN settings (if so ISP provides these settings, and you must set up your router accordingly) or you must use DHCP (if so then all settings are obtained from ISP's DHCP service).
    – Akina
    Jul 30, 2021 at 8:13

4 Answers 4

35

Very much like how you have a local DHCP server running on your home router to serve IPv4 addresses on your LAN network (typically in the 192.168.1.x subnet), your ISP also has a DHCP server running somewhere that your router gets its WAN address from. The IP address range your ISP's DHCP server hands out are public IP addresses that it has purchased or been assigned.

18
  • 14
    And there are also ISPs (like mine) that hand out private IPs for their internal network to customers, as they do carrier grade NAT for most customers.
    – dirkt
    Jul 30, 2021 at 5:03
  • 5
    @dirkt very true! We have unfortunately run out of IPv4 addresses, which leads to "solutions" like that
    – staehle
    Jul 30, 2021 at 5:05
  • 3
    @staehle solutions which work quite well for consumers.
    – RonJohn
    Jul 30, 2021 at 15:06
  • 2
    @RonJohn Certainly for most consumers, most of the time
    – BThompson
    Jul 30, 2021 at 15:18
  • 3
    @staehle and LOTS of (literally or figuratively) embedded software can't be replaced. And just thinking about all the firewall rules which would have to be rewritten (especially in Enterprises which much follow SOC1, PCI, etc audits for documentation) would be a nightmare.
    – RonJohn
    Jul 30, 2021 at 16:40
14

There is no single answer to this save to say that ISP's provide IP addresses out of blocks they own. A non-exclusive way as to how they may be implementing this -

If the connection used PPPoE or PPPoA the PPP session will have an IP address associated with it. Very commonly these IP addresses will be configured in a Radius server (often backed by a database). The ultimate assignment could be based on userid, come from an IP pool or a characteristic associated with the connection.

In a simple ethernet case an IP address could be assigned statically or via DHCP - although this is not a great way to do things unless there are additional controls to prevent people "stealing" others IP addresses.

2
  • Our ISP uses DHCP with "option 82" via both ADSL and GPON. Their DHCP server always issues the same address for a given physical line ID. Jul 30, 2021 at 10:27
  • 1
    Controls to prevent 'stealing' IP addresses (more commonly known as spoofing/forging) should always be implemented anyway, as part of network ingress filtering (RFC 2827, BCP 38).
    – Bob
    Jul 30, 2021 at 19:16
4

Have to agree with you, quite difficult to find a straight answer via google. To me that means it's a good question!

Reason why answering this question is difficult, like Davidgo mentioned, is because there is no single answer. What he probably means is that there is more than one single method or process that leads to assignment of an IP address to a machine. Which method or process is used depends on specific circumstances like e.g. is the router connected to the internet or is it connecting to a(-nother) private network.

Try to keep in mind that all methods, protocols, policies, processes etc. that are required to enable communication are part of a logical, systematic and strict set of rules (so a structure) to ensures unique identification for all connecting machines. If the uniqueness fails, then communication drops out and no networking is possible. So in that sense this full set of rules is the correct answer to your question but that's just a bit too much to take in at once.

Here is a start A short guide to IP addressing... from the Internet Society

Intro below (there is much much more on their site as I just found out.

IP addresses are managed by the Internet Assigned Numbers Authority (IANA), which has overall responsibility for the Internet Protocol (IP) address pool, and by the Regional Internet Registries (RIRs) to which IANA distributes large blocks of addresses.

The RIRs manage, distribute, and publicly register IP addresses and related Internet number resources, such as Autonomous System Numbers (ASN) and reverse Domain Name System (DNS ) delegations within their respective regions.

They do this according to policies which are developed within their respective regional communities, through open and bottom-up processes.

4

Routers get their addresses the same way any other device does, which is to say: it depends. It might be DHCP (very common in cable and fiber scenarios). It might be IPCP as part of a PPPoE session (common for DSL and some other fiber providers). It might simply be statically assigned and manually configured (common within network providers themselves and for particularly large customers). It might be something completely different. There's no one definitive answer on Google because there's no one definitive answer.

You must log in to answer this question.

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