private void AddInterfaceRoutes(InterfaceIPConfiguration !ipConfig) { // // Add subnet route // IPv4Network subnet = new IPv4Network(ipConfig.Address, ipConfig.NetMask); routingTable.AddRoute( new RouteEntry(subnet, ipConfig.Address, ipConfig.Address, RouteEntry.DirectlyConnectedMetric, RouteEntry.InterfaceRouteTag) ); // // Add route to gateway // routingTable.AddRoute( new RouteEntry(ipConfig.Gateway, ipConfig.Address, ipConfig.Address, RouteEntry.DirectlyConnectedMetric, RouteEntry.InterfaceRouteTag) ); // // Add default route if none exists // if (routingTable.Lookup(IPv4Network.Default) == null) { routingTable.AddRoute( new RouteEntry(IPv4Network.Default, ipConfig.Gateway, ipConfig.Address, RouteEntry.DefaultRouteMetric, RouteEntry.InterfaceRouteTag) ); } }