I am seeing address-family is used in EIGRP and BGP. But, how we can define it?
The address family configuration options allow you to specify how a particular routing protocol behaves with regards to multiple Layer 3 protocols. An address family can be IPv4, IPv6 and when applied to BGP and MPLS, you can have VPN-IPv4, as well as multicast or unicast. You can also specify particular address families for specific VRFs. But what are they?
Well an address family configuration simply tells the routing protocol how to deal with routes that are learned via a routing protocol, for a particular Layer 3 protocol. If we take BGP for example, it can carry different types of routing information in a single BGP session. That means that for each Layer 3 protocol being used, you must somewho tell BGP which neighbors support these same protocols, which routes you should inject, and how individual networks are going to be filitered. This is done within the address family context. So you can have a single BGP session between two routers, but have an IPv4 address family context configured, as well as an IPv6. So neighbor IPs for each address family can be configured, such that IPv4 info is received on the IPv4 address and IPv6 info is received on the IPv6 address.
By default, if you’re using IPv4, the address family used is IPv4, you don’t actually have to configure it. Same goes for when you have configured a particular interface to function using IPv6. However, for more specialized cases such as when you’re configuring MPLS VPNs for example, you must specify the address family.
As you do more labs that involve address family configuration options, you will gain a better understanding of how these contexts fit in with the rest of your configurations.
I hope this has been helpful!