There is a feature that allows you to dynamically import routes from the global to the VRF but not the other way around.
You can have a static route in the global with a NH interface in a VRF though.
I cannot write static route for this case. Because I am using the vrf for my pppoe users. Router downloads the user profiles from the radius and put the users into the internet vrf. But I cannot install the reverse route for the user. If I use, route or framed route attribute in the userprofile ,router installs the route as it is a vrf route. The reason i am using the vrf is that I just wanna use different route table for different customers.
I agree we cannot import routes from VRF to global. But we should be able to redistribute routes from the VRF PE-CE routing protocol into the global IGP, as i have mentioned in my earlier post. I have not tried it out but I do see the redistribute ospf x vrf xyz command in global ospf config mode.
It is simply not allowed to redistribute from a routing process assigned to a VRF into the global.
One could probably loop two interfaces, one from the VRF and one from the global and run BGP between the two and therefore get the routes from the VRF into the global. Although I have never tried that I think this could work. You would need a special knob to configure the a separate BGP router id for the VRF, which is not available in all version of IOS (available in 12.2(22)SRB I believe) and would probably need to do some tricks with the local-as command to get it to work.
You can create a distribute list and redistribute those routes from the vrf routing protocol (ospf x vrf test) into the global IGP.
eg. if you are running "ospf 1 vrf test" as the PE-CE protocol for vrf test, and you are running OSPF 100 as global igp, you can go to global IGP and redistribute the vrf routes in that using a distribute list to control the redistribution.
But doing this, you have to know the scenario completely and be sure that it doesnot overlap / cause problems in your global IGP.
For what scenario do you want to do that? If you have only a few prefixes, it is better to install static routes.
When I try to redistribute, Router is not allowing.
#router ospf 100
(config-router)#redistribute ospf 1 vrf test subnets
%OSPF process 1 is attached to VRF test
1-Try to configure default route into the vrf for upload traffic with global key word:
ip route vrf internet 0.0.0.0 0.0.0.0 (next-hop is your gateway router) global.
2-For download traffic configure static route into global routing table with the pppoe customers pool pointing to customers vrf interface or next-hop through this interface:
ip route customer pool 255.255.255.0 ethernetx/x 126.96.36.199 .
Soryy, I guess I am not clear enough.
I cannot write a static route pointing to customer,as they are coming from L2TP tunnel which clones a virtual template. We can think as they are a normal dial-up users using a virtual-template. So I cannot write a static route manually pointing the customer.
If the uplink interface will be used only for internet traffic you can bind this interface to another vrf and now you can import & export routes (default and customer routes which are connected routes in the cust vrf routing table) by RTs between customer vrfs and uplink vrf and in the same time you will separate between cust VRFs and make uplink vrf as central vrf.
Why don't you create another interface for vrf "test" that facing to P Router and then enable ospf for vrf "test" ?
eg. Something like this.
ip vrf for test
ip add x.x.x.x/32
description "Global TO P-router"
ip add y.y.y.y/30
description "VRF TO P-router"
encap dot 10
ip vrf for test
router ospf 1
network 0.0.0.0 area 0
router ospf 2 vrf test
redis connected subnet tag 1234 !
network 0.0.0.0 area 0