Description

This article provides information about the default behavior of DHCP clients in custom routing instances on SRX devices.

Symptoms

When an interface is a member of a routing instance (type: virtual-router) and configured to obtain IP address via DHCP, the default route received is installed in the default routing instance (table 0.inet) instead of corresponding routing instance (table <instance-name> .0.inet).

In the DHCP trace log error message is seen:

"DHCP RPD route add failed (error 4)"

As indicated by the output below, the default route installed by DHCP (of type access-internal with preference 12) is present in the default routing instance inet.0 instead of the routing instance VR1.inet.0 of which this interface fe-0/01.0 is part of.
Also if we have two interfaces receiving IP addresses and default routes from DHCP servers, then the last route received overwrites the previous route received, which means only one default route will exist at a point.

Configuration:
interfaces {
    fe-0/0/1 {
        unit 0 {
            family inet {
                dhcp;
            }
        }
    }
}
security {
    zones {
        security-zone VR {
            interfaces {
                fe-0/0/1.0 {
                    host-inbound-traffic {
                        system-services {
                            all;
                        }
                        protocols {
                            all;
                        }
                    }
                }
            }                           
        }
    }
}
routing-instances {
    VR1 {
        instance-type virtual-router;
        interface fe-0/0/1.0;
    }
}
Routing table:
root@SRX> show route 

inet.0: 9 destinations, 11 routes (9 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

0.0.0.0/0          *[Access-internal/12] 00:17:19
                    > to 192.168.1.1 via fe-0/0/1.0
.

VR1.inet.0: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

192.168.1.0/24     *[Direct/0] 00:17:19
                    > via fe-0/0/1.0
192.168.1.50/32    *[Local/0] 00:17:19
                      Local via fe-0/0/1.0

Solution

This is per current design.  DHCPv4 client is configured on the interface, but the default route which is learned from the DHCP server is only added to the default routing table, even though that interface belongs to some routing instance.

For a workaround, please refer to KB21169 - How to setup DHCP server on SRX with DHCP clients in non-default routing-instance. [juniper.net]