Categories
Status

How to Share a Wireless Connection via Ethernet Using Squid on Ubuntu

I needed to share my wireless internet connection on my laptop to a few computers that did not have wireless network cards. This is how I solved the problem.

What you will need:

1. Computer with wireless internet connection running Squid on Ubuntu

2. A few ethernet cables

3. A switch

4. A computer to share the connection to

Instructions:

1. To begin make sure your squid proxy is up and running on the computer that has the wireless connection. To do this open a web browser configure your browser to use your squid proxy (located under network settings on most browsers). The host will be localhost and the default port is 3128. If you don’t have squid installed  use “sudo apt-get install squid” to install squid on Ubuntu. Below is a screenshot of what the settings will look like using Google Chrome as the web browser. Once you have configured your browser visit a webpage and make sure it is working by making sure webpages load correctly.

2. ow you need to configure your wired ethernet card on your machine. Only one setting needs to be modified. Go to network connections in Ubuntu by either right-clicking the network icon in the gnome panel and clicking Edit Connections or going to System->Preferences->Network Connections on the Ubuntu menu. Locate your wired NIC and click edit. Go to the IPv4 Settings tab and click the “Routes…” button in the bottom right corner of the box. On the next box that opens check the box that says “Use this connection only for resources on its network”. The reason we are checking this box is so that Ubuntu will know to use your wireless connection for the internet and not your wired/ethernet connection. Click OK. and Apply to have the new settings take effect. NOTE: If the connection is currently in use the settings might not take.  To fix this unplug your ethernet network card before making the changes.

3. Connect your wired/ethernet adapter to the switch.

4. Connect the computers you want to share your connection with to the switch.

5. To tell the computers without internet to use your computer with internet you need to set them up to use the squid proxy as their internet connection.

6. To do this Ubuntu go to System->Preferences->Network Proxy on the Ubuntu Menu.

7. Select Manual Proxy Configuration and fill in the IP address of the wired network adapter of the computer with the wireless internet connection. In this case the IP address is 192.168.0.100. Now you should be able to browse the internet on the computer you just connected to the switch!

Troubleshooting:

1. Make sure you can ping the computer hosting the internet connection.

2. Make sure you can access port 3128 on the computer hosting the internet connection. System->Administration->Network Tools->Port Scan

3. Make sure your squid configuration access list includes the IP’s of the computers you just connected. /etc/squid/squid.conf – Note: SQUID needs a restart for access list changes to take effect.

Possible access list configuration:

# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network

4. Make sure when you connected your wired network adapter to the switch your internet did not break. If this is the case you most likely have a problem with Step 2!

5. Feel free to post a question via a comment on this post or contact me in any of the various ways listed on the site.

One reply on “How to Share a Wireless Connection via Ethernet Using Squid on Ubuntu”

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.