I have the basic idea of ASN numbers. My question is how do routers know about them? It doesn't seem like it is signified by any bits in the datagram, so I assume it's done in the protocol. Once you are assigned an ASN how do your routers know what it is and how do routers that receive your datagram know what it is? Thanks
2 Answers
An autonomous system number is used for BGP; for systems speaking BGP to each other, the ASN is how they identify each other.
So, for an ASN to be useful, you'll need to have a router (with your ASN) configured to peer with someone else's router via BGP; you can then announce IP blocks via BGP which the global BGP table will see and route to your AS.

- 109,363
- 18
- 175
- 245

- 114,520
- 13
- 181
- 251
Routers running BGP protocol have their ASN numbers stored in configuration files. They announce themselves and their ASN number as well as their routes/networks to their neighbours, expecting the neighbours to have specific ASN numbers.
So basically both ends should have to have ASN numbers correctly configured.
The ASN number assignments are essentially static.
Here is a configuration file from quagga that gives you an idea how this is configured.
This router would have ASN 23 and is connected to 2 other networks with ASN 1 & 50. The bgpd daemon when started with this config would connect to 192.168.1.1 which must have ASN 1, and announce itself as router-id 192.168.23.12 with ASN number 23. It will announce the network 192.168.23.0/24 to this neighbour and associated routes. It will do the same thing to neighbour 10.10.1.1 with BGP id 50.
! Own AS number
router bgp 23
! IP address of the router
bgp router-id 192.168.23.12
! announce our own network to other neighbors
network 192.168.23.0/24
! advertise all connected routes (= directly attached interfaces)
redistribute connected
! advertise kernel routes (= manually inserted routes)
redistribute kernel
neighbor 192.168.1.1 remote-as 1
neighbor 192.168.1.1 distribute-list local_nets in
neighbor 10.10.1.1 remote-as 50
neighbor 10.10.1.1 distribute-list local_nets in

- 14,472
- 23
- 88
- 143
-
I'm sorry. I new at this and I am still having trouble. Our router has an AS – maxwebster Mar 29 '15 at 23:02
-
I have something wrong right out of the gate. Our router has AS number 23. The IP address has 23 in the last 8 bits of the network ID. The router with ASN of 1 has a value of 1 in the last 8 bits of the network ID. Why does the router with an ASN of 50 not have a 50 in the 3rd octet? I have another question, but I want to get this part straight. @matt – maxwebster Mar 29 '15 at 23:23
-
@maxwebster, it's an example, actually the network doesn't that is announced and the router-id can be any valid IP. Why they made it look like it relates to the AS number I'm not sure, they shouldn't have that association. I grabbed this from the quagga website. – hookenz Mar 30 '15 at 00:02