Internet Connection Sharing Via Wi-Fi On Fedora Linux

Hey there! I'm currently working on a CLI tool to deploy WordPress apps to DigitalOcean. Check it out! It's free and open source.

I was very tired yesterday evening, so I thought about tweeting through my iPhone while lying in bed. EDGE is pretty slow and expensive, and 3G hasn’t yet arrived in Moscow (military issues) so I decided to go with Wi-Fi. Good idea, huh? And it took me just a couple of hours to set the whole thing up. I’m running Fedora Linux 10 but you should’t have much trouble on other distros.

Setting up a Wi-Fi hot spot at home using a simple Wi-Fi router is the easiest way to go around, but that costs like a hundred bucks – not worthed. I’ve managed to setup an Ad-hoc (computer to computer) connection using my built-in 10m Wi-Fi module on my laptop PC. If you ever ran a Windows OS (duh!) you might know that sharing an Internet connection on your LAN is quite simple. My situation’s slightly different. A Vista running box is already sharing a PPPOE connection through LAN to two other laptop PCs, one of which is my favourite Fedora 10 box.

Anyways, the wired network on Fedora is set up and works fine (eth0 interface). Hadn’t had to iptables anything, nor should you ;) Now, setup a wireless network. Make sure you choose Ad-hoc (computer to computer) connection, input a passkey and setup your IP settings:, and use as your Route in case Fedora says it’s required (mine did). You might also need to input your DNS information (you can obtain your DNS information by running cat /etc/resolv.conf). This is all setup in the Networking manager (a Gnome utility AFAIK). Activate the connection and run ifconfig to make sure you’ve got a wirelass connection available (you should see a wlan0 section).

At this point you might want to test your connection. Get some device to ping your computer and try to ping back. Remember that you’ll have to setup IP information on your device manually (unless you’ve got a DHCP server running on the wlan0 interface). Pings fine? Okay, good. Now, all you’ve left to do is run a simple iptables script. Go ahead and generated one: Easy Firewall Generator for iptables. Don’t forget to pick the Gateway/Firewall option. Mine settings were like this:

  • Internet interface: eth0 (this is my wired LAN)
  • Static Internet IP Address (my wired LAN address)
  • Internal Network Interface: wlan0 (the wireless network)
  • Internal Network IP Address:
  • Internal Network:
  • Internal Broadcast:

The Generator will give out a shell script. Copy the contents and paste into a file (/home/kovshenin/ Then:

$ cd /home/kovshenin
$ chmod a+x
$ ./

All done! I can now tweet free from the kitchen, balcony, bathroom and even from my toilet! :) Now I’m thinking about setting up a VNC server, so I’d never have to go back to my laptop PC again. Oh and by the way, if you DO have a feeling that you’ve messed up iptables, just run the iptables-restore command and start over. If you’re sure you got everything correct, use the iptables-save command, so that you wouldn’t need to run the script everytime you boot your system. Good luck everyone, and happy tweeting!

P.S. I’m glad to have some more connections on Google FriendConnect. Welcome newcomers! Hope you enjoy your stay!

About the author

Konstantin Kovshenin

WordPress Core Contributor, ex-Automattician, public speaker and consultant, enjoying life in Moscow. I blog about tech, WordPress and DevOps.


  • Great. Same situation here. Will try to figure it out next week on my Ubuntu box. Thanks for the post.

  • Hi, there is a problem when configuring through NM applet for wlan0 it asks for IP, SUBNET MASK, GATEWAY. what gateway i should give there. Also in Routes it is asking the same IP, MASK, GATEWAY. Is it a setup in which my laptop with fedora on it is acting like a two interface linux box routing the packets of the other wlan0 connected system to it through the wired internet connected eth0 interface of it, so that the other systems connected to the wlan0 can surf the internet. I have exactly same requirement. But i m not able to do it. Please Help.