Programmatically change the "Advanced TCP / IP Settings" - uncheck the "Use the default remote network path"

enter image description here

Description:

I created a Dial-Up Connection Programally to communicate with my device and laptop. And as soon as the connection is established with the Dial-Up Created connection, my Internet connection, which is connected through the LAN, does not work and the status of the connection to the local network is connected (used to connect to the Internet).

For this to happen, I need to uncheck the "Use the Defualt Gate path on a remote network" option with right click my dial-up connection -> properties -> Netwroking TAB -> Select Internet Protocol (TCP/IP) -> Properties -> Advanced -> I get Advanced TCP/IP settings -> Unchek "Use Default Gate Way on Remote Network".

I use RAS features to create a phone book for my remote access. Are there any structures to do this as an option. I found any structure parameters to do this as an option. Please advice.

How to do this programmatically? Can I use any API.

+4
source share
3 answers

RASEO_RemoteDefaultGateway flag when creating the phone book will disable this option.

This flag can be canceled using the RASENTRY structure dwoptions .

Content from the Microsoft SDK:

RASEO_RemoteDefaultGateway - If this flag is set, the default route for IP packets is through the dial-up adapter when the connection is active. If this flag is clear, the default route does not change. This flag corresponds to the Use standard gateway in a remote network check box in the TCP / IP settings dialog box.

+1
source

I did not test it, but I would suggest that this matches the ForwardingEnabled element of the MIB_IPINTERFACE_ROW structure. If so, you can change it using SetIpInterfaceEntry .

Usually you want to call GetIpInterfaceTable to get the current information for each interface, and then change the ForwardingEnabled member to fix, then call SetIpInterfaceEntry with this changed MIB_IPINTERFACE_ROW .

+3
source

I would bet on the AdvertisingDefaultRoute and DisableDefaultRoutes flags. The default use gateway parameter simply overrides the current gateway and changes the default route print (check route print before and after connecting).

0
source

All Articles