configure ip static routes - microchip...
TRANSCRIPT
Application Note ENT-AN1113
Configure IP Static Routes
An IP address identifies a device on an IP network. The IP version 4 (IPv4) address is 32 bits long. AnIPv4 address can only be assigned through a VLAN interface. The address can be set manually (called astatic IP) or automatically by using the DHCP protocol. For more information, see Configure the DHCPClient. The switch application software implements software to handle static IPv4 routing.
Table of Contents
Traditional NetworkRouting involves both a TCP/IP host and an IP router. The following illustration shows the configurationfor a traditional network with two IP networks and a router. Each IP network needs to have an IP addressassigned and a gateway where packets can be forwarded to.
Traditional Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1Using a VLAN-Aware Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2Using a Layer 3 Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2Configuration using ICLI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2Configuration using the WebGUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3Connecting Two L3 Switches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4Configuration of the Left Switch using the WebGUI . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Figure 1 • IP Routing using a Router and Switches
Router
Interface A10.0.1.1/24
No-config
IP: 10.0.1.2/24GW: 10.0.1.1
L2-switch
HOSTA
HOSTB
L2-switch
Interface B10.0.2.1/24
No-config
IP: 10.0.2.2/24GW: 10.0.2.1
July 2015 1
© 2015 Microsemi Corporation
Configure IP Static Routes Configure IP Static Routes
Using a VLAN-Aware SwitchThe following illustration shows the same network configured to use a VLAN-aware switch. Using VLANsis a method of separating flows within the same switch.
Using a Layer 3 SwitchThe following illustration shows the same network configured to use an L3 switch.
IP routing is fundamentally a destination-driven process. All frames that enter the router are inspected todetermine the destination IP address. Based on that address the router looks up the routing table todetermine where to send the frame.
Configuration using ICLIThe following steps implement the configurations using the command line interface.
1. Step 1: Create VLAN 1001 and 1002 to separate the two IP networks
Switch# configure terminalSwitch(config)# vlan 1001Switch(config-vlan)# vlan 1002Switch(config-vlan)# exit
Figure 2 • IP Routing using a Router and VLAN-Aware Switch
Router
L2-switch
HOSTA
HOSTB
IP: 10.0.1.2/24GW: 10.0.1.1
VLAN: 1001PVID: 1001
Interface A10.0.1.1/24
IP: 10.0.2.2/24GW: 10.0.2.1
VLAN: 1002PVID: 1002
Interface B10.0.2.1/24
Figure 3 • IP Routing using a Router and L3 Switch
L3-switch
Router leg A:IP: 10.0.1.1/24
VLAN: 1001
Router leg B:IP: 10.0.2.1/24
VLAN: 1002
VLAN: 1002PVID: 1002
VLAN: 1001PVID: 1001
IP: 10.0.1.2/24GW: 10.0.1.1 IP: 10.0.2.2/24
GW: 10.0.2.1HOST
AHOST
B
22
Configuration using the WebGUIConfiguration using the WebGUI
2. Step 2: Define the port VLAN for each port by using the switchport access vlan commandto specifiy the VLAN for each interface. Untagged frames are then classified to this VLAN.
Switch(config)# interface GigabitEthernet 1/1Switch(config-if)# switchport access vlan 1001Switch(config-if)# exitSwitch(config)# interface GigabitEthernet 1/2Switch(config-if)# switchport access vlan 1002Switch(config-if)# exit
3. Step 3: Configure router leg A and B by using the ip address command to set primary IPaddress for the interfaces.
Switch(config)# interface vlan 1001Switch(config-if-vlan)# ip address 10.0.1.1 255.255.255.0Switch(config-if-vlan)# exitSwitch(config)# interface vlan 1002Switch(config-if-vlan)# ip address 10.0.2.1 255.255.255.0Switch(config-if-vlan)# end
Configuration using the WebGUIThe following illustration shows the configuration using the web-based interface.
1. Step 1: Create VLAN 1001 and 1002, and define the port VLAN for each port.
Figure 4 • VLAN Port Configuration
33
Configure IP Static Routes Configure IP Static Routes
2. Step 2: Configure router leg A and B to set primary IP address for the interfaces.
Connecting Two L3 SwitchesThe following illustration shows how two L3 switches can be interconnected.
The following steps implement the configurations using the command line interface.
1. Step 1: Create VLAN 100, 1001, and 1002. Set up port VLAN for each port on the left switch.
Switch-left# configure terminal
Figure 5 • Router IP Configuration
Figure 6 • IPv4 Static Route
L3-switch
Route add10.1.0.0/16 via 20.0.0.2
Router leg A:IP: 10.0.1.1/24
VLAN:1001
Router leg B:IP: 10.0.2.1/24
VLAN:1002
Router leg C:IP: 20.0.0.1/24
VLAN:200
VLAN: 1001PVID: 1001 HOST
AHOST
B
IP: 10.0.2.2/24GW:10.0.2.1
IP: 10.0.1.2/24GW:10.0.1.1
VLAN: 100PVID: 100
VLAN: 1002PVID: 1002
VLAN: 1001PVID: 1001
VLAN: 200PVID: 200
L3-switch
HOST A
HOST B
IP: 10.1.1.2/24GW:10.1.1.1
IP: 10.1.2.2/24GW:10.1.2.1
Route add10.0.0.0/16 via 20.0.0.1
Router leg A:IP: 10.1.1.1/24
VLAN:1001
Router leg B:IP: 10.1.2.1/24
VLAN:1002
Router leg C:IP: 20.0.0.2/24
VLAN: 200
VLAN: 1002PVID: 1002
44
Connecting Two L3 SwitchesConnecting Two L3 Switches
Switch-left(config)# vlan 100Switch-left(config-vlan)# vlan 1001Switch-left(config-vlan)# vlan 1002Switch-left(config-vlan)# exitSwitch-left(config)# interface GigabitEthernet 1/1Switch-left(config-if)# switchport access vlan 1001Switch-left(config-if)# exitSwitch-left(config)# interface GigabitEthernet 1/2Switch-left(config-if)# switchport access vlan 1002Switch-left(config-if)# exitSwitch-left(config)# interface GigabitEthernet 1/8Switch-left(config-if)# switchport access vlan 100Switch-left(config-if)# exit
2. Step 2: Configure router leg A, B, and C to set IP address for each interface on the left switch.
Switch-left(config)# interface vlan 1001Switch-left(config-if-vlan)# ip address 10.0.1.1 255.255.255.0Switch-left(config-if-vlan)# exitSwitch-left(config)# interface vlan 1002Switch-left(config-if-vlan)# ip address 10.0.2.1 255.255.255.0Switch-left(config-if-vlan)# exitSwitch-left(config)# interface vlan 100Switch-left(config-if-vlan)# ip address 20.0.0.1 255.255.255.0Switch-left(config-if-vlan)# exit
3. Step 3: Configure IP route on the left switch by using the ip route command to add a staticroute entry with next-hop set to 20.0.0.2.
Switch-left(config)# ip route 10.1.0.0 255.255.0.0 20.0.0.2Switch-left(config)# end
4. Step 4: Show the static route’s for the left switch.
Switch-left# show ip route0.0.0.0/0 via 10.10.132.1 <UP GATEWAY HW_RT>10.0.1.0/24 via interface index 200001001 <UP HW_RT>10.0.2.0/24 via interface index 200001002 <UP HW_RT>10.1.0.0/16 via 20.0.0.2 <UP GATEWAY HW_RT>10.10.132.0/23 via interface index 200000001 <UP HW_RT>127.0.0.1/32 via 127.0.0.1 <UP HOST>Switch-left#
5. Step 5: Create VLAN 200, 1001, and 1002. Set up port VLAN for each port on the right switch.
Switch-right# configure terminalSwitch-right(config)# vlan 200Switch-right(config-vlan)# vlan 1001Switch-right(config-vlan)# vlan 1002Switch-right(config-vlan)# exitSwitch-right(config)# interface GigabitEthernet 1/1Switch-right(config-if)# switchport access vlan 1001Switch-right(config-if)# exitSwitch-right(config)# interface GigabitEthernet 1/2Switch-right(config-if)# switchport access vlan 1002Switch-right(config-if)# exitSwitch-right(config)# interface GigabitEthernet 1/8Switch-right(config-if)# switchport access vlan 200Switch-right(config-if)# exit
6. Step 6: Configure router leg A, B, and C to set IP address for each interface on the right switch.
Switch-right(config)# interface vlan 1001Switch-right(config-if-vlan)# ip address 10.1.1.1 255.255.255.0Switch-right(config-if-vlan)# exitSwitch-right(config)# interface vlan 1002Switch-right(config-if-vlan)# ip address 10.1.2.1 255.255.255.0
55
Configure IP Static Routes Configure IP Static Routes
Switch-right(config-if-vlan)# exitSwitch-right(config)# interface vlan 200Switch-right(config-if-vlan)# ip address 20.0.0.2 255.255.255.0Switch-right(config-if-vlan)# exit
7. Step 7: Configure IP route on the right switch by using the ip route command to add a staticroute entry with next-hop set to 20.0.0.1.
Switch-right(config)# ip route 10.0.0.0 255.255.0.0 20.0.0.1Switch-right(config)# end
Configuration of the Left Switch using the WebGUIThe following illustration shows the left switch configuration using the web-based interface.
Figure 7 • Left Switch Configuration
66
VPPD-03594. 1.2. July 2015
Microsemi makes no warranty, representation, or guarantee regarding the information contained herein orthe suitability of its products and services for any particular purpose, nor does Microsemi assume anyliability whatsoever arising out of the application or use of any product or circuit. The products soldhereunder and any other products sold by Microsemi have been subject to limited testing and should notbe used in conjunction with mission-critical equipment or applications. Any performance specifications arebelieved to be reliable but are not verified, and Buyer must conduct and complete all performance andother testing of the products, alone and together with, or installed in, any end-products. Buyer shall not relyon any data and performance specifications or parameters provided by Microsemi. It is the Buyer'sresponsibility to independently determine suitability of any products and to test and verify the same. Theinformation provided by Microsemi hereunder is provided “as is, where is” and with all faults, and the entirerisk associated with such information is entirely with the Buyer. Microsemi does not grant, explicitly orimplicitly, to any party any patent rights, licenses, or any other IP rights, whether with regard to suchinformation itself or anything described by such information. Information provided in this document isproprietary to Microsemi, and Microsemi reserves the right to make any changes to the information in thisdocument or to any products and services at any time without notice.
Power Matters.TM
Microsemi Corporation (Nasdaq: MSCC) offers a comprehensive portfolio of semiconductorand system solutions for communications, defense & security, aerospace and industrialmarkets. Products include high-performance and radiation-hardened analog mixed-signalintegrated circuits, FPGAs, SoCs and ASICs; power management products; timing andsynchronization devices and precise time solutions, setting the world's standard for time; voiceprocessing devices; RF solutions; discrete components; security technologies and scalableanti-tamper products; Ethernet solutions; Power-over-Ethernet ICs and midspans; as well ascustom design capabilities and services. Microsemi is headquartered in Aliso Viejo, Calif., andhas approximately 3,600 employees globally. Learn more at www.microsemi.com.
Microsemi Corporate HeadquartersOne Enterprise, Aliso Viejo,CA 92656 USA
Within the USA: +1 (800) 713-4113 Outside the USA: +1 (949) 380-6100Sales: +1 (949) 380-6136Fax: +1 (949) 215-4996E-mail: [email protected]
© 2015 Microsemi Corporation. Allrights reserved. Microsemi and theMicrosemi logo are trademarks ofMicrosemi Corporation. All othertrademarks and service marks are theproperty of their respective owners.