A VLAN is a switched network that is logically segmented by function, project team, or application, without regard to the physical locations of the users. VLANs have the same attributes as physical LANs, but you can group end stations even if they are not physically located on the same LAN segment. Any switch port can belong to a VLAN, and unicast, broadcast, and multicast packets are forwarded and flooded only to end stations in the VLAN. Each VLAN is considered a logical network, and packets destined for stations that do not belong to the VLAN must be forwarded through a router or a switch supporting fallback bridging, as shown in Figure 13-1. Because a VLAN is considered a separate logical network, it contains its own bridge Management Information Base (MIB) information and can support its own implementation of spanning tree. Source
Network Diagram of the Lab (Without DIR655 Router)
Switch#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#hostname cloud20 cloud20(config)#end
This enables the L3 switch capable of routing.
cloud20#enable cloud20#configure terminal Enter configuration commands, one per line. End with CNTL/Z. cloud20(config)#ip routing cloud20(config)#end
Check the configuration and look for 'ip routing' in running-configuration
#Verify routing is enabled. cloud20#show running-config Building configuration... Current configuration : 1319 bytes ! version 12.2 no service pad service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname cloud20 ! boot-start-marker boot-end-marker ! ! no aaa new-model system mtu routing 1500 ip subnet-zero ip routing ! ! ! !
Configure the static ip address.
cloud20#configure terminal Enter configuration commands, one per line. End with CNTL/Z. cloud20(config)#interface fastEthernet0/2 cloud20(config-if)#no switchport cloud20(config-if)#ip address 192.168.2.20 255.255.255.0 cloud20(config-if)#no shutdown cloud20(config-if)#end
Add static route with the gateway ip/R7000v2
cloud20(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.1 #Verify the connectivity cloud20#ping 8.8.8.8 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 8/11/17 ms
Configure VLAN with the RFC1918 IP address. Subnet
baburaj@Aurora-4:~\> ipcalc 10.32.0.0/11 Address: 10.32.0.0 00001010.001 00000.00000000.00000000 Netmask: 255.224.0.0 = 11 11111111.111 00000.00000000.00000000 Wildcard: 0.31.255.255 00000000.000 11111.11111111.11111111 => Network: 10.32.0.0/11 00001010.001 00000.00000000.00000000 HostMin: 10.32.0.1 00001010.001 00000.00000000.00000001 HostMax: 10.63.255.254 00001010.001 11111.11111111.11111110 Broadcast: 10.63.255.255 00001010.001 11111.11111111.11111111 Hosts/Net: 2097150 Class A, Private Internet cloud20#configure terminal Enter configuration commands, one per line. End with CNTL/Z. cloud20(config)#interface vlan12 cloud20(config-if)#ip address 10.32.0.1 255.224.0.0 cloud20(config-if)#no shutdown cloud20(config-if)#end cloud20#
Assign VLAN to Port.
cloud20#configure terminal Enter configuration commands, one per line. End with CNTL/Z. cloud20(config)#interface fastEthernet0/12 cloud20(config-if)#switchport access vlan 12
Verify interfaces and routes.
cloud20#show ip interface brief Interface IP-Address OK? Method Status Protocol Vlan1 unassigned YES manual up down Vlan12 10.32.0.1 YES manual up up FastEthernet0/1 unassigned YES unset down down FastEthernet0/2 192.168.2.20 YES manual up up FastEthernet0/3 unassigned YES unset down down ... FastEthernet0/12 unassigned YES unset up up... #Check the route. cloud20#show 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.2.1 to network 0.0.0.0 10.0.0.0/11 is subnetted, 1 subnets C 10.32.0.0 is directly connected, Vlan12 C 192.168.2.0/24 is directly connected, FastEthernet0/2 S* 0.0.0.0/0 [1/0] via 192.168.2.1
Change the interface IP address on the target server and restart network service.
root@mayura:/etc/sysconfig/network-scripts\> ip addr show enp7s0 2: enp7s0:mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:1f:bc:02:6f:10 brd ff:ff:ff:ff:ff:ff inet 10.32.0.20/11 brd 10.63.255.255 scope global enp7s0 valid_lft forever preferred_lft forever inet6 fe80::21f:bcff:fe02:6f10/64 scope link valid_lft forever preferred_lft forever #Verify the IP is reachable. cloud20#ping 10.32.0.10 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.32.0.10, timeout is 2 seconds: ..... Success rate is 0 percent (0/5) #Since the default route is on the GTWY IP, add a static route on the interface assigned with the IP. ip route 10.0.0.0 255.224.0.0 10.32.0.20 #Verify the reachability via ping. cloud20#ping 10.32.0.20 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.32.0.20, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/9 ms root@mayura:/etc/sysconfig/network-scripts\> ping 10.32.0.1 PING 10.32.0.1 (10.32.0.1) 56(84) bytes of data. 64 bytes from 10.32.0.1: icmp_seq=1 ttl=255 time=1.44 ms 64 bytes from 10.32.0.1: icmp_seq=2 ttl=255 time=1.38 ms #Save configuration cloud20#copy running-config startup-config Destination filename [startup-config]? Building configuration... [OK]
Steps in high-level for Cloud10, similar to above for most part.
baburaj@Aurora-4:~\> ipcalc 10.16.0.0/12 Address: 10.16.0.0 00001010.0001 0000.00000000.00000000 Netmask: 255.240.0.0 = 12 11111111.1111 0000.00000000.00000000 Wildcard: 0.15.255.255 00000000.0000 1111.11111111.11111111 => Network: 10.16.0.0/12 00001010.0001 0000.00000000.00000000 HostMin: 10.16.0.1 00001010.0001 0000.00000000.00000001 HostMax: 10.31.255.254 00001010.0001 1111.11111111.11111110 Broadcast: 10.31.255.255 00001010.0001 1111.11111111.11111111 Hosts/Net: 1048574 Class A, Private Internet #Configure hostname,enable routing,add static routes. Refer steps for cloud20 (above) #Configure static routing. cloud10#configure terminal cloud10(config)#interface fastEthernet0/1 cloud10(config-if)#no switchport cloud10(config-if)#ip address 192.168.2.10 255.255.255.0 cloud10(config-if)#no shutdown cloud10(config-if)#end cloud10# #Configure VLAN10 cloud10(config)#interface vlan10 cloud10(config-if)#ip address 10.16.0.1 255.240.0.0 cloud10(config-if)#no shutdown cloud10(config-if)#end cloud10# #Assign port to VLAN. cloud10#configure terminal Enter configuration commands, one per line. End with CNTL/Z. cloud10(config)#interface fastEthernet0/10 cloud10(config-if)#switchport access vlan 10 cloud10(config-if)#end #Add static route with next-hop for 10.* subnet via backend interface. cloud10#configure terminal Enter configuration commands, one per line. End with CNTL/Z. cloud10(config)#ip route 10.0.0.0 255.224.0.0 10.16.0.10 cloud10(config)#end cloud10#ping 8.8.8.8 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 8/11/17 ms cloud10#ping 10.16.0.10 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.16.0.10, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/8 ms
How the subnets were chosen!
baburaj@Aurora-4:~\> ipcalc 10.0.0.0/8 -s 1000000 Address: 10.0.0.0 00001010. 00000000.00000000.00000000 Netmask: 255.0.0.0 = 8 11111111. 00000000.00000000.00000000 Wildcard: 0.255.255.255 00000000. 11111111.11111111.11111111 => Network: 10.0.0.0/8 00001010. 00000000.00000000.00000000 HostMin: 10.0.0.1 00001010. 00000000.00000000.00000001 HostMax: 10.255.255.254 00001010. 11111111.11111111.11111110 Broadcast: 10.255.255.255 00001010. 11111111.11111111.11111111 Hosts/Net: 16777214 Class A, Private Internet 1. Requested size: 1000000 hosts Netmask: 255.240.0.0 = 12 11111111.1111 0000.00000000.00000000 Network: 10.0.0.0/12 00001010.0000 0000.00000000.00000000 HostMin: 10.0.0.1 00001010.0000 0000.00000000.00000001 HostMax: 10.15.255.254 00001010.0000 1111.11111111.11111110 Broadcast: 10.15.255.255 00001010.0000 1111.11111111.11111111 Hosts/Net: 1048574 Class A, Private Internet Needed size: 1048576 addresses. Used network: 10.0.0.0/12 Unused: 10.16.0.0/12 10.32.0.0/11 10.64.0.0/10 10.128.0.0/9
Network Diagram of this configuration.
VLAN logically creates broadcast domains on the L2 network, so a switch can send traffic only within the same broadcast domain, in otherwords one VLAN. To communicate to devices in other broad cast domain essentially a router is required. Switch Virtual Interface is nothing but acts on Layer-3 to get this routing done, so that an inter VLAN routing is possible. So VLAN on L2 layer keeps traffic within its own broad cast domain, but to send the traffic to other VLAN's a mechanism is required to route the traffic between these two VLAN's on the L3 layer. This is where SVI comes in, with SVIs the switch recognizes the packet destinations that are local to the sending VLAN and switches those packets and packets destined for different VLANs are routed. A VLAN is mapped usually to one SVI, also unless the VLAN is created there will be no spanning tree instance running hence the line protocol will be down for the SVI VLAN. Source : Cisco Learning Network.
# Already L3 enabled. ip routing # Create VLAN2 cloud10>enable cloud10#configure terminal Enter configuration commands, one per line. End with CNTL/Z. cloud10(config)#vlan 2 cloud10(config-vlan)#name servers cloud10(config-vlan)#exit cloud10(config)# # Assign the physical interface to this VLAN. cloud10(config)#interface fa0/10 cloud10(config-if)#switchport access vlan 2 Command rejected: Fa0/10 not a switching port. cloud10(config-if)#switchport cloud10(config-if)#switchport access vlan 2 cloud10(config-if)#end cloud10# # Configure Switch Vlan Interfaces (SVI) cloud10(config)#interface vlan 2 cloud10(config-if)# *Mar 1 04:00:11.183: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan2, changed state to up cloud10(config-if)#ip address 10.0.1.1 255.255.255.0 cloud10(config-if)#no shutdown cloud10(config-if)#exit #Do similar steps for Cloud20 and assign an IP address (same subnet.) cloud20#configure terminal Enter configuration commands, one per line. End with CNTL/Z. cloud20(config)#interface vlan 2 cloud20(config-if)# *Mar 1 04:07:02.166: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan2, changed state to up cloud20(config-if)#ip address 10.0.1.2 255.255.255.0 cloud20(config-if)#no shutdown cloud20(config-if)#exit #Configure trunk. cloud10#configure terminal Enter configuration commands, one per line. End with CNTL/Z. cloud10(config)#interface fa0/13 cloud20(config-if)#switchport trunk encapsulation dot1q cloud10(config-if)#switchport mode trunk cloud10(config-if)#no shutdown cloud10(config-if)#end cloud10# # Verify trunk mode. cloud10#show interfaces fa0/13 switchport Name: Fa0/13 Switchport: Enabled Administrative Mode: trunk Operational Mode: trunk Administrative Trunking Encapsulation: dot1q Operational Trunking Encapsulation: dot1q Negotiation of Trunking: On Access Mode VLAN: 2 (servers) Trunking Native Mode VLAN: 2 (servers) Administrative Native VLAN tagging: enabled Voice VLAN: none Administrative private-vlan host-association: none Administrative private-vlan mapping: none Administrative private-vlan trunk native VLAN: none Administrative private-vlan trunk Native VLAN tagging: enabled Administrative private-vlan trunk encapsulation: dot1q Administrative private-vlan trunk normal VLANs: none Administrative private-vlan trunk associations: none Administrative private-vlan trunk mappings: none Operational private-vlan: none Trunking VLANs Enabled: ALL Pruning VLANs Enabled: 2-1001 Capture Mode Disabled cloud10#show interface fa0/13 trunk Port Mode Encapsulation Status Native vlan Fa0/13 on 802.1q trunking 1 Port Vlans allowed on trunk Fa0/13 1-4094 Port Vlans allowed and active in management domain Fa0/13 1-2 Port Vlans in spanning tree forwarding state and not pruned Fa0/13 1-2 #Verify reachability. cloud20#ping 8.8.8.8 so 10.0.0.20 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds: Packet sent with a source address of 10.0.0.20 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 8/15/34 ms cloud20#ping 8.8.8.8 so 10.0.1.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds: Packet sent with a source address of 10.0.1.2 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 8/13/17 ms loud10#ping 8.8.8.8 so 10.0.0.10 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds: Packet sent with a source address of 10.0.0.10 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 8/10/16 ms cloud10# cloud10#ping 8.8.8.8 so 10.0.1.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds: Packet sent with a source address of 10.0.1.1 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 8/10/17 ms cloud10# cloud10#copy running-config startup-config Destination filename [startup-config]? Building configuration... [OK]