Network Requirements
- IP Network1 and IP Network2 are two private networks for Device1 and Device3, respectively.
- IP Network1 communicates with IP Network2 through the IPIP tunnel between Device1 and Device3.
Network Topology
Figure 10-1 Networking of configuring the IPIP basic function
Configuration Steps
Step 1: Configure VLAN, and add the port to the corresponding VLAN. (omitted)
Step 2: Configure the IP addresses for all interfaces. (Omitted)
Step 3: Configure the OSPF.
#Configure Device1.
Device1#configure terminal
Device1(config)#router ospf 100
Device1(config-ospf)#network 1.0.0.0 0.0.0.255 area 0
Device1(config-ospf)#exit
|
#Configure Device2.
Device2#configure terminal
Device2(config)#router ospf 100
Device2(config-ospf)#network 1.0.0.0 0.0.0.255 area 0
Device2(config-ospf)#network 2.0.0.0 0.0.0.255 area 0
Device2(config-ospf)#exit
|
#Configure Device3.
Device3#configure terminal
Device3(config)#router ospf 100
Device3(config-ospf)#network 2.0.0.0 0.0.0.255 area 0
Device3(config-ospf)#exit
|
#View the routing table of Device3.
Device3#show ip route
Codes: C - connected, S - static, R - RIP, O - OSPF, OE-OSPF External, M - Management
D - Redirect, E - IRMP, EX - IRMP external, o - SNSP, B - BGP, i-ISIS
Gateway of last resort is not set
O 1.0.0.0/24 [110/65536] via 2.0.0.1, 00:18:40, vlan2
C 2.0.0.0/24 is directly connected, 00:22:27, vlan2
C 192.168.100.0/24 is directly connected, 00:00:28, vlan3
-
Device1 and Device2 are viewed in the same way as Device3. The viewing process is omitted.
Step 4: Configure the IPIP tunnel.
#Configure the IPIP tunnel, tunnel1 on Device1 with source IP address as 1.0.0.1, destination IP address as 2.0.0.2, and the IP address as 10.0.0.1.
Device1(config)#interface tunnel 1
Device1(config-if-tunnel1)#tunnel mode ipip
Device1(config-if-tunnel1)#tunnel source 1.0.0.1
Device1(config-if-tunnel1)#tunnel destination 2.0.0.2
Device1(config-if-tunnel1)#ip address 10.0.0.1 255.255.255.0
Device1(config-if-tunnel1)#exit
|
#Configure the IPIP tunnel, tunnel1 on Device3 with source IP address as 2.0.0.2, destination IP address as 1.0.0.1, and the IP address as 10.0.0.2.
Device3(config)#interface tunnel 1
Device3(config-if-tunnel1)#tunnel mode ipip
Device3(config-if-tunnel1)#tunnel source 2.0.0.2
Device3(config-if-tunnel1)#tunnel destination 1.0.0.1
Device3(config-if-tunnel1)#ip address 10.0.0.2 255.255.255.0
Device3(config-if-tunnel1)#exit
|
#View the IPIP tunnel information of Device3.
Device3#show tunnel 1 Tunnel 1:
Tunnel mode is ipip
Source ipv4 address is 2.0.0.2(Source ipv4 address is up on source interface vlan2)
Destination ipv4 address is 1.0.0.1
Tunnel state is up
Encapsulation vrf is global(0x0)
TTL(time-to-live) is 255
TOS(type of service) is not set total(1)
-
Device1 is viewed in the same way as Device3. The viewing process is omitted.
- When the tunnel does not exist in the same network segment, devices at the both ends of the tunnel are configured with a static routing to the peer end. And the outbound interface is the tunnel interface.
Step 5: Configure the static route.
#On Device1, configure the static route to the egress interface tunnel1 of IP Network2.
Device1(config)#ip route 192.168.100.0 255.255.255.0 tunnel1
|
#On Device3, configure the static route to the egress interface tunnel1 of IP Network1.
Device3(config)#ip route 192.168.1.0 255.255.255.0 tunnel1
|
#View the route table of Device3.
Device3#show ip route
Codes: C - connected, S - static, R - RIP, O - OSPF, OE-OSPF External, M - Management
D - Redirect, E - IRMP, EX - IRMP external, o - SNSP, B - BGP, i-ISIS
Gateway of last resort is not set
O 1.0.0.0/24 [110/65536] via 2.0.0.1, 00:43:30, vlan2
C 2.0.0.0/24 is directly connected, 00:47:17, vlan2
C 10.0.0.0/24 is directly connected, 00:17:12, tunnel1
S 192.168.1.0/24 [1/100000] is directly connected, 00:00:10, tunnel1
- Device1 is viewed in the same way as Device3. The viewing process is omitted.