Chris Harvey Blog
Chris Harvey

Chris Harvey

10M Followers

Sharing Optus cable internet using Ubuntu Gnu/Linux

Theres many guides on how to share the internet using gnu/linux on the web, this one will be fairly basic and I’ll try not to ramble on about you could also use this or that device to do it this way or that way. This will just be the cheapest way to get it up and running.

All you need is an optus cable internet connection, 2 computers with network adapters and a crossover cable. Most computers have an onboard network adapater. In this guide we are using a computer running Ubuntu 8.04 and one running windows XP.

This guide is loosely based on a Howto Share internet connection from ubuntu forums but hopefully a bit more newbie friendly and specific to Optus cable internet.

network setup

The hardware setup

By default the optus cable modem uses a usb network connection so plug that into the modem and connect it to the computer running ubuntu in a spare usb port.

Plug the crossover cable into your ethernet port on the ubuntu computer and the into the windows computer.

On my setup eth0 is the ethernet card, and eth3 is the usb connection to the cable modem.

On Ubuntu systems, eth0 is the first network device (ethernet card) plugged into a slot. Additional ethernet cards plugged will become eth1, and so forth. I’m not sure why the usb connection is eth3, Im not very familiar with networking using USB, perhaps someone will enlighten us.

Windows called the connection Local area connection.

Software Setup

The configuration settings for both computers

Ubuntu

We’re going to use the command line on Ubuntu for this, you can find it under Applications > Accesories > Terminal.

Just copy and paste the commands after the “#” :
1. For this guide we will change to the root user, the root user is the administrator account or superuser account on unix-like systems.
# sudo -s

2. Assign an IP address to the network card that interfaces to the other computers on you network
# ifconfig eth0 192.168.0.1 up

3. Then configure the NAT as follows:
# iptables -t nat -A POSTROUTING -o eth3 -j MASQUERADE
# echo 1 > /proc/sys/net/ipv4/ip_forward

4. Install dnsmasq and ipmasq using apt-get:
# apt-get install dnsmasq ipmasq

5. Restart dnsmasq:
# /etc/init.d/dnsmasq restart

5b. If you get an error message here that says the socket is in use, try.
# pkill named

6. Reconfigure ipmasq to start after networking has been started:
# dpkg-reconfigure ipmasq

7. Repeat steps 1 and 2.

Tip: check your internet is connected
# ping google.com
If theres not reply try
# dhclient eth3
then try ping google.com again

windows

Make sure you record your current setting before changing them so that you can change back later if you want to. You can click the images below to enlarge them.


1. We need to change the network settings on windows to assign it a static IP.
Open Start > Control Panel > Network connections
Right click on Local Area Connection and select properties


2. From the window that opens select “Internet Protocol(TCP/IP) and click on properties


2. Select the “Use the following IP Address option and for the IP address: 192.168.0.2

The subnet mask should default to 255.255.255.0, for the default gateway and preferred DNS server : 192.168.0.1 and select OK and OK.

Final Notes

If you find your having trouble it should be easy to change your settings back to their original state on windows and on ubuntu you can reboot.

2 thoughts on “Sharing Optus cable internet using Ubuntu Gnu/Linux”

  1. You would think that one comp could use the usb and another could use the ethernet but I think its configured just to give out one IP, Im not sure, I couldnt log on to it.

    Reply

Leave a Comment