5 , configuring the routing capability of the switch
Note: Routing is only available on a three-layer switch, and other two-tier access switches are not allowed to transfer data between different VLANs until the routing is switched through the trunk port to the core switch .
TEST (config) #ip Routing # enables the routing function of the three layer switch, which is turned off by default
TEST (config) #ip Route 0.0.0.0 0.0.0.0 172.16.0.1
# Configure the default route for the switch, which is the total egress route.
Test (config) #end # Exit Verify the configuration you just made
Test#sh IP Rouet
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 type1, N2-OSPF NSSA External type2E1-OSPF External type1, E2-OSPF external type2EEGP i-Is-is, Su-is-is summary, L1-is-is level-1, L2-is-is level-2ia-Is-is Inter area, *-candidatedefault, U-per-userStaticRoute o-ODR, P-periodic downloadedStaticRoute Gateway of last resort is 172.16.0.1To Network0.0.0.0C192.168.106.0/ - isdirectly connected, vlan60# this type of route-a route marked "C", is a static direct-attached route. C192.168.107.0/ - isdirectly connected, vlan70c192.168.104.0/ - isdirectly connected, vlan40c192.168.105.0/ - isdirectly connected, vlan50c192.168.110.0/ - isdirectly connected, vlan100c192.168.111.0/ - isdirectly connected, vlan110c192.168.108.0/ - isdirectly connected, Vlan80172.16.0.0/ - issubnetted,1SUBNETSC172.16.0.0 isdirectly connected, vlan2c192.168.115.0/ - isdirectly connected, vlan160c192.168.113.0/ - isdirectly connected, vlan1c192.168.112.0/ - isdirectly connected, vlan120c192.168.102.0/ - isdirectly connected, vlan20c192.168.103.0/ - isdirectly connected, vlan30c192.168.100.0/ - isdirectly connected, vlan150c192.168.101.0/ - isdirectly connected, vlan10s*0.0.0.0/0[1/0] via172.16.0.1# Default route for configuration
test#
6 , configure the switch DHCP function
test#sh IP int b # Show all port configurations first
Interface ip-address OK?Method Status ProtocolFastEthernet1 unassigned YES NVRAM down V Lan1192.168.113.254YES NVRAM up Vlan2172.16.0.2YES NVRAM up Vlan10192.168.101.254YES NVRAM up Vlan20192.168.102.254YES NVRAM up Vlan30192.168.103.254YES NVRAM up Vlan40192.168.104.254YES NVRAM up Vlan50192.168.105.254YES NVRAM up Vlan60192.168.106.254YES NVRAM up Vlan70192.168.107.254YES NVRAM up Vlan80192.168.108.254YES NVRAM up Vlan100192.168.110.254YES NVRAM up Vlan110192.168.111.254YES NVRAM up Vlan120192.168.112.254YES NVRAM up up# In this example we want VLAN120 to provide DHCP functionality Vlan150192.168.100.254YES NVRAM up Vlan160192.168.115.254YES NVRAM up GigabitEthernet1/1unassigned YES unset up GigabitEthernet1/2unassigned YES unset down GigabitEthernet1/3unassigned YES unset down GigabitEthernet1/4unassigned YES unset down GigabitEthernet1/5unassigned YES unset down GigabitEthernet1/6unassigned YES unset down GigabitEthernet1/7unassigned YES unset down GigabitEthernet1/8unassigned YES unset down GigabitEthernet1/9unassigned YES unset down GigabitEthernet1/Tenunassigned YES unset down GigabitEthernet1/ Oneunassigned YES unset down GigabitEthernet1/ Aunassigned YES unset down GigabitEthernet1/ -unassigned YES unset down GigabitEthernet1/ -unassigned YES unset down GigabitEthernet1/ theunassigned YES unset up GigabitEthernet1/ -unassigned YES unset down GigabitEthernet1/ -unassigned YES unset down GigabitEthernet1/ -unassigned YES unset down GigabitEthernet1/ +unassigned YES unset down GigabitEthernet1/ -unassigned YES unset down GigabitEthernet3/1unassigned YES unset up GigabitEthernet3/2unassigned YES unset up GigabitEthernet3/3unassigned YES unset up GigabitEthernet3/4unassigned YES unset up GigabitEthernet3/5unassigned YES unset up GigabitEthernet3/6unassigned YES unset up GigabitEthernet3/7unassigned YES unset up GigabitEthernet3/8Unassigned YES unset up
test#
Test#conf T
Enter configuration commands, one per line. End with cntl/z.
TEST (config) #IP dhcp pool WLAN # Configure the Switch's address pool and name
TEST (config) # network192.168.112.0 255.255.255.0 # defines the network segment for this address pool
TEST (config) #default-router 192.168.112.254 # defines the default gateway for addresses to be distributed
TEST (config) #dns-server 202.102.128.68 202.102.134.68
# define the DNS server where the addresses are distributed, where 2 are separated by a space.
TEST (config) #ip dhcp excluded-address 192.168.112.200 192.168.112.254
# defines the reserved IP address end
TEST (Dhcp-config) #end
Test#sh Run
# #小结一下: The client that belongs to this VLAN can get the correct IP, gateway, DNS and other information by automatically acquiring the address.
Cisco's basic configuration instance of the five----switch routing features and DHCP capabilities