As can be seen, we can not configure the port to be a Trunk if it is in the Auto encapsulation. First we need to set the encapsulation to dot1q.
Here is the show run output:
switchport trunk encapsulation dot1q
switchport mode trunk
On the router, enable to fa0/0 interface with the no shutdown command. Verify the status of the Trunk on the switch.
Switch#sh int trunk
Port Vlans allowed on trunk
Port Vlans allowed and active in management domain
Port Vlans in spanning tree forwarding state and not pruned
Step 3) Configure the router
We have multiple vlan traffic destined to the router (Default Gateway) being carried over the Trunk interface. We need to support multiple default gateways, but only have one interface. The solution here is to use sub-interfaces in a topology known as “Router on a Stick”.
Hint:IP addressed are assigned on the sub-interfaces and not the physical interface
%LINK-5-CHANGED: Interface FastEthernet0/0.40, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.40, changed state to up
R1(config-subif)#description Default Gateway for DATA vlan 40
R1(config-subif)#encapsulation dot1Q 40
R1(config-subif)#ip add 10.40.0.1 255.255.255.0
%LINK-5-CHANGED: Interface FastEthernet0/0.41, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.41, changed state to up
% Configuring IP routing on a LAN subinterface is only allowed if that
subinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q,
or ISL vLAN.
R1(config-subif)#encapsulation dot1Q 41
R1(config-subif)#ip add 10.41.0.1 255.255.255.0
%LINK-5-CHANGED: Interface FastEthernet0/0.45, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.45, changed state to up
R1(config-subif)#description Default Gateway for VOICE vlan 45
R1(config-subif)#encapsulation dot1Q 45
R1(config-subif)#ip add 10.45.0.1 255.255.255.0
%SYS-5-CONFIG_I: Configured from console by console
NOTE 1: We first must identify which vlan the sub-interface belong to by using the encapsulation dot1Q command. The sub-interface number (i.e. fa0/0.XX) does not have to match the vlan ID ( it can be any number); however, the encapsulation dot1Q command must correctly match with the vlan ID. NOTE 2: The ip address of the sub-interface is the Default Gateway address of that vlan. Here is the show run:
interface FastEthernet0/0 (Note the is no ip address assigned to the physical interface)
no ip address
description Default Gateway for DATA vlan 40
encapsulation dot1Q 40 (must match the vlan id)
ip address 10.40.0.1 255.255.255.0 (Default Gateway of DATA vlan 40)
description Default Gateway for Management vlan 41
encapsulation dot1Q 41
ip address 10.41.0.1 255.255.255.0
description Default Gateway for VOICE vlan 45
encapsulation dot1Q 45
ip address 10.45.0.1 255.255.255.0
Here is the output of the show ip int brief command
R1#sh ip int br]
The out of show ip route
R1#sh ip route
Codes: C – connected, S – static, I – IGRP, 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, E – EGP
i – IS-IS, 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
10.0.0.0/24 is subnetted, 3 subnets
C 10.40.0.0 is directly connected, FastEthernet0/0.40
C 10.41.0.0 is directly connected, FastEthernet0/0.41
C 10.45.0.0 is directly connected, FastEthernet0/0.45
Step 4) Configure DHCP server on the Router
When configuring the DHCP server on the router, make sure you exclude the static ip address range first. We do not want the server to hand out static ip address range. Also, for voice applications, option 150 must be configured. This option point to the tftp server for Cisco Call Manager Express. Hint:make use of the ios help feature by using ?, i.e. ip dhcp ?
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#ip dhcp ?
excluded-address Prevent DHCP from assigning certain addresses
Step 5) Test Devices for correct ip address assignment from DHCP
At this time, we need to make sure that our devices, namely the phones and host computers, are assigned correct ip addresses. This can be achieved by checking if the DHCP server has handed out ip address, namely check for IP address to Mac address binding.