Radu Cotescu's professional blog

g33k w17h pa45510n

Ubuntu and Internet Connection Sharing via a Wireless Card

Sharing your Internet connection is the poor man’s way of creating an access point using one of your PCs as the gateway. This implies that the PC (gateway) that you want to use for this has two network cards:

  • an Ethernet card (NIC) connected to a network (LAN) with Internet access

  • a wireless network interface card (WNIC) used to share the Internet connection

Setting up ICS on an Ubuntu machine is a very straight-forward process:

  1. Click on the Network Manager icon and select the Create New Wireless Network… menu entry Step 1. Create New Wireless Network

  2. Enter the details you want for this new “ad-hoc” network. WPA is not supported, so your only options for “Wireless Security” are “None” (although I wouldn’t call this security) or the WEP settings (not a secure algorithm, but hopefully your neighbours don’t use WireShark to crack your network). For the WEP 40/128-bit Key option, you key has to be exactly 5/10/13 characters long. If you want to be able to connect Windows clients to your network, the only option that worked for me is WEP 40/128-bit Key with a 13 characters key. An Ubuntu machine won’t have any problems with either options. Click on Create. Network Manager will automatically connect to this new network you have just created. Step 2. New wireless network

  3. After your PC has connected (self-connected) to the “ad-hoc” network, you have to make sure that this connection is shared to other computers and devices (clients). Right click on the Network Manager icon and select Edit Connections… Select the Wireless tab, select your recently created connection and click on Edit. Make sure that the Connect automatically check-box is selected and on the IPv4 Settings tab male sure that the Method option is set to Shared to other computers. Step 3. Ad-Hoc network settings

  4. Ensure that you do have the dnsmasq-base package installed (you can check usiny Synaptic). This is a DNS / DHCP server which will not run as a daemon, but as a background program, launched by the Network Manager.

  5. To be sure that your clients will receive an IP check that your firewall allows connections from and to the new network you have just created. Given the following command, you should see a similar output:

1
2
3
4
5
6
[email protected]:~$ sudo iptables -L
[sudo] password for radu:
Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             10.42.43.0/24       state RELATED,ESTABLISHED
ACCEPT     all  --  10.42.43.0/24        anywhere

Enjoy browsing! I told you this was simple.

P.S. I would like to thank Vlad for helping me correct the information provided about clients’ IPs and the fact that the gateway will provide the necessary data through DHCP.

How To, Ubuntu

« How to install VMware Server on 2.6.35 kernels Java, HTTPS and REST web services using Apache CXF »

Comments