Step 9. Using Network attribute to advertise specific networks¶
Goals¶
Step 9 focuses on the Network attribute in BGP, which provides a manual and
selective way to advertise network prefixes. In previous steps (6, 7, and 8), we
relied on automatic redistribution from IGPs (OSPF/RIP), which often advertises
all known internal routes to BGP peers.
In a real-world scenario, a network administrator might want to advertise only
specific prefixes to the public Internet or to a specific partner AS, while
keeping other internal subnets private. The Network attribute allows for
this fine-grained control.
Key features demonstrated:
Selective Advertisement: Using the
Networkelement in the BGP configuration XML to explicitly list the subnets to be advertised.Independence from IGP Redistribution: In this step, OSPF is running for internal connectivity, but the automatic redistribution into BGP is disabled. Only the prefixes listed in the XML are propagated via BGP.
Complex Topology Verification: Verifying that even in a multi-AS transit topology (
BGP_Topology_4.ned), manually advertised routes can still provide end-to-end reachability for the selected networks.
Configuration¶
The topology is the same as in Step 6 (BGP_Topology_4.ned).
The configuration in omnetpp.ini enables OSPF but does not set redistributeOspf:
[Config Step9]
description = "Using Network attribute to advertise specific networks"
network = BGP_Topology_4
*.routingTableRecorder.logfile = "step9.rt"
*.pcapRecorder.pcapFile = "step9.pcap"
# this example shows how to advertise selective networks in BGP using the 'Network' attribute
*.configurator.config = xml("<config> \
<interface hosts='RA4' names='eth0' address='192.168.x.x' netmask='255.x.x.x'/> \
<interface hosts='RB1' names='eth2' address='192.168.x.x' netmask='255.x.x.x'/> \
<interface hosts='RB4' names='eth2' address='192.168.x.x' netmask='255.x.x.x'/> \
<interface hosts='RC1' names='eth2' address='192.168.x.x' netmask='255.x.x.x'/> \
\
<interface among='host0 RA*' address='10.x.x.x' netmask='255.x.x.x'/> \
<interface hosts='RA*' address='10.x.x.x' netmask='255.x.x.x'/> \
\
<interface hosts='RB*' address='20.x.x.x' netmask='255.x.x.x'/> \
\
<interface among='host1 RC*' address='30.x.x.x' netmask='255.x.x.x'/> \
<interface hosts='RC*' address='30.x.x.x' netmask='255.x.x.x'/> \
\
<route hosts='host*' destination='*' netmask='0.0.0.0' interface='eth0' /> \
</config>")
# OSPF configuration
*.R*.hasOspf = true
*.R*.ospf.ospfConfig = xmldoc("OSPFConfig.xml")
# BGP configuration
*.RA4.hasBgp = true
*.RB1.hasBgp = true
*.RB4.hasBgp = true
*.RC1.hasBgp = true
*.R*.bgp.bgpConfig = xmldoc("BGPConfig.xml")
The BGP configuration (BGPConfig.xml) uses Network elements to define the advertised prefixes for each AS:
<AS id="64500">
<!--router RA4-->
<Router interAddr="10.0.0.1">
<Network address='10.0.0.0' />
<Network address='10.0.0.4' />
</Router>
</AS>
<AS id="64600">
<!--router RB1-->
<Router interAddr="20.0.0.6">
<Network address='20.0.0.4' />
<Network address='20.0.0.16' />
</Router>
<!--router RB4-->
<Router interAddr="20.0.0.2">
<Network address='20.0.0.0' />
<Network address='20.0.0.12' />
</Router>
</AS>
<AS id="64700">
<!--router RC1-->
<Router interAddr="30.0.0.1">
<Network address='30.0.0.0' />
<Network address='30.0.0.4' />
</Router>
</AS>
Results¶
The simulation results in step9.rt confirm that prefix propagation is limited to the defined subnets:
Internal Convergence: OSPF ensures that routers within each AS can reach all internal subnets.
Selective BGP Injection: Border routers (like RA4 and RC1) only inject the prefixes specifically mentioned in
BGPConfig.xml(e.g., 10.0.0.0/30, 30.0.0.0/30) into their BGP sessions.Restricted Routing Tables: Unlike Step 6, where all OSPF-learned routes were visible across the entire network, we now observe that routers only learn BGP routes for the manually advertised prefixes.
Targeted Reachability: Connectivity is verified only for the subnets included in BGP. For example, if a subnet in RA was omitted from the
Networklist, it would remain unreachable forRC, even if RA’s internal routers knew about it via OSPF.
This step demonstrates how BGP’s Network attribute is fundamental for
implementing routing policies and controlling the information shared with the
outside world.
Sources: BGP_Topology_4.ned,
omnetpp.ini,
OSPFConfig.xml,
BGPConfig.xml
Discussion¶
Use this page in the GitHub issue tracker for commenting on this tutorial.