July 7th, 2005 06:49 AM
WAP's, Windows, and linux oh my!
This is a tutorial I'm putting together to show you how to network 2 computers through a wireless connection using Windows Server 2003 and Red Hat Linux. In this tutorial we'll be using our Linux machine as our gateway to the wireless network. It is assumed that you have 2 computers, one having a wireless NIC as well as a standard ethernet port. The Windows machine needs to have only one NIC. Depending upon your NIC you may need a crossover cable, in my case I did not. It is also assumed that the WAP is your gateway to the internet.
At this point you'll want to bring your NIC's online and acquire an adress from your WAP using DHCP for eth0 (or whatever your wireless card is named). As root you'll issue the following commands:
Make note of the address your assigned and continue on. The next thing we will do is assign a static IP to your second interface:
#ifconfig eth0 up; pump -i eth0; ifconfig
I assigned the NIC an IP in a private IP range. These are 192.168.0.0/24, 172.16.0.0/16, and 10.0.0.0/8. For mine I chose the address 10.0.0.1 with a mask of 255.0.0.0 just to keep things simple.
#ifconfig eth1 10.0.0.1; ifconfig
The next thing you will want to do is turn on forwarding for the NIC's. In a nutshell, this is what allows your box to route packets.
Note: I will not be covering firewalling here so if this is a consideration please take appropriate measures and educate yourself as to the function of the following commands.
#echo "1" > /proc/sys/net/ipv4/conf/eth0/forwarding
#echo "1" > /proc/sys/net/ipv4/conf/eth0/proxy_arp
#echo "1" > /proc/sys/net/ipv4/conf/eth1/forwarding
The next thing we will be doing is checking our routes. Usually Linux will add a route to whatever network your NIC sits on, but just to make sure we'll check:
#echo "1" > /proc/sys/net/ipv4/conf/eth1/proxy_arp
What we're looking for here is where everything will be going. Mine looks something like this:
What this breaks down to is that everything destined to or from the 10.0.0.0 and 192.168.1.0 network will have to cross through eth1 or eth0 and the kernels routing table. The default route is the route that any packets NOT destined for directly attached networks will take. In this case the gateway is 192.168.1.1, the IP of my WAP, and the gateway to the internet.
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
10.0.0.0 * 255.0.0.0 U 0 0 0 eth1
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
Start off by assigning it a static IP:
*Click* Start > Control Panels > Network Conections
Since we have used the 10.0.0.0/8 network for simplicity we'll assign the address 10.0.0.2 with a mask of 255.0.0.0. The default gateway will be 10.0.0.2 (the localhost IP)
Make sure your settings match what you've set and move on to RRAS. I assume you know your way around RRAS, if not. There is plenty of helpful info at the MS knowledgebase. At this point you'll need to configure your static routes to the other host on your network. First setup a route to yourself. The destination net is 10.0.0.0, the mask is 255.0.0.0, and the gateway again, is yourself. Then you'll setup a static route to your linux box. the destination will be 192.168.1.0, the mask will be 255.255.255.0 and the gateway will be 10.0.0.1 (eth1 on your linux box).
If you did everything correctly now you should be able to ping 192.168.1.102 (eth0) from your windows machine. Congratulations!
There are so many different model WAP's there is no easy way to describe how to go about assigning a static IP, but for most small, home office models the management IP is usually 192.168.1.1, 192.168.1.0, 192.168.1.254, or 192.168.1.100. If its different, you may need to consult with your owners manual, or you may have changed it yourself. They usually assign IP's in the standard 192.168.0.0/24 network. You *could* continue to use DHCP to get an address, but you'd have to update your static routes by hand everytime your address changes. This is not a problem, just consider this because it *could* save hair. The last thing you will need to do is setup a static route on your WAP that points towards the 10.0.0.0 network. The destination lan IP would be 10.0.0.0 with a mask of 255.0.0.0. The gateway will be eth0 (192.168.1.102).
At this point its all setup. You should be able to ping the gateway, or the outside world from your Windows machine. The only thing to do is to setup DNS to point towards a suitable (reachable) server on your machines.
If I missed anything by all means point it out. I just decided to write this because I am practicing for my MCSE and I needed to setup a lab. Thing is I didnt have time to run the wires from the other side of the house, so this works for now.
For further reading I'd reccomend Linux TCP/IP Network Administration by Scott Mann. Its a great read. Also the MS knowledge base, the owners manual to your WAP, and good ole google.