Sunday, September 4, 2016

etherchannel with L2VPN

SW1-2 are PE, SW3-4 are CE

Configuration :
@SW1
interface Ethernet0/0
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface Ethernet0/1
 switchport access vlan 100
 switchport mode dot1q-tunnel
 l2protocol-tunnel point-to-point lacp
!
interface Ethernet0/2
 switchport access vlan 200
 switchport mode dot1q-tunnel
 l2protocol-tunnel point-to-point lacp

@SW2
interface Ethernet0/0
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface Ethernet0/1
 switchport access vlan 100
 switchport mode dot1q-tunnel
 l2protocol-tunnel point-to-point lacp
!
interface Ethernet0/2
 switchport access vlan 200
 switchport mode dot1q-tunnel
 l2protocol-tunnel point-to-point lacp
!


Note:
the reason you need to separate the metro tag is that : to prevent the case where the packet leaves SW3 is routed it self is reset at SW2 and foreword over both interface to SW4, and this is case L2 loop. 


@SW3
interface Ethernet0/1
 channel-group 1 mode active
!
interface Ethernet0/2
 channel-group 1 mode active

@SW4
interface Ethernet0/1
 channel-group 1 mode active
!
interface Ethernet0/2
 channel-group 1 mode active

verification
@SW4 and 3

SW4#sh etherchannel summary
Flags:  D - down        P - bundled in port-channel
        I - stand-alone s - suspended
        H - Hot-standby (LACP only)
        R - Layer3      S - Layer2
        U - in use      N - not in use, no aggregation
        f - failed to allocate aggregator

        M - not in use, minimum links not met
        m - not in use, port not aggregated due to minimum links not met
        u - unsuitable for bundling
        w - waiting to be aggregated
        d - default port

        A - formed by Auto LAG


Number of channel-groups in use: 1
Number of aggregators:           1

Group  Port-channel  Protocol    Ports
------+-------------+-----------+-----------------------------------------------
1      Po1(SU)         LACP      Et0/1(s)    Et0/2(P)

Note
for some reason the native vlans for CE and PE is match, the traffic from CE will be lake in ISP without metro tag, there for the traffic will be drop and maybe case L2 loop, to prevent that you should use "vlan dot1q tag native" on Global mode for all ISP devices. 

for more information about dot.1Q Tunneling and Native VLANs problem go to this link : 
http://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst3750x_3560x/software/release/12-2_55_se/configuration/guide/3750xscg/swtunnel.html


thank you.
Ameer Alsafi 
09/05/16

Sunday, June 19, 2016

Private VLANs

!Create vlans

vlan 100
 private-vlan primary
vlan 110
 private-vlan isolated
vlan 120
 private-vlan community

!Create promiscuous interface 
inter f0/1
 switchport mode private-vlan promiscuous
 switchport private-vlan mapping 100 110,120

!Assign port to isolated vlan
inter f1/1-2
 switchport mode private-vlan host
 switchport private-vlan host-association 100 110


!Assign port to community vlan  
inter rang f1/3-10
 switchport mode private-vlan host
 switchport private-vlan host-association 100 120


!THANK YOU ....

Thursday, June 2, 2016

1#The way to the professionalism of MPLS


The way to the professionalism of MPLS 
S#1
Label Distribution Protocol (LDP) 
The Label Distribution Protocol (LDP) is a protocol defined by the IETF (RFC 5036) for the purpose of distributing labels in an MPLS environment. LDP relies on the underlying routing information provided by an IGP in order to forward label packets. The router forwarding information base, or FIB, is responsible for determining the hop-by-hop path through the network. Unlike traffic engineered paths, which use constraints and explicit routes to establish end-to-end Label Switched Paths (LSPs), LDP is used only for signaling best-effort LSPs.

source : https://en.wikipedia.org/wiki/Label_Distribution_Protocol

CDP with DMVPN



CDP with DMVPN 

Right from the Cisco kool-aid website: On-Demand Routing (ODR) is an enhancement to Cisco Discovery Protocol (CDP), a protocol used to discover other Cisco devices on either broadcast or non-broadcast media. With the help of CDP, it is possible to find the device type, the IP address, the Cisco IOS® version running on the neighbor Cisco device, the capabilities of the neighbor device, and so on. In Cisco IOS software release 11.2, ODR was added to CDP to advertise the connected IP prefix of a stub router via CDP. This feature takes an extra five bytes for each network or subnet, four bytes for the IP address, and one byte to advertise the subnet mask along with the IP. ODR is able to carry Variable Length Subnet Mask (VLSM) information.

Router/Switch Output
Commands
Notes
DMVPN Hub
First we need to add a default route
HQ(config)#  ip route 0.0.0.0 0.0.0.0 150.1.254.7
Since we are going to be using CDP for a routing protocol we should tune-down the timers.  The default timer of 60 seconds is probably a bit too long
HQ (config)# cdp timer 10
Now we can create the loopback interface
HQ (config)#
 interface Loopback0
HQ (config-if)# ip address 100.100.100.100 255.255.255.255
We need to enable CDP on the tunnel interface
HQ (config)# interface Tunnel0
HQ (config-if)# cdp enable

Now before we configure ODR, we need to create an access-list to specify the networks we want to learn from the hub.  This needs to be done in order to prevent the outside interface from being learned over the tunnel
HQ (config-if)# access-list 123 permit ip any host 3.3.3.3
HQ (config-if)# access-list 123 permit ip any host 4.4.4.4
HQ (config-if)# access-list 123 permit ip any host 5.5.5.5
Now we can configure ODR
HQ (config-if)# router odr
HQ (config-if)# network 192.168.11.0
And specifiy the distribute list
HQ(config-if)# distribute-list 123 in
Time for the spokes.
R3 first
Lets get that loopback created
R3(config)#
 interface Loopback0
R3(config-if)# ip address 3.3.3.3 255.255.255.255
And change that default rotue
R3(config)# ip route 150.0.0.0 255.0.0.0 150.1.13.13
R3(config)# no ip route 0.0.0.0 0.0.0.0 150.1.13.13
Lets tweak our CDP timers
R3(config)#  cdp timer 10
Now all we have to do is enable CDP on the tunnel interface.
R3(config)# interface Tunnel0
R3(config-if)# cdp enable 
No need for a router statement, CDP being enabled is all that is needed.
R4 time!
Lets get that loopback created
R4(config)# interface Loopback0
R4(config-if)# ip address 4.4.4.4 255.255.255.255
Now we can modify that default route
R4(config)# ip route 150.0.0.0 255.0.0.0 150.1.9.9
R4(config)# no ip route 0.0.0.0 0.0.0.0 150.1.9.9
Lets tweak our CDP timers
R4(config)# cdp timer 10
Now we can enabled CDP on the tunnel interface
R4(config)# interface Tunnel0
R4(config-if)# cdp enable

Again, no router command necessary – CDP will take care of everything.
Last up, R5
Create the loopback
R5(config)# interface Loopback0
R5(config-if)# ip address 5.5.5.5 255.255.255.255
Tweak our CDp timer
R5(config)# cdp timer 10
Modify the default route
R5(config)# ip route 150.0.0.0 255.0.0.0 150.1.10.10
R5(config)# no ip route 0.0.0.0 0.0.0.0 150.1.10.10
Now enable CDP
R5(config)# interface Tunnel0
R5(config-if)# cdp enable

Once again, no router command necessary.
And like that, ODR is configured.  Now we can look at the CDP neighbors on the DMVPN hub now
HQ#sh cdp nei
Capability Codes: R – Router, T – Trans Bridge, B – Source Route Bridge
S – Switch, H – Host, I – IGMP, r – Repeater
Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
  R3          Tunnel0            171         R S I     3845      Tunnel0
  R4          Tunnel0            171         R S I     3845      Tunnel0
  R5          Tunnel0            175         R S I     3825      Tunnel0
  HQ#
There, we have full CDP neighbors on the DMVPN  hub router.

Lets Check R3, R4, and R5
R3
R3#sh cdp nei
Capability Codes: R – Router, T – Trans Bridge, B – Source Route Bridge
S – Switch, H – Host, I – IGMP, r – Repeater
Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
DMVPN       Tunnel0            174           R       7204VXR   Tunnel0
R3#

R4#sh cdp nei
Capability Codes: R – Router, T – Trans Bridge, B – Source Route Bridge
S – Switch, H – Host, I – IGMP, r – Repeater
Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
DMVPN       Tunnel0            170           R       7204VXR   Tunnel0
R4#
R5#sh cdp nei
Capability Codes: R – Router, T – Trans Bridge, B – Source Route Bridge
S – Switch, H – Host, I – IGMP, r – Repeater
Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
DMVPN       Tunnel0            177           R       7204VXR   Tunnel0
R5#
So the hub has all the spokes as CDP neighbors and the spokes only have the hub.  That is what we would expect to see.
Now we should look at the routing table on the DMVPN hub:
HQ#sh ip route
Codes: C – connected, S – static, R – RIP, M – mobile, B – BGP
D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area
N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
E1 – OSPF external type 1, E2 – OSPF external type 2
i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
ia – IS-IS inter area, * – candidate default, U – per-user static route
o – ODR, P – periodic downloaded static route
Gateway of last resort is not set
100.0.0.0/32 is subnetted, 1 subnets
  C       100.100.100.100 is directly connected, Loopback0
  3.0.0.0/32 is subnetted, 1 subnets
  o       3.3.3.3 [160/1] via 192.168.11.3, 00:00:04, Tunnel0
  4.0.0.0/32 is subnetted, 1 subnets
  o       4.4.4.4 [160/1] via 192.168.11.4, 00:00:04, Tunnel0
  5.0.0.0/32 is subnetted, 1 subnets
  o       5.5.5.5 [160/1] via 192.168.11.5, 00:00:00, Tunnel0
  C    192.168.11.0/24 is directly connected, Tunnel0
  150.1.0.0/24 is subnetted, 1 subnets
  C       150.1.254.0 is directly connected, GigabitEthernet0/1
  S    150.0.0.0/8 [1/0] via 150.1.254.7
  HQ#
You will ntoice that all the routes are there and annotated with a small o to indicate ODR.
Now, lets look at the routing table on R3
R3#sh ip route
Codes: C – connected, S – static, R – RIP, M – mobile, B – BGP
D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area
N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
E1 – OSPF external type 1, E2 – OSPF external type 2
i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
ia – IS-IS inter area, * – candidate default, U – per-user static route
o – ODR, P – periodic downloaded static route
Gateway of last resort is 192.168.11.1 to network 0.0.0.0
3.0.0.0/32 is subnetted, 1 subnets
  C       3.3.3.3 is directly connected, Loopback0
  C    192.168.11.0/24 is directly connected, Tunnel0
  150.1.0.0/24 is subnetted, 1 subnets
  C       150.1.13.0 is directly connected, GigabitEthernet0/1
  o*   0.0.0.0/0 [160/1] via 192.168.11.1, 00:00:06, Tunnel0
  S    150.0.0.0/8 [1/0] via 150.1.13.13
R3#
As you can see, there is a 0/0 route pointing to the DMVPN hub now – 192.168.11.1.  ODR will advertise a default route via cdp.
To see this you can enable debug cdp ip
R3#debug cdp ip
R3#
*Aug  5 14:45:50.718: CDP-IP: Reading default route 192.168.11.1 via Tunnel0
*Aug  5 14:45:50.718: CDP-IP: Updating default route 192.168.11.1 in routing table
R3#
*Aug  5 14:45:56.526: CDP-IP: Writing prefix 3.3.3.3/32
*Aug  5 14:45:56.526: CDP-IP: Writing prefix 150.1.13.0/24
R3#
From that debug you can see that we receive the default route from 192.168.11.1 via the Tunnel, we update our routing table.
Then we update our CDP packet and include prefix 3.3.3.3/32 and prefix 150.1.13.0/24.  That is why we need the distribute list on the ODR hub, to prevent the outside IP (150.1.x.x) from being recieved on the hub.

So, lets look at the DMVPN connections on R3

R3#sh dmvpn
Legend: Attrb –> S – Static, D – Dynamic, I – Incomplete
N – NATed, L – Local, X – No Socket
# Ent –> Number of NHRP entries with same NBMA peer
NHS Status: E –> Expecting Replies, R –> Responding
UpDn Time –> Up or Down Time for a Tunnel
================================================

Interface: Tunnel0, IPv4 NHRP Details
Type:Spoke, NHRP Peers:1,
# Ent  Peer NBMA Addr Peer Tunnel Add State  UpDn Tm Attrb
—– ————— ————— —– ——– —–
1   150.1.254.254    192.168.11.1    UP 00:45:27     S
R3#
Only one mapping – just like we have traditionally seen.
Lets PING R4 loopback and R5 loopback.  You might notice that we do not have a specific route, but we do have the default.
R3#p 4.4.4.4 so l0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
Packet sent with a source address of 3.3.3.3
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/8 ms
R3#p 5.5.5.5 so l0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
Packet sent with a source address of 3.3.3.3
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
R3#
Look at that, we have full connectivity.
So, what does the DMVPN mapping look like?
R3#sh dmvpn
Legend: Attrb –> S – Static, D – Dynamic, I – Incomplete
N – NATed, L – Local, X – No Socket
# Ent –> Number of NHRP entries with same NBMA peer
NHS Status: E –> Expecting Replies, R –> Responding
UpDn Time –> Up or Down Time for a Tunnel
================================================

Interface: Tunnel0, IPv4 NHRP Details
Type:Spoke, NHRP Peers:1,
# Ent  Peer NBMA Addr Peer Tunnel Add State  UpDn Tm Attrb
—– ————— ————— —– ——– —–
1   150.1.254.254    192.168.11.1    UP 01:10:59     S
R3#
Just one connection – the hub.  This is because ODR only has a default pointing to the hub router, so all traffic flows through the hub router.

ODR is a curious protocol, that is for sure!  

Wednesday, June 1, 2016

IPsec with DMVPN



!1-configure the policy and pre-share
!
crypto isakmp policy 1
 encr 3des
 hash md5
 authentication pre-share
 group 2
crypto isakmp key cisco address 0.0.0.0
!
!2-configure ipsec transform-set
!
crypto ipsec transform-set TUNNEL_PROTECTION ah-md5-hmac esp-3des
 mode transport
!
!3-configure  ipsec profile
!
crypto ipsec profile TUNNEL_PROFILE
 set transform-set TUNNEL_PROTECTION
!
!4-Apply the  ipsec profile inside the tunnle
!
interface Tunnel0
 tunnel protection ipsec profile TUNNEL_PROFILE
!


NOTE : For security reasons and to provide more protect , the addess of DMVPN peers should be more more specific when you configure  ISAKMP 

Tuesday, May 31, 2016

cisco BGP confederation

configuration
!AS100
!R10
interface Loopback0
 ip address 10.10.10.10 255.255.255.255
!
interface Loopback1
 ip address 10.10.10.1 255.255.255.255
!
interface Loopback2
 ip address 10.10.10.2 255.255.255.255
!
interface Loopback3
 ip address 10.10.10.3 255.255.255.255
!
interface Loopback4
 ip address 10.10.10.4 255.255.255.255
!
interface Loopback5
 ip address 10.10.10.5 255.255.255.255
!
interface Serial3/0
 ip address 100.1.1.1 255.255.255.252
 serial restart-delay 0
!
router bgp 100
 bgp log-neighbor-changes
 network 100.1.1.0 mask 255.255.255.252
 redistribute connected route-map BGP
 neighbor 100.1.1.2 remote-as 500
!
ip access-list standard BGP
 permit 10.10.10.0 0.0.0.255
!
route-map BGP permit 10
 match ip address BGP

!AS200
!R11
interface Loopback0
 ip address 11.11.11.11 255.255.255.255
!
interface Loopback1
 ip address 11.11.11.1 255.255.255.255
!
interface Loopback2
 ip address 11.11.11.2 255.255.255.255
!
interface Loopback3
 ip address 11.11.11.3 255.255.255.255
!
interface Loopback4
 ip address 11.11.11.4 255.255.255.255
!
interface Loopback5
 ip address 11.11.11.5 255.255.255.255
!
interface Serial3/0
 ip address 200.1.1.1 255.255.255.252
 serial restart-delay 0
!
router bgp 200
 bgp log-neighbor-changes
 network 200.1.1.0 mask 255.255.255.252
 redistribute connected route-map BGP
 neighbor 200.1.1.2 remote-as 500
!

ip access-list standard BGP
 permit 11.11.11.0 0.0.0.255
!
route-map BGP permit 10
 match ip address BGP

!AS300
!R12

interface Loopback0
 ip address 12.12.12.12 255.255.255.255
!
interface Loopback1
 ip address 12.12.12.1 255.255.255.255
!
interface Loopback2
 ip address 12.12.12.2 255.255.255.255
!
interface Loopback3
 ip address 12.12.12.3 255.255.255.255
!
interface Loopback4
 ip address 12.12.12.4 255.255.255.255
!
interface Loopback5
 ip address 12.12.12.5 255.255.255.255
!
interface Serial3/0
 ip address 150.1.1.1 255.255.255.252
 serial restart-delay 0
!
router bgp 300
 bgp log-neighbor-changes
 network 150.1.1.0 mask 255.255.255.252
 redistribute connected route-map BGP
 neighbor 150.1.1.2 remote-as 500
!
ip access-list standard BGP
 permit 12.12.12.0 0.0.0.255
!
route-map BGP permit 10
 match ip address BGP


!AS500
!AS64512
!R1
interface Ethernet1/0
 ip address 10.1.1.1 255.255.255.252
 duplex full
!
interface Ethernet1/1
 ip address 10.1.1.5 255.255.255.252
 duplex full
!
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
!
router bgp 64512
 bgp cluster-id 1
 bgp log-neighbor-changes
 bgp confederation identifier 500
 bgp confederation peers 64514
 neighbor 10.1.0.2 remote-as 64514
 neighbor 10.1.1.2 remote-as 64512
 neighbor 10.1.1.2 route-reflector-client
 neighbor 10.1.1.6 remote-as 64512
 neighbor 10.1.1.6 route-reflector-client
!
!R2
!
interface Ethernet1/0
 ip address 10.1.1.2 255.255.255.252
 duplex full
!
interface Serial3/1
 ip address 10.1.0.5 255.255.255.252
 serial restart-delay 0
!
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
!
router bgp 64512
 bgp log-neighbor-changes
 bgp confederation identifier 500
 bgp confederation peers 64513
 neighbor 10.1.0.6 remote-as 64513
 neighbor 10.1.1.1 remote-as 64512
!

!R3
interface Ethernet1/1
 ip address 10.1.1.6 255.255.255.252
 duplex full
!
interface Serial3/0
 ip address 100.1.1.2 255.255.255.252
 serial restart-delay 0
!
router ospf 1
 passive-interface Serial3/0
 network 0.0.0.0 255.255.255.255 area 0
!
router bgp 64512
 bgp log-neighbor-changes
 bgp confederation identifier 500
 neighbor 10.1.1.5 remote-as 64512
 neighbor 100.1.1.1 remote-as 100
!

!AS64513
!R4

!
interface Ethernet1/0
 ip address 10.1.2.1 255.255.255.252
 duplex full
!
interface Ethernet1/1
 ip address 10.1.2.5 255.255.255.252
 duplex full
!
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
!
router bgp 64513
 bgp cluster-id 2
 bgp log-neighbor-changes
 bgp confederation identifier 500
 bgp confederation peers 64512
 neighbor 10.1.0.5 remote-as 64512
 neighbor 10.1.2.2 remote-as 64513
 neighbor 10.1.2.2 route-reflector-client
 neighbor 10.1.2.6 remote-as 64513
 neighbor 10.1.2.6 route-reflector-client
!

!R5 

!
interface Ethernet1/0
 ip address 10.1.2.2 255.255.255.252
 duplex full
!
interface Serial3/0
 ip address 200.1.1.2 255.255.255.252
 serial restart-delay 0
!
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
!
router bgp 64513
 bgp log-neighbor-changes
 bgp confederation identifier 500
 neighbor 10.1.2.1 remote-as 64513
 neighbor 200.1.1.1 remote-as 200
!

!R6

!
interface Ethernet1/1
 ip address 10.1.2.6 255.255.255.252
 duplex full
!
interface Serial3/1
 ip address 10.1.0.10 255.255.255.252
 serial restart-delay 0
!
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
!
router bgp 64513
 bgp log-neighbor-changes
 bgp confederation identifier 500
 bgp confederation peers 64514
 neighbor 10.1.0.9 remote-as 64514
 neighbor 10.1.2.5 64513

!AS6414
!R7

!
interface Ethernet1/0
 ip address 10.1.3.5 255.255.255.252
 duplex full
!
interface Ethernet1/1
 ip address 10.1.3.1 255.255.255.252
 duplex full
!
interface Serial3/1
 ip address 10.1.0.2 255.255.255.252
 serial restart-delay 0
!
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
!
router bgp 64514
 bgp cluster-id 3
 bgp log-neighbor-changes
 bgp confederation identifier 500
 bgp confederation peers 64512
 neighbor 10.1.0.1 remote-as 64512
 neighbor 10.1.3.2 remote-as 64514
 neighbor 10.1.3.2 route-reflector-client
 neighbor 10.1.3.6 remote-as 64514
 neighbor 10.1.3.6 route-reflector-client
!

!R8

!
interface Ethernet1/0
 ip address 10.1.3.6 255.255.255.252
 duplex full
!
interface Serial3/0
 ip address 150.1.1.2 255.255.255.252
 serial restart-delay 0
!
router ospf 1
 passive-interface Serial3/0
 network 0.0.0.0 255.255.255.255 area 0
!
router bgp 64514
 bgp log-neighbor-changes
 bgp confederation identifier 500
 neighbor 10.1.3.5 remote-as 64514
 neighbor 150.1.1.1 remote-as 300
!

!R9 


interface Ethernet1/1
 ip address 10.1.3.2 255.255.255.252
 duplex full
!
interface Serial3/1
 ip address 10.1.0.9 255.255.255.252
 serial restart-delay 0
!
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
!
router bgp 64514
 bgp log-neighbor-changes
 bgp confederation identifier 500
 bgp confederation peers 64513
 neighbor 10.1.0.10 remote-as 64513
 neighbor 10.1.3.1 remote-as 64514
!