Windows 7 has a feature called Internet Connection Sharing (ICS).
Enabling ICS
To enable ICS, on your host computer:
Open Network Connections by clicking the Start button , clicking
Control Panel, clicking Network and Internet, clicking Network and
Sharing Center, and then clicking Manage network connections.
Right-click the connection that you want to share, and then click
Properties. If you are prompted for an administrator password or
confirmation, type the password or provide confirmation.
Click the Sharing tab, and then select the Allow other network users
to connect through this computer’s Internet connection check box.
Note
The Sharing tab will not be available if you have only one network
connection.
If desired, you can also select the Allow other network users to
control or disable the shared Internet connection check box.
Optionally, to allow other network users to use services running on
your network, click Settings and select the services you want to
allow.
When you enable ICS, your local area network (LAN) connection gets a
new static IP address and configuration, so you'll need to reestablish
any TCP/IP connections between your host computer and the other
network computers.
To test your network and Internet connection, see if you can share
files between computers and make sure each computer can reach a
website.
Configure TCP/IP
To use ICS, make sure the local area network (LAN) connection on each
network computer is configured to get an IP address automatically. To
do this:
Open Network Connections by clicking the Start button , clicking
Control Panel, clicking Network and Internet, clicking Network and
Sharing Center, and then clicking Manage network connections.
Right-click the LAN connection, and then click Properties. If you
are prompted for an administrator password or confirmation, type the
password or provide confirmation.
Click Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol
Version 6 (TCP/IPv6), and then click Properties.
Click Obtain an IP address automatically or Obtain an IPv6 address
automatically.
The Internet options on your network computers should also be
configured for ICS. For more information, see Change Internet settings
for ICS (Internet Connection Sharing).
Do not use ICS on a network with domain controllers, DNS servers,
gateways, or DHCP servers. And don't use ICS on systems configured for
static IP addresses.
Also, from the same page:
ICS and ad hoc networks
If you share your Internet connection on an ad hoc network, ICS will
be disabled if:
You disconnect from the ad hoc network.
You create a new ad hoc network without disconnecting from the ad hoc
network for which you enabled ICS.
You log off and then log back on (without disconnecting from the ad
hoc network).
Note: This article is about Windows Vista, but it should be the same way for Windows 7.