cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 
cancel
5572
Views
5
Helpful
12
Replies

How to change the next-hop address of BGP learned routes to its DHCP/PPPoE server gateway

hunterlau
Level 1
Level 1

Hi talents, I have tried with inbound route-map, but it only can change the next-hop address of BGP learned routes to a fixed IP address, rather than dynamic gateway IP address of its DHCP/PPPoE server.

Working fine in Juniper SRX with changing the next-hop IP address to 0.0.0.0, then it would be redirected to the gateway IP address of its DHCP/PPPoE server, but cisco router cannot be set to 0.0.0.0 with inbound route-map, even the command "set ip next-hop dynamic dhcp" cannot be working.

Thanks a lot.

Below is the scenario and configuration.


R1------------R2----------R3(DHCP server)
 e0/0     e0/0  e0/1   e0/0



#R1#

interface Loopback0
ip address 22.22.22.22 255.255.255.255
!
interface Ethernet0/0
ip address 10.2.1.2 255.255.255.0
!
router bgp 100
bgp log-neighbor-changes
network 22.22.22.22 mask 255.255.255.255
neighbor 10.2.1.1 remote-as 200
maximum-paths 32


#R2#

interface Ethernet0/0
ip address 10.2.1.1 255.255.255.0
!
interface Ethernet0/1
ip address dhcp
!
router bgp 200
bgp log-neighbor-changes
neighbor 10.2.1.2 remote-as 100
neighbor 10.2.1.2 route-map NEXT-HOP in
maximum-paths 32
!
route-map NEXT-HOP permit 10
set ip next-hop dynamic dhcp



#R3#

ip dhcp pool DHCP
network 10.1.1.0 255.255.255.0
default-router 10.1.1.1
!
interface Loopback0
ip address 22.22.22.22 255.255.255.255
!
interface Ethernet0/0
ip address 10.1.1.1 255.255.255.0

1 Accepted Solution

Accepted Solutions

Hello Georg

it won't as the ebgp routes are more specific - Pbr or other related statics would work though 

res

Paul


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the communityā€™s global network.

Kind Regards
Paul

View solution in original post

12 Replies 12

Hello,

why is the 'set ip next-hop dynamic dhcp' not working ? Which IOS version are you running ?

Hi Georg,

I have no idea. I am using IOS 15.4.

Hello,

can you post your config ? I want to lab this in GNS3...


R1------------R2----------R3(DHCP server)
 e0/0      e0/0   e0/1 e0/0



#R1#

interface Loopback0
ip address 22.22.22.22 255.255.255.255
!
interface Ethernet0/0
ip address 10.2.1.2 255.255.255.0
!
router bgp 100
bgp log-neighbor-changes
network 22.22.22.22 mask 255.255.255.255
neighbor 10.2.1.1 remote-as 200
maximum-paths 32


#R2#

interface Ethernet0/0
ip address 10.2.1.1 255.255.255.0
!
interface Ethernet0/1
ip address dhcp
!
router bgp 200
bgp log-neighbor-changes
neighbor 10.2.1.2 remote-as 100
neighbor 10.2.1.2 route-map NEXT-HOP in
maximum-paths 32
!
route-map NEXT-HOP permit 10
set ip next-hop dynamic dhcp



#R3#

ip dhcp pool DHCP
network 10.1.1.0 255.255.255.0
default-router 10.1.1.1
!
interface Loopback0
ip address 22.22.22.22 255.255.255.255
!
interface Ethernet0/0
ip address 10.1.1.1 255.255.255.0

Hello,

I have spent the last few hours debugging and trying to find out why the dynamic dhcp doesn't work in the route map, really without any result. I have read somewhere that a T release is required for this command to work properly, I'll try and find a router that runs that release and test further...

Hi Georg,

Really appreciate for your kind help!!

Hello

R1-R2 are ebgp peering and R2 is also receiving an dynamic addressing from R3.

If you trying to change R2's default next hop to point towards R3 using this command then as Georg as stated it seems to require a certain IOS version but I am to which one as I have tested this 15.1(4) is it still doesn't seem to work.

However it doesn't stop you using a different method, You could use a default static route with a lower admin distance than the default of 254 obtained from dhcp.

Note:if the same networks are being advertised more specifically,Then either a PBR with a named next hop would be required or other statics.

ip route 0.0.0.0 0.0.0.0 eth0/0 dhcp 1


res
Paul


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the communityā€™s global network.

Kind Regards
Paul

Hi Paul,

Thanks for your reply, but I cannot understand why using a default static route with a lower admin distance than the default of 254 obtained from dhcp.

I just want to do the below task. 

R2#show ip rou
Codes: L - local, 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 type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override

Gateway of last resort is 10.1.1.1 to network 0.0.0.0

S* 0.0.0.0/0 [254/0] via 10.1.1.1
10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C 10.1.1.0/24 is directly connected, Ethernet0/1
L 10.1.1.3/32 is directly connected, Ethernet0/1
C 10.2.1.0/24 is directly connected, Ethernet0/0
L 10.2.1.1/32 is directly connected, Ethernet0/0
22.0.0.0/32 is subnetted, 1 subnets
B 22.22.22.22 [20/0] via 10.2.1.2, 00:00:41

change to

B 22.22.22.22 [20/0] via 10.1.1.1, 00:00:41

Thanks.

Just to chip in (as I pretty much tested all commands available yesterday), the command:

ip dhcp-client default-router distance 1

changes the static default generated by DHCP to an AD of 1, but still does not affect the behavior of the route map...

S* 0.0.0.0/0 [1/0] via 10.1.1.1
10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C 10.1.1.0/24 is directly connected, FastEthernet0/1
L 10.1.1.10/32 is directly connected, FastEthernet0/1
C 10.2.1.0/24 is directly connected, FastEthernet0/0
L 10.2.1.1/32 is directly connected, FastEthernet0/0
22.0.0.0/32 is subnetted, 1 subnets
B 22.22.22.22 [20/0] via 10.2.1.2, 05:18:36

Hello Georg

it won't as the ebgp routes are more specific - Pbr or other related statics would work though 

res

Paul


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the communityā€™s global network.

Kind Regards
Paul

You are right. 

I did some more testing, on an IOS T version, but no difference. I am starting to think that this is either a bug, or, which is more likely, that 'dynamic dhcp' does not work with BGP related route maps. I haven't tested on Denali, or XR, or XE, though.

I don't have a service contract, so I cannot report a bug. If you, Paul or hunterlau, do have one, can you report a bug, or bettter yet, open a TAC case ?

Hello

Because your only default route via dhcp has an admin distance of 254 and those ebgp prefixes are more specific and have a lower admin distance

you can try either:

use a lower default static route for all traffic (only if you already using a default with a lower admin but again  it still won't work on more specific routes)

pbr via a specific ip next hop address (not dynamic dhcp command as this doesn't seem to work)

Use other conditional specific statics routes 

res

paul


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the communityā€™s global network.

Kind Regards
Paul
Review Cisco Networking for a $25 gift card