cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2080
Views
0
Helpful
9
Replies

why my PC default gateway is from standby HSRP Switch

mahesh18
Level 6
Level 6

hi all,

Here is info from pm pc

Ethernet adapter Local Area Connection 2:

        Connection-specific DNS Suffix  . :
        IP Address. . . . . . . . . . . . : 192.168.10.4
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . : 192.168.10.2

***************************************************************************************

My pc is connected to switch 2950 which has default gateway config as  shown

ip default-gateway 192.168.10.1

Also it has trunk ports to switch A  and B  which are running HSRP on Vlan 10.

2950T# sh int trunk

Port        Mode         Encapsulation  Status        Native vlan
Fa0/8       desirable    802.1q         trunking      1
Fa0/13      desirable    802.1q         trunking      1

Port      Vlans allowed on trunk
Fa0/8       1-4094
Fa0/13      1-4094

Port        Vlans allowed and active in management domain
Fa0/8       1,10,20,30
Fa0/13      1,10,20,30

Port        Vlans in spanning tree forwarding state and not pruned
Fa0/8       none
Fa0/13      1,10,20,30
2950T# sh cdp nei
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone

Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
3550SMIA         Fas 0/8            121         R S I     WS-C3550-2Fas 0/8
3550SMIB         Fas 0/13           170         R S I     WS-C3550-2Fas 0/13
2950T#

Switch A is HSRP Active and B is standby.

here is info

            Switch A


3550SMIA#sh run int vlan 10
Building configuration...

Current configuration : 169 bytes
!
interface Vlan10
ip address 192.168.10.1 255.255.255.0 ***********************************************default gateway for vlan 10
standby 1 ip 192.168.10.3
standby 1 priority 150
standby 1 preempt
standby 1 track FastEthernet0/8 60
end

3550SMIA#sh standby
Vlan10 - Group 1
  State is Active
    14 state changes, last state change 00:32:01
  Virtual IP address is 192.168.10.3
  Active virtual MAC address is 0000.0c07.ac01
    Local virtual MAC address is 0000.0c07.ac01 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 1.140 secs
  Preemption enabled
  Active router is local
  Standby router is 192.168.10.2, priority 100 (expires in 9.280 sec)
  Priority 150 (configured 150)
    Track interface FastEthernet0/8 state Up decrement 60
  IP redundancy name is "hsrp-Vl10-1" (default)

Switch B

3550SMIB#$                                                 sh run int vlan 10
Building configuration...

Current configuration : 109 bytes
!
interface Vlan10
ip address 192.168.10.2 255.255.255.0
standby 1 ip 192.168.10.3
standby 1 preempt
end

My question here is even though my pc is connected to 2950 switch on port fa0/5 which is in vlan 10 and switch 2950  has default gateway of 192.168.10.1 that is vlan 10 ip of Switch A  why my pc is showing default gateway of 192.168.10.2  that is vlan 10 ip of HSRP Switch B  which is standby??

Many thanks

mahesh

Message was edited by: mahesh18

2 Accepted Solutions

Accepted Solutions

mahesh18 wrote:

also here is config from Switch B


!
ip dhcp pool Vlan10
   import all
   network 192.168.10.0 255.255.255.0
   default-router 192.168.10.2 255.255.255.0
   dns-server 64.59.135.145      

Mahesh

As Christopher says, you are handing out the wrong default-gateway. Change -

default-router 192.168.10.2 255.255.255.0

to

default-router 192.168.10.3 255.255.255.0

Jon

View solution in original post

Not only is it a best practice for the IP host default gateway to be the HSRP standby (virtual) address; but it's the only way it will work if there is a failure in a fault tolerant topology.



View solution in original post

9 Replies 9

gatlin007
Level 4
Level 4

HSRP is a next-hop redundancy protocol and does not send an IP host default gateway information.  There is an assumption that an IP host that's dependant on HSRP will be configured with the default gateway of the HSRP standby address.


How does your PC receive it's IP configuration information?  Is it statically assigned or dynamically assigned?


If it's statically assigned then simply change the default gateway on the PC to 192.168.10.3.


If it's via DHCP you'll need to change the scope to issue a default gateway of 192.168.10.3.



Chris

Hi,

thanks for reply

pc gets ip dynamicall

mahesh

also here is config from Switch B


!
ip dhcp pool Vlan10
   import all
   network 192.168.10.0 255.255.255.0
   default-router 192.168.10.2 255.255.255.0
   dns-server 64.59.135.145      

mahesh18 wrote:

also here is config from Switch B


!
ip dhcp pool Vlan10
   import all
   network 192.168.10.0 255.255.255.0
   default-router 192.168.10.2 255.255.255.0
   dns-server 64.59.135.145      

Mahesh

As Christopher says, you are handing out the wrong default-gateway. Change -

default-router 192.168.10.2 255.255.255.0

to

default-router 192.168.10.3 255.255.255.0

Jon

Try this:


ip dhcp pool Vlan10
   no default-router 192.168.10.2 255.255.255.0

   default-router 192.168.10.3

exit


From a design perspective it's not such a great idea to have the DHCP server on a switch that's protected with HSRP as it's expected that when one of the redundant switches fails the other will take over seamlessly.  Consider turning up a UNIX box as a DHCP server.  Of course the UNIX box should have dual power supplies and dual NIC's.



Chris

Hi christopher,

this is for my home lab only.

you want me to try this on switch A  or B ?

Many thanks

The default gateway should be the same.


Beware - If both switches are serving the same DHCP IP range you'll have DHCP conflicts. 


You should divide the pool up between them so that they will not allocate the same IP address space.  For instance; 192.168.10.0/25 on one switch and 192.168.10.128/25 on the other switch.  In a lab you may not see a problem; but in production things things will get uncomfortable.



Chris

Hi Jon  and christopher ,

Many thanks  for the info

i change the default  router on

Switch B

3550SMIB(config)#ip dhcp pool Vlan10
3550SMIB(dhcp-config)#df
3550SMIB(dhcp-config)#defa
3550SMIB(dhcp-config)#default-router 192.168.10.3

now my pc shows default gateway as 192.168.10.3  which is virtual IP.

so just to confirm point when we config the hsrp and we have dhcp also on switch then it is best practice to config the default router to virtual IP?

mahesh

Not only is it a best practice for the IP host default gateway to be the HSRP standby (virtual) address; but it's the only way it will work if there is a failure in a fault tolerant topology.



Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card