I had someone email me and ask how they could change the IP address on their Availability Group Endpoint.  It’s no surprise that IPs need to be changed from time to time due to certain circumstances, but what you might be wondering is where during the creation of your AG did you assign the endpoint an IP.  If you used the GUI to create your AG then the answer is that you never assigned your endpoint an IP.  So why do you even care?

The one thing I challenge folks to think about when I teach my HA/DR precons and AG sessions is to think about the types and amount of traffic across the entire ecosystem.  An Availability Group is going to have cluster heart beat traffic, user traffic, SQL replica traffic, and depending on your storage you might have traffic for that as well.  Your network is just like plumbing.  You can only fit so much water through a 1 inch pipe at a time.  The same goes for network connections, and that’s a lot of traffic to put over a single NIC port.  However, you can separate all of those traffic types and changing the IP of the endpoint will let you give the AG data replica traffic its own network pipe.

Every replica in the AG has its own endpoint so you will need a new IP for each one.  Go assign the IPs to a NIC card in each server.  Now we need to change the endpoint to use the new IP on each replica.  The good news here is that no outage is required to do this.  Here is the code to change your endpoint.  You just need to edit the endpoint, port (Read the caution below), and IP.

ALTER ENDPOINT [MyEndpoint]

STATE = STARTED

AS TCP (LISTENER_PORT = 5023, LISTENER_IP = (10.x.x.x))

FOR DATA_MIRRORING (ROLE = ALL, AUTHENTICATION = Windows Negotiate, ENCRYPTION = REQUIRED ALGORITHM AES)

GO

Caution!

You MUST use the same port you are using today. If you decide to change the port then the URL will also need to be updated. You can read this post on how to do that.