Some time back, I failed to create a wireless router out of a linux box. I got it working finally. This may not be the best way to do it, but it worked for me with only some minor issues.
In the machine I have the following:
NIC 1: Static IP hooked to a public IP. I am not using this NIC at all.
NIC 2: This is wired to my local LAN
NIC 3: Wireless NIC.
GATEWAY: This resides at my firewall and is at 192.168.1.1
DHCP/DNS SERVER: This resides on another PC at 192.168.1.101
Ok, here is the strategy:
My internal lan is 192.168.1.X. The DHCP Server issues IP’s 192.168.1.5-25, and assigns G/W 192.168.1.1 and DNS 192.168.1.101.
The wired portion of the LAN worked as expected. Now on to the Wireless portion.
Do accomplish this, I had to employ a network bridge. These instructions are for my Fedora 9 box, so you may need to adjust the instruction for you particular distrobution.
1. Create and/or edit the following files:
/etc/sysconfig/networking/devices/ifcfg-eth1 (NIC 2 above)
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
USERCTL=no
BOOTPROTO=none
NM_CONTROLLED=no
BRIDGE=br0
/etc/sysconfig/networking/devices/ifcfg-wlan0
DEVICE=wlan0
TYPE=Wireless
ONBOOT=yes
USERCTL=no
BOOTPROTO=none
ESSID=MYSSID
MODE=Ad-Hoc
RATE=Auto
CHANNEL=1
NM_CONTROLLED=no
BRIDGE=br0
/etc/sysconfig/networking/devices/ifcfg-br0
DEVICE=br0
ONBOOT=yes
TYPE=Bridge
IPADDR=192.168.1.3 # IP address of the interface here
NETMASK=255.255.255.0 # IP address mask here
GATEWAY=192.168.1.1 # Default gateway here
After creating/editing these files, start system-config-network and enable the new interfaces, so they are present to the current network profile.
I was able to connect to see and attach to the WiFi with my laptop and all worked perfectly.
There is only one real downside to this setup. I am still researching this, but there may be no way to use WEP while in Ad-Hoc mode. This is a problem but a work-around is to disable dynamic IP assignments with DHCP. My network is small enough (Less than 10 PC’s) that I can simply map MAC’s to IP. All unused IP’s can simply be stopped by IPTABLES.
If anyone has a method for using WEP in Ad-Hoc, I’d love to hear from you.
Enjoy.