Press J to jump to the feed. Press question mark to learn the rest of the keyboard shortcuts
32
Posted byMeow 馃悎馃悎Meow 馃惐馃惐 Meow Meow馃嵑馃悎馃惐Meow A+!1 year ago
Archived

Fun with Windows - BGP

Need a another router for your BGP lab and can't be annoyed to create another router in VIRL/GNS3 or plug in another router for your lab? Never feel fear, use Windows instead!

Yes Windows Server actually has a fairly strong networking stack that can do static routes, RIP, and BGP. For fun lets do a BGP peering with a Windows 2016 server via powershell and a Cisco router.

First things first we will need to install the Remote Access and Routing and Remote Access role.

PS C:\>Install-WindowsFeature RemoteAccess
PS C:\>Install-WindowsFeature RSAT-RemoteAccess-PowerShell
PS C:\>Install-WindowsFeature Routing

Next we enable LAN routing on the system.

PS C:\> Install-RemoteAccess -VpnType RoutingOnly

Now we move on the BGP configuration, first we create a BGP router, the BGP identifer is the router-id, I tend to use the IP address of the box. The LocalASN is the AS number for the router.

PS C:\> Add-BgpRouter -BgpIdentifier 10.10.13.111 -LocalASN 100

Then we add the peer's IP address, AS number, and give it a name.

PS C:\> Add-BgpPeer -LocalIPAddress 10.10.13.111 -PeerIPAddress 10.10.13.171 -PeerASN 200 -Name CSR01

On the Cisco router we'll add some loopbacks, setup BGP, and redistribute the interfaces into it

CSR01(config)#interface Loopback0
CSR01(config-if)# ip address 192.168.0.1 255.255.255.0
CSR01(config-if)#interface Loopback1
CSR01(config-if)# ip address 192.168.1.1 255.255.255.0
CSR01(config-if)#interface Loopback2
CSR01(config-if)# ip address 192.168.2.1 255.255.255.0
CSR01(config-if)#interface Loopback3
CSR01(config-if)# ip address 192.168.3.1 255.255.255.0
CSR01(config-if)#exit
CSR01(config)#
CSR01(config)#router bgp 200
CSR01(config-router)# bgp log-neighbor-changes
CSR01(config-router)# redistribute connected
CSR01(config-router)# neighbor 10.10.13.111 remote-as 100

On the Windows side we'll advertise 5 networks, one nice thing about Windows is that the networks don't need to exist on the system so you can just add networks without creating interfaces.

PS C:\> Add-BgpCustomRoute -network 172.16.0.0/24

PS C:\> Add-BgpCustomRoute -network 172.16.1.0/24

PS C:\> Add-BgpCustomRoute -network 172.16.2.0/24

PS C:\> Add-BgpCustomRoute -network 172.16.3.0/24

PS C:\> Add-BgpCustomRoute -network 172.16.4.0/24

Just for fun we'll make the first 4 routes a summary

PS C:\> Add-BgpRouteAggregate -Prefix 172.16.0.0/22 -SummaryOnly Enabled

We can see the Cisco has learned the 172.16.0.0/22 and the left over 172.16.4.0/24

CSR01(config-router)#do sh ip bgp
BGP table version is 18, local router ID is 192.168.3.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, 
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, 
              x best-external, a additional-path, c RIB-compressed, 
              t secondary path, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>   10.0.123.0/24    0.0.0.0                  0         32768 ?
 *>   10.10.13.0/24    0.0.0.0                  0         32768 ?
 *>   172.16.0.0/22    10.10.13.111                           0 100 i
 *>   172.16.4.0/24    10.10.13.111                           0 100 i
 *>   192.168.0.0      0.0.0.0                  0         32768 ?
 *>   192.168.1.0      0.0.0.0                  0         32768 ?
 *>   192.168.2.0      0.0.0.0                  0         32768 ?
 *>   192.168.3.0      0.0.0.0                  0         32768 ?
 *>   200.0.1.0        0.0.0.0                  0         32768 ?

Windows can do show commands as well though it uses get

PS C:\> Get-BgpRouter


RoutingDomain            : 
BgpIdentifier            : 10.10.13.111
LocalASN                 : 100
CompareMEDAcrossASN      : False
DefaultGatewayRouting    : False
IPv6Routing              : Disabled
LocalIPv6Address         : 
PeerName                 : {CSR01}
PolicyName               : 
TransitRouting           : Disabled
RouteReflector           : Disabled
ClusterId                : 
ClientToClientReflection : 




PS C:\> Get-BgpPeer

PeerName LocalIPAddress PeerIPAddress PeerASN OperationMode ConnectivityStatus
-------- -------------- ------------- ------- ------------- ------------------
CSR01    10.10.13.111   10.10.13.171  200     Mixed         Connected         

We can see what the Windows side is learning like so.

PS C:\> Get-BgpRouteInformation

DestinationNetwork NextHop      LearnedFromPeer State LocalPref MED
------------------ -------      --------------- ----- --------- ---
10.0.123.0/24      10.10.13.171 CSR01           Best            0  
172.16.0.0/22                                   Best               
192.168.0.0/24     10.10.13.171 CSR01           Best            0  
192.168.1.0/24     10.10.13.171 CSR01           Best            0  
192.168.2.0/24     10.10.13.171 CSR01           Best            0  
192.168.3.0/24     10.10.13.171 CSR01           Best            0  
200.0.1.0/24       10.10.13.171 CSR01           Best            0  

We can also view the Windows routing table as well.

PS C:\> get-netroute -NextHop 10.10.13.171 | Sort-Object

ifIndex DestinationPrefix                              NextHop                                  RouteMetric PolicyStore
------- -----------------                              -------                                  ----------- -----------
5       10.0.123.0/24                                  10.10.13.171                                       0 ActiveStore
5       192.168.0.0/24                                 10.10.13.171                                       0 ActiveStore
5       192.168.1.0/24                                 10.10.13.171                                       0 ActiveStore
5       192.168.3.0/24                                 10.10.13.171                                       0 ActiveStore
5       192.168.2.0/24                                 10.10.13.171                                       0 ActiveStore
5       200.0.1.0/24                                   10.10.13.171                                       0 ActiveStore
18 comments
94% Upvoted
This thread is archived
New comments cannot be posted and votes cannot be cast
level 1
4 points1 year ago

never feel, use windows instead

Yeah using Windows does that to you

level 2
Meow 馃悎馃悎Meow 馃惐馃惐 Meow Meow馃嵑馃悎馃惐Meow A+!Original Poster1 point1 year ago

hehe

level 1

If I ever come across an environment actually using windows as a BGP-speaking router, I'm blaming you.

This is both awesome and horribly grotesque all at the same time.

level 2
Meow 馃悎馃悎Meow 馃惐馃惐 Meow Meow馃嵑馃悎馃惐Meow A+!Original Poster3 points1 year ago

Just count yourself lucky I didn't do the Windows VXLAN post :)

level 3
1 point1 year ago

For fun, I'm going to pretend that your BGP-speaking Windows instance is installed on a UCS-E in the BGP peer (I know it's a CSR, but still).

level 4
Meow 馃悎馃悎Meow 馃惐馃惐 Meow Meow馃嵑馃悎馃惐Meow A+!Original Poster1 point1 year ago

Wouldn't be the first time I did something weird with UCS-E

level 1
1 point1 year ago

Should also be noted that it can be installed and configured using the server manager as well. Under the remote access role and then the routing feature IIRC. It's pretty similar, but I'm almost certain that you'd have more options using the PS method.

level 2
Meow 馃悎馃悎Meow 馃惐馃惐 Meow Meow馃嵑馃悎馃惐Meow A+!Original Poster4 points1 year ago

To be honest I just didn't feel like doing screenshots :)

level 1
1 point1 year agoedited 1 year ago

That's actually pretty neat! Wouldn't have thought of it. Do you know if it works in 2012 as well or only 2016?

e/Excellent, I have a hardware lab at work with some '12 servers I'll have to play around with. Thanks for all the info folks.

level 2
2 points1 year ago

It's available in 2012 and 2008.

level 2
Meow 馃悎馃悎Meow 馃惐馃惐 Meow Meow馃嵑馃悎馃惐Meow A+!Original Poster2 points1 year ago

Yup it is is 2012 R2 as well.

level 1
1 point1 year ago

Awesome! Nice Tutorial. Thank You!

level 1
A+ CCENT1 point1 year ago

This looks pretty cool. Comment so I can easily find it later. Thanks Cat-guy.

level 2
1 point1 year ago

There's also a save button

level 3
A+ CCENT1 point1 year ago

Really?

level 3
A+ CCENT1 point1 year ago

I see it now on the top. Nice! How long has that been there? I'm a newb.

level 4
1 point1 year ago

As long as I've been using reddit and you've been on longer than me!

level 5
A+ CCENT1 point1 year ago

I'm old though, so...

Community Details

33.8k

Subscribers

207

Online

Create Post
r/ccna Rules
1.
No posting of illegal materials
2.
No posting of braindumps
3.
Be courteous and helpful
4.
Don't ask others to complete your labs
Cookies help us deliver our Services. By using our Services or clicking I agree, you agree to our use of cookies.Learn More.