Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-05-2010, 12:12 PM   #1
Registered: Jul 2007
Location: Seoul, S. Korea
Distribution: Ubuntu 9.10
Posts: 44

Rep: Reputation: 15
Wireless ICS network without a router

I have a desktop running Ubuntu 9.10 with a D-Link WUA-1340 (Supported - last on list) USB wireless adapter, through which I would like to set up a wireless network for internet connection sharing at home.

I have 2 ethernet adapters on my desktop (Eth0, Eth1), and an Apple Airport Express, which I initially tried to use, then thought it might be better to just bypass the Airport Express.

I have worked through a couple tutorials for this on the Ubuntu forums:


My problem is that although I create a wireless network and connect to it with my macbook, I am unable to access the Internet on it.

Any troubleshooting advice would be appreciated. I am not sure what I am doing wrong, and have worked through WifiDocsShareEthernetConnectionThroughWireless a few times, as this seems to be exactly what I am trying to do.

I am quite new to networking, so any other reference points that you feel may be beneficial would also be appreciated. Thank you.
Old 02-06-2010, 09:28 PM   #2
Registered: Jun 2009
Posts: 87

Rep: Reputation: 31
You need to set up IP Masquerading. Here's a script I've used to share an internet connection:
# Defines the location of iptables executables.

#Clears if any old iptable rules/ policies are there.
iptables --flush -t nat

 # Now we will do Masquerading ie. we are doing NAT.
iptables --table nat --append POSTROUTING --out-interface wlan0 -j MASQUERADE
iptables --append FORWARD --in-interface usb0 -j ACCEPT

 # Enabling packet forwarding.
echo 1 > /proc/sys/net/ipv4/ip_forward
Save this in a file, and change wlan0 to whatever your interface with an internet connection is (probably eth0), and usb0 to your wireless card's interface (probably wlan0). I hope this works!
Old 02-07-2010, 05:53 PM   #3
Registered: Jul 2007
Location: Seoul, S. Korea
Distribution: Ubuntu 9.10
Posts: 44

Original Poster
Rep: Reputation: 15
Thanks for the reply.

Do I have to set up Masquerading in order to internet share though?

I've found this How To for Masquerading or IP MASQ, but it's a lot to read and learn simply to set up an Internet sharing network. I am not too worried about security, and I don't think I would need my laptop to access the Internet invisibly, as the text seems to suggest this does.

Also, just wondering where I would save that file, and what I would save it as, or if it matters.

Edit: OK, I managed to get it working. Not sure if this is the best way, but it works for now.

What I did was reworked through InternetConnectionSharing and whereas this was a tutorial for sharing Internet connection eth1 through eth0, I simply replaced eth0 with wlan1 (my wireless network adapter) in:

sudo iptables -A FORWARD -i eth0 -o eth1 -s -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A POSTROUTING -t nat -j MASQUERADE
and later

sudo ifconfig eth0
Simply by changing those two lines, and setting the Method in IPv4 settings to "Shared to other computers" for the wireless connection I set up on my desktop, I am able to share my Internet connection wirelessly at home.

Last edited by andou; 02-08-2010 at 12:01 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ICS to college network via wireless xp host Kirmonkey Linux - Wireless Networking 3 10-06-2008 12:04 PM
Setup a Linux network with 1 server, 4pcs wired & wireless, wireless router, & hub bhowerton Linux - Newbie 1 04-05-2008 03:33 PM
Suse 9.1 -> Router -> XP-ICS miss_marple Linux - Networking 1 02-27-2005 06:47 AM
Network speed problems on 15 user network to broadband wireless router AntWarrior Linux - Wireless Networking 2 12-02-2004 11:05 AM
connecting from Fedora to ICS behind router vivhost Linux - Networking 0 05-31-2004 02:04 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:37 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration