<?xml version="1.0" encoding="ISO-8859-1" ?>

<NetML xmlns="http://www.xmlnetwork.org"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.xmlnetwork.org
                                          netml.xsd">

   <AS-List>
      <AS number="AS100" >
         <InternalNetworks>
            <n id="n-D"/>
            <n id="n-H"/>
            <n id="n-J"/>
            <n id="n-L"/>
            <n id="n-K"/>
         </InternalNetworks>
         <BorderRouters>
            <r id="r_100_1"/>
         </BorderRouters>
      </AS>
      <AS number="AS20" >
         <InternalNetworks>
            <n id="n-C"/>
         </InternalNetworks>
         <BorderRouters>
            <r id="r_20_1"/>
            <r id="r_20_2"/>
         </BorderRouters>
      </AS>
      <AS number="AS200" >
         <InternalNetworks>
            <n id="n-B"/>
         </InternalNetworks>
         <BorderRouters>
            <r id="r_200_1"/>
         </BorderRouters>
      </AS>
   </AS-List>
   <ebgpPeerings>
      <P id="p01">
         <PeeringSide>
            <as>AS100</as>
            <router>r_100_1</router>
            <iface>eth0</iface>
         </PeeringSide>
         <PeeringSide>
            <as>AS20</as>
            <router>r_20_2</router>
            <iface>eth0</iface>
         </PeeringSide>
      </P>
      <P id="p02">
         <PeeringSide>
            <as>AS100</as>
            <router>r_100_1</router>
            <iface>eth1</iface>
         </PeeringSide>
         <PeeringSide>
            <as>AS20</as>
            <router>r_20_1</router>
            <iface>eth1</iface>
         </PeeringSide>
      </P>
      <P id="p03">
         <PeeringSide>
            <as>AS200</as>
            <router>r_200_1</router>
            <iface>eth0</iface>
         </PeeringSide>
         <PeeringSide>
            <as>AS20</as>
            <router>r_20_1</router>
            <iface>eth0</iface>
         </PeeringSide>
      </P>
   </ebgpPeerings>
   <Networks>
      <n id="n-A">
         <networkAddress>11.0.0.32/30</networkAddress>
         <CollisionDomains>
            <c id="A">
               <iface r_id="r_200_1" if="eth0"/>
               <iface r_id="r_20_1" if="eth0"/>
            </c>
         </CollisionDomains>
      </n>
      <n id="n-B">
         <networkAddress>200.2.0.0/16</networkAddress>
         <CollisionDomains>
            <c id="B">
               <iface r_id="r_200_1" if="eth1"/>
            </c>
         </CollisionDomains>
      </n>
      <n id="n-C">
         <networkAddress>20.1.1.0/24</networkAddress>
         <CollisionDomains>
            <c id="C">
               <iface r_id="r_20_1" if="eth2"/>
               <iface r_id="r_20_2" if="eth1"/>
            </c>
         </CollisionDomains>
      </n>
      <n id="n-D">
         <networkAddress>100.1.0.4/30</networkAddress>
         <CollisionDomains>
            <c id="D">
               <iface r_id="r_100_2" if="eth0"/>
               <iface r_id="r_100_1" if="eth3"/>
            </c>
         </CollisionDomains>
      </n>
      <n id="n-E">
         <networkAddress>11.0.0.0/30</networkAddress>
         <CollisionDomains>
            <c id="E">
               <iface r_id="r_20_2" if="eth0"/>
               <iface r_id="r_100_1" if="eth0"/>
            </c>
         </CollisionDomains>
      </n>
      <n id="n-F">
         <networkAddress>11.0.0.4/30</networkAddress>
         <CollisionDomains>
            <c id="F">
               <iface r_id="r_100_1" if="eth1"/>
               <iface r_id="r_20_1" if="eth1"/>
            </c>
         </CollisionDomains>
      </n>
      <n id="n-H">
         <networkAddress>100.1.0.8/30</networkAddress>
         <CollisionDomains>
            <c id="H">
               <iface r_id="r_100_2" if="eth1"/>
               <iface r_id="r_100_3" if="eth1"/>
            </c>
         </CollisionDomains>
      </n>
      <n id="n-J">
         <networkAddress>100.1.0.0/30</networkAddress>
         <CollisionDomains>
            <c id="J">
               <iface r_id="r_100_1" if="eth2"/>
               <iface r_id="r_100_3" if="eth0"/>
            </c>
         </CollisionDomains>
      </n>
      <n id="n-K">
         <networkAddress>100.1.3.0/24</networkAddress>
         <CollisionDomains>
            <c id="K">
               <iface r_id="r_100_3" if="eth2"/>
            </c>
         </CollisionDomains>
      </n>
      <n id="n-L">
         <networkAddress>100.1.2.0/24</networkAddress>
         <CollisionDomains>
            <c id="L">
               <iface r_id="r_100_2" if="eth2"/>
            </c>
         </CollisionDomains>
      </n>
   </Networks>
   <Routers>
      <RouterConf id="r_20_1" Hostname="as20r1">
         <Interface name="eth0">
            <ipAddress>11.0.0.34/30</ipAddress>
         </Interface>
         <Interface name="eth1">
            <ipAddress>11.0.0.6/30</ipAddress>
         </Interface>
         <Interface name="eth2">
            <ipAddress>20.1.1.1/24</ipAddress>
         </Interface>
         <Policy name="RedistConnecteds">
            <Redistribution>
               <from_protocol>connected</from_protocol>
               <to_protocol>bgp</to_protocol>
            </Redistribution>
         </Policy>
         <List>
            <id>customerIn</id>
            <RouteList>
               <routeFilter>
                  <prefix>200.2.0.0/16</prefix>
                  <matchType>
                     <Exact/>
                  </matchType>
                  <target>permit</target>
               </routeFilter>
            </RouteList>
         </List>
         <List>
            <id>defaultOut</id>
            <RouteList>
               <routeFilter>
                  <prefix>0.0.0.0/16</prefix>
                  <matchType>
                     <Exact/>
                  </matchType>
                  <target>permit</target>
               </routeFilter>
            </RouteList>
         </List>
         <List>
            <id>as100In</id>
            <RouteList>
               <routeFilter>
                  <prefix>100.1.0.0/16</prefix>
                  <matchType>
                     <Exact/>
                  </matchType>
                  <target>permit</target>
               </routeFilter>
            </RouteList>
         </List>
         <BGPConf as="20">
            <StaticRoutes>
               <s address="20.1.1.0/24"/>
               <s address="0.0.0.0/0"/>
            </StaticRoutes>
            <Policy type="export">RedistConnected</Policy>
            <PeerGroup name="EBGP">
               <Neighbor address="11.0.0.33">
                  <Description>Router as200r1</Description>
                  <Default-Originate/>
                  <Peer-AS name="200"/>
                  <List type="Prefix" inOut="export">defaultOut</List>
                  <List type="Prefix" inOut="import">customerIn</List>
               </Neighbor>
               <Neighbor address="11.0.0.5">
                  <Description>Router as100r1</Description>
                  <Peer-AS name="100"/>
                  <List type="Prefix" inOut="export">defaultOut</List>
                  <List type="Prefix" inOut="import">as100In</List>
               </Neighbor>
            </PeerGroup>
            <PeerGroup name="IBGP">
               <Neighbor address="20.1.1.2">
                  <Description>Router as100r2</Description>
                  <Peer-AS name="20"/>
               </Neighbor>
            </PeerGroup>
         </BGPConf>
      </RouterConf>
      <RouterConf id="r_20_2" Hostname="as20r2">
         <Interface name="eth0">
            <ipAddress>11.0.0.2/30</ipAddress>
         </Interface>
         <Interface name="eth1">
            <ipAddress>20.1.1.2/24</ipAddress>
         </Interface>
         <Policy name="RedistConnected">
            <Redistribution>
               <from_protocol>connected</from_protocol>
               <to_protocol>bgp</to_protocol>
            </Redistribution>
         </Policy>
         <List>
            <id>as100In</id>
            <RouteList>
               <routeFilter>
                  <prefix>100.1.0.0/16</prefix>
                  <matchType>
                     <Exact/>
                  </matchType>
                  <target>permit</target>
               </routeFilter>
            </RouteList>
         </List>
         <List>
            <id>defaultOut</id>
            <RouteList>
               <routeFilter>
                  <prefix>0.0.0.0/16</prefix>
                  <matchType>
                     <Exact/>
                  </matchType>
                  <target>permit</target>
               </routeFilter>
            </RouteList>
         </List>
         <BGPConf as="20">
            <StaticRoutes>
               <s address="20.1.1.0/24"/>
               <s address="0.0.0.0/0"/>
            </StaticRoutes>
            <Policy type="export">RedistConnected</Policy>
            <PeerGroup name="EBGP">
               <Neighbor address="11.0.0.1">
                  <Description>Router as100r1</Description>
                  <Default-Originate/>
                  <Peer-AS name="100"/>
                  <List type="Prefix" inOut="export">defaultOut</List>
                  <List type="Prefix" inOut="import">as100In</List>
               </Neighbor>
            </PeerGroup>
            <PeerGroup name="IBGP">
               <Neighbor address="20.1.1.1">
                  <Description>Router as100r2</Description>
                  <Peer-AS name="20"/>
               </Neighbor>
            </PeerGroup>
         </BGPConf>
      </RouterConf>
      <RouterConf id="r_100_1" Hostname="as100r1">
         <Interface name="eth0">
            <ipAddress>11.0.0.1/30</ipAddress>
         </Interface>
         <Interface name="eth1">
            <ipAddress>11.0.0.5/30</ipAddress>
         </Interface>
         <Interface name="eth2">
            <ipAddress>100.1.0.1/30</ipAddress>
         </Interface>
         <Interface name="eth3">
            <ipAddress>100.1.0.5/30</ipAddress>
         </Interface>
         <Policy name="RedistConnected">
            <Redistribution>
               <from_protocol>connected</from_protocol>
               <to_protocol>bgp</to_protocol>
            </Redistribution>
         </Policy>
         <Policy name="rip2bgp">
            <Redistribution>
               <from_protocol>rip</from_protocol>
               <to_protocol>bgp</to_protocol>
            </Redistribution>
         </Policy>
         <Policy name="bgp2rip">
            <Redistribution>
               <from_protocol>bgp</from_protocol>
               <to_protocol>rip</to_protocol>
            </Redistribution>
         </Policy>
         <Policy name="metricOut">
            <General>
               <term priority="10" target="permit">
                  <matchConditions>
                     <List match="IP_address">myAggregate</List>
                  </matchConditions>
                  <setRules>
                     <characteristics operation="none">
                        <type>metric</type>
                        <value>10</value>
                     </characteristics>
                  </setRules>
               </term>
            </General>
         </Policy>
         <Policy name="localPrefIn">
            <General>
               <term priority="10" target="permit">
                  <setRules>
                     <characteristics operation="none">
                        <type>local preference</type>
                        <value>90</value>
                     </characteristics>
                  </setRules>
               </term>
            </General>
         </Policy>
         <List>
            <id>mineOutOnly</id>
            <RouteList>
               <routeFilter>
                  <prefix>100.1.0.0/16</prefix>
                  <matchType>
                     <Exact/>
                  </matchType>
                  <target>permit</target>
               </routeFilter>
            </RouteList>
         </List>
         <List>
            <id>defaultIn</id>
            <RouteList>
               <routeFilter>
                  <prefix>0.0.0.0/0</prefix>
                  <matchType>
                     <Exact/>
                  </matchType>
                  <target>permit</target>
               </routeFilter>
            </RouteList>
         </List>
         <List>
            <id>myAggregate</id>
            <PrefixList>
               <prefix>100.1.0.0/16</prefix>
            </PrefixList>
         </List>
         <RipConf>
            <!--default_information_originate>true</default_information_originate -->
            <neighbour>
               <address>100.1.0.0/24</address>
            </neighbour>
            <policy type="export" name="bgp2rip"/>
            <policy type="export" name="RedistConnected" />
         </RipConf>
         <BGPConf as="100">
            <StaticRoutes>
               <s address="100.1.0.0/16"/>
            </StaticRoutes>
            <Policy type="export">rip2bgp</Policy>
            <PeerGroup name="EBGP">
               <Neighbor address="11.0.0.2">
                  <Description>Router as20r2 (primary)</Description>
                  <Peer-AS name="20"/>
                  <List type="Prefix" inOut="export">mineOutOnly</List>
                  <List type="Prefix" inOut="import">defaultIn</List>
               </Neighbor>
               <Neighbor address="11.0.0.6">
                  <Description>Router as20r1 (backup)</Description>
                  <Peer-AS name="20"/>
                  <Policy type="export">metricOut</Policy>
                  <Policy type="import">localPrefIn</Policy>
                  <List type="Prefix" inOut="export">mineOutOnly</List>
                  <List type="Prefix" inOut="import">defaultIn</List>
               </Neighbor>
            </PeerGroup>
         </BGPConf>
      </RouterConf>
      
      <RouterConf id="r_100_2" Hostname="as100r2">
         <Interface name="eth0">
            <ipAddress>100.1.0.6/30</ipAddress>
         </Interface>
         <Interface name="eth1">
            <ipAddress>100.1.0.9/30</ipAddress>
         </Interface>
         <Interface name="eth2">
            <ipAddress>100.1.2.1/24</ipAddress>
         </Interface>
         <Policy name="redistributeConn">
            <Redistribution>
               <from_protocol>connected</from_protocol>
               <to_protocol>rip</to_protocol>
            </Redistribution>
         </Policy>
         <RipConf>
            <neighbour>
               <address>100.1.0.0/24</address>
            </neighbour>
         </RipConf>
      </RouterConf>
      <RouterConf id="r_100_3" Hostname="as100r3">
         <Interface name="eth0">
            <ipAddress>100.1.0.2/30</ipAddress>
         </Interface>
         <Interface name="eth1">
            <ipAddress>100.1.0.10/30</ipAddress>
         </Interface>
         <Interface name="eth2">
            <ipAddress>100.1.3.1/24</ipAddress>
         </Interface>
         <Policy name="redistributeConn">
            <Redistribution>
               <from_protocol>connected</from_protocol>
               <to_protocol>rip</to_protocol>
            </Redistribution>
         </Policy>
         <RipConf>
            <neighbour>
               <address>100.1.0.0/24</address>
            </neighbour>
         </RipConf>
      </RouterConf>
      <RouterConf id="r_200_1" Hostname="as200r1">
         <Interface name="eth0">
            <ipAddress>11.0.0.33/30</ipAddress>
         </Interface>
         <Interface name="eth1">
            <ipAddress>200.2.0.1/16</ipAddress>
         </Interface>
         <BGPConf as="200">
            <StaticRoutes>
               <s address="200.2.0.0/16"/>
            </StaticRoutes>
            <PeerGroup name="EBGP">
               <Neighbor address="11.0.0.34">
                  <Description>Router as20r1</Description>
                  <Peer-AS name="20"/>
               </Neighbor>
            </PeerGroup>
         </BGPConf>
      </RouterConf>









         <!--
         <Policy name="ImpPolBGP">
            <Redistribution>
               <from_protocol>bgp</from_protocol>
               <to_protocol>rip</to_protocol>
               <term priority="10" target="permit">
                  <setRules>
                     <AS_Path_List>ListNeigh2</AS_Path_List>
                  </setRules>
               </term>
            </Redistribution>
         </Policy>
         <Policy name="ExpPolBGP">
            <Distribution target="deny" priority="10">
               <list>ListGroup</list>
               <interface>eth0</interface>
            </Distribution>
         </Policy>
         <Policy name="ExtBgpGroupPol">
            <General>
               <term priority="20" target="permit">
                  <matchConditions>
                     <family>inet</family>
                  </matchConditions>
               </term>
            </General>
         </Policy>
         <Policy name="Neigh1ExpPol">
            <General>
               <term priority="10" target="deny">
                  <setRules>
                     <AS_Path_List>ListNeigh2</AS_Path_List>
                  </setRules>
               </term>
            </General>
         </Policy>
         <Policy name="Neigh2ImpPol">
            <General>
               <term priority="10" target="deny">
                  <setRules>
                     <AS_Path_List>ListNeigh2</AS_Path_List>
                  </setRules>
               </term>
            </General>
         </Policy>
         <List>
            <id>ListGroup</id>
            <ASPathList>
               <RegExpr> 300 500$</RegExpr>
               <RegExpr>100 700</RegExpr>
            </ASPathList>
         </List>
         <List>
            <id>ListNeigh1</id>
            <RouteList>
               <routeFilter>
                  <prefix>192.168.1.0/24</prefix>
                  <matchType>
                     <OrLonger/>
                  </matchType>
                  <target>deny</target>
               </routeFilter>
            </RouteList>
         </List>
         <List>
            <id>ListNeigh2</id>
            <ASPathList>
               <RegExpr>^200$</RegExpr>
               <RegExpr>100 200</RegExpr>
            </ASPathList>
         </List>
         <BGPConf as="100">
            <view>rtg-rm</view>
            <Description>Configurazione BGP di esempio</Description>
            <RouterId>193.168.1.1</RouterId>
            <Authentication password="netml"/>
            <Local-Preference>30</Local-Preference>
            <Default-Originate/>
            <Timers>
               <keepalive>60</keepalive>
               <holdtime>180</holdtime>
            </Timers>
            <Dampening>
               <halflife>2</halflife>
               <reuse>20</reuse>
               <suppress>30</suppress>
               <maxSuppressTime>100</maxSuppressTime>
            </Dampening>
            <LogUpDown/>
            <BestPathAlwaysCompareMed/>
            <StaticRoutes>
               <s address="192.39.9.0/24"/>
            </StaticRoutes>
            <AggregateRoutes>
               <route address="39.0.0.0/24" type="active" as-set="true">
                  <advertise>PolAggr</advertise>
                  <attribute>AggrAttr</attribute>
               </route>
               <route address="40.0.0.0/24" type="passive" as-set="false"/>
            </AggregateRoutes>
            <Policy type="import">ImpPolBGP</Policy>
            <Policy type="export">ExpPolBGP</Policy>
            <Route-Reflector>
               <Cluster id="193.168.1.1" fullyMeshed="false">
                  <Client address="192.161.204.10"/>
                  <Client address="192.161.204.30"/>
               </Cluster>
            </Route-Reflector>
            <PeerGroup name="ExtBGP">
               <Description>Peering eBGP</Description>
               <Local-AS name="110"/>
               <Update-Source iface="loopback"/>
               <Peer-AS name="200"/>
               <Default-Originate/>
               <Multihop>200</Multihop>
               <Prefix-Limit maximum="50">
                  <threshold>60</threshold>
                  <teardown/>
               </Prefix-Limit>
               <Next-Hop-Self/>
               <Authentication password="extbgp"/>
               <Remove-Private-AS/>
               <Timers>
                  <keepalive>50</keepalive>
                  <holdtime>100</holdtime>
               </Timers>
               <Policy type="import">ExtBgpGroupPol</Policy>
               <List type="Filter" inOut="export">ListGroup</List>
               <Neighbor address="192.161.204.10">
                  <Description>Configurazione del neighbor 1</Description>
                  <Default-Originate/>
                  <Multihop>78</Multihop>
                  <Prefix-Limit maximum="40">
                     <threshold>70</threshold>
                     <teardown/>
                  </Prefix-Limit>
                  <Next-Hop-Self/>
                  <Authentication password="neigh1"/>
                  <Timers>
                     <keepalive>100</keepalive>
                     <holdtime>200</holdtime>
                  </Timers>
                  <Local-AS name="120"/>
                  <Update-Source iface="loopback"/>
                  <Policy type="export">Neigh1ExpPol</Policy>
                  <List type="Prefix" inOut="import">ListNeigh1</List>
               </Neighbor>
               <Neighbor address="192.161.204.30">
                  <Peer-AS name="220"/>
                  <Policy type="import">Neigh2ImpPol</Policy>
                  <List type="Filter" inOut="export">ListNeigh2</List>
               </Neighbor>
            </PeerGroup>
            <PeerGroup name="intBGP">
               <Neighbor address="192.160.204.24">
                  <Authentication password="nig2"/>
               </Neighbor>
            </PeerGroup>
         </BGPConf>
         -->
   </Routers>
</NetML>



