Shared Connections

[Internet Connection Firewall may be altered or unavailable in subsequent versions. Instead, use the Windows Firewall API.]

A connection is considered to be either public or private.

A public connection connects a local computer with the public Internet. A public connection is often through a modem, broadband connection (DSL or cable), or T1 line.

A private connection connects a local computer with other computers on a home or office local area network (LAN). Private connections are typically through network interface cards (NICs) but could also be through an IEEE 1394 ("Firewire") connection, serial cable, or some form of wireless device.

When ICS is enabled, one public and at least one private connection must be specified. Multiple private connections can be specified and are automatically bridged together to form one segment. It is only possible to share one public connection at a time.

When enabled, ICS receives packets on private connections, translates them via NAT, and routes them to the Internet through the public connection.

Using the ICS API, you can determine whether a particular connection can be shared. Not all connections can be shared.

Before attempting to configure sharing on a connection use the INetSharingManager::get_NetConnectionProps method to obtain an INetConnectionProps interface for the connection. Then, use the INetConnectionProps::get_MediaType method to obtain the media type for the connection. If the NETCON_MEDIATYPE for the connection is one of the following:

  • NCM_PHONE
  • NCM_DIRECT
  • NCM_ISDN
  • NCM_LAN
  • NCM_TUNNEL
  • NCM_PPPOE

Use the INetConnection::GetProperties method to check the NETCON_CHARACTERISTIC_FLAGS for the connection. If the NCCF_INCOMING_ONLY flag is absent, the connection is sharable.

To configure sharing on a particular connection, use the INetSharingManager::get_INetSharingConfigurationForINetConnection method to obtain an INetSharingConfiguration interface for the connection.