Pages

Friday, April 9, 2010

3 method configuring default route on hub-spoke network - GNS3

dg

  • ip default-network
  • ip route
  • ip default-gateway
this example we’ll use RIP, you can also use EIGRP but not OSPF
prepare the network
R1
interface FastEthernet0/0
ip address 10.1.1.1 255.255.255.0
duplex auto
speed auto
!
interface Serial0/0
ip address 192.168.1.1 255.255.255.0
clock rate 64000
!
interface Serial0/1
ip address 172.16.1.1 255.255.255.0
clock rate 64000
!
router rip
network 172.16.0.0
network 192.168.1.0

R2
interface Serial0/0
ip address 192.168.1.2 255.255.255.0
!
router rip
network 172.16.0.0
network 192.168.1.0

R3
interface Serial0/0
ip address 172.16.1.2 255.255.255.0
!
router rip
network 172.16.0.0

make sure R1, R2 and R3 learn all the advertised interfaces and RIP working fine by pinging from one to other interfaces
R1>sh ip rou
R    99.0.0.0/8 [120/1] via 192.168.1.2, 00:00:16, Serial0/0
     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.1.0 is directly connected, Serial0/1
     10.0.0.0/24 is subnetted, 1 subnets
C       10.1.1.0 is directly connected, FastEthernet0/0
C    192.168.1.0/24 is directly connected, Serial0/0


R2#show ip route
     99.0.0.0/24 is subnetted, 1 subnets
C       99.99.99.0 is directly connected, Loopback99
R    172.16.0.0/16 [120/1] via 192.168.1.1, 00:00:15, Serial0/0
C    192.168.1.0/24 is directly connected, Serial0/0

R3#sh ip rou
R    99.0.0.0/8 [120/1] via 172.16.1.1, 00:00:21, Serial0/0
     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.1.0 is directly connected, Serial0/0
R    192.168.1.0/24 [120/1] via 172.16.1.1, 00:00:21, Serial0/0

now issue this command on R1
R1(config)#ip default-network 10.0.0.0
*again, remember, this only work on hub spoke network only !!!
now, show ip route on R2 and R3
notice there are default route in the routing table
R2#sh ip route
     99.0.0.0/24 is subnetted, 1 subnets
C       99.99.99.0 is directly connected, Loopback99
R    172.16.0.0/16 [120/1] via 192.168.1.1, 00:00:12, Serial0/0
R    10.0.0.0/8 [120/1] via 192.168.1.1, 00:00:12, Serial0/0
C    192.168.1.0/24 is directly connected, Serial0/0
R*   0.0.0.0/0 [120/1] via 192.168.1.1, 00:00:12, Serial0/0

R3#sh ip route
R    99.0.0.0/8 [120/1] via 172.16.1.1, 00:00:17, Serial0/0
     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.1.0 is directly connected, Serial0/0
R    10.0.0.0/8 [120/1] via 172.16.1.1, 00:00:17, Serial0/0
R    192.168.1.0/24 [120/1] via 172.16.1.1, 00:00:17, Serial0/0
R*   0.0.0.0/0 [120/1] via 172.16.1.1, 00:00:17, Serial0/0

now we'll configure configure static ip route, using this method we need to redistribute the route to R2 and R3 manually
remove default-network and clear the routing table to make sure it's not gonna influence our new conf in any possible way
on R1
R1(config)#no ip default-network 10.0.0.0
on R1, R2 and R3
R1#clear ip route *

issue the static route command on R1 and specified the exit interface
R1(config)#ip route 0.0.0.0 0.0.0.0 fastEthernet 0/0
then redistribute this static route to RIP
R1(config)#router rip
R1(config-router)#redistribute static
show ip route on R2 and R3 should show the default route now
R3#sh ip route
Gateway of last resort is 172.16.1.1 to network 0.0.0.0

R    99.0.0.0/8 [120/1] via 172.16.1.1, 00:00:15, Serial0/0
     172.16.0.0/24 is subnetted, 1 subnets
C       172.16.1.0 is directly connected, Serial0/0
R    10.0.0.0/8 [120/1] via 172.16.1.1, 00:00:15, Serial0/0
R    192.168.1.0/24 [120/1] via 172.16.1.1, 00:00:15, Serial0/0
R*   0.0.0.0/0 [120/1] via 172.16.1.1, 00:00:15, Serial0/0

R2#sh ip route
Gateway of last resort is 192.168.1.1 to network 0.0.0.0

     99.0.0.0/24 is subnetted, 1 subnets
C       99.99.99.0 is directly connected, Loopback99
R    172.16.0.0/16 [120/1] via 192.168.1.1, 00:00:01, Serial0/0
R    10.0.0.0/8 [120/1] via 192.168.1.1, 00:00:01, Serial0/0
C    192.168.1.0/24 is directly connected, Serial0/0
R*   0.0.0.0/0 [120/1] via 192.168.1.1, 00:00:01, Serial0/0
this conf also work with EIGRP, but not with OSPF

another way is to use command ip default-gateway, but you need to turn off ip routing to use this
R3(config)#no ip routing
R3(config)#ip default-gateway 172.16.1.1

R3#sh ip route
Default gateway is 172.16.1.1

Host               Gateway           Last Use    Total Uses  Interface
ICMP redirect cache is empty

1 comment:

  1. Above, regarding the command ip default-network, it says "*again, remember, this only work on hub spoke network only !!!...", however using gns3, I have found that this is NOT true. First I connected one hub router with two spoke routers using ethernet only and it worked. Then with the hub configured with ethernet only on the lan interface and serial interfaces connecting the hub to spokes and this also worked, but then I configured one of the spoke routers connecting to a switch (gns3 router using a switch port and ip routing turned off) and then another router connecting to the same switch on the same subnet and this 2nd router connecting to the switch also received the default route from the hub router. So not sure why the author of this blog says only works on a hub and spoke topology. I also connected from the hub to a router to another router (without the switch) and the two non hub routers also received the default route.

    ReplyDelete