# Setting up wireless gateway

## andrewwalker27

I'm trying to build a home router and so far so good following this guide

http://www.gentoo.org/doc/en/home-router-howto.xml

I've got the wired networking working ok but I'm having trouble with adding wireless, I want to use the server as a wireless router as well. 

I've got an rt61 pci wireless card I was hoping to use on the server but I can't seem to find a decent guide or even whether it is possible or not. The interface is available as wlan0 but I read somewhere that you need a card that supports 'master mode' and the rt61 driver apparently doesn't.

If this card is no good, I also have this one,

http://www.kcorplifestyle.com/products/silverSeriesG2/KLS-660/KLS-660.htm

which is based on rt2500 chipset but again the details are a bit vague about 'master mode'.

Can anyone point me in the right direction please?

----------

## DONAHUE

```
iwconfig wlan0 mode Master
```

errors? and 

```
dmesg
```

 look at the last 20 or so lines for relevant info about rt61 and wlan0

----------

## andrewwalker27

I take it that this means no!

redserver fred # iwconfig wlan0 mode Master

Error for wireless request "Set Mode" (8B06) :

    SET failed on device wlan0 ; Invalid argument.

fredserver fred # 

Here's the dmeg data

rt61pci 0000:04:09.0: PCI INT A -> Link[APC2] -> GSI 17 (level, low) -> IRQ 17

rt61pci 0000:04:09.0: firmware: requesting rt2561s.bin

NET: Registered protocol family 10

lo: Disabled Privacy Extensions

ADDRCONF(NETDEV_UP): wlan0: link is not ready

----------

## DONAHUE

at least with the driver running at the time.

```
lo: Disabled Privacy Extensions
```

probably tells us that ralink doesn't want us common folk building wireless routers. The same chips are used in dedicated routers.

----------

## andrewwalker27

I thought that the rt chipsets were open source?

----------

## andrewwalker27

Well I've got the rt2500 working using hostapd more by luck than judgement, I can now see the wireless point, I just can't connect to it!

Do I need to set up a dhcp server on the wireless adaptor to be able to connect or is it more complicated than that?

----------

## cwr

I messed around a  lot with an old RT2500 card and drivers, and never got it to work with hostapd.

Using an ath9k card I got things working with the following scripts (which assume hostapd is

running and happy):

```

#!/bin/bash

# Set up routing.

#route add -net 193.237.32.0 netmask 255.255.255.255 gw 193.237.32.208 dev eth0

#route add default gw 193.237.32.208 dev eth0

# Drop current routes.

route del -net 193.237.32.224 netmask 255.255.255.224

route del -net 193.237.32.192 netmask 255.255.255.224

# Add new routes.

route add -net 193.237.32.192 netmask 255.255.255.224 gw 193.237.32.196 dev eth0

route add -net 193.237.32.224 netmask 255.255.255.224 gw 193.237.32.225 dev wlan0

# Show results.

route -n

# Set up proxy arp.

echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp

echo 1 > /proc/sys/net/ipv4/conf/wlan0/proxy_arp

echo 1 > /proc/sys/net/ipv4/ip_forward

# eof

```

As you can see, it's all bit experimental - I don't generally use the access point.

The ARP setup code in full is:

```

#!/bin/bash

# Sort out routing between interfaces.

#  1. Assign an IP address to both left and right interfaces.

#  2. Create routes to the hosts on the left and on the right.

route -n

#  3. Turn on proxy-ARP on both interfaces:

echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp

echo 1 > /proc/sys/net/ipv4/conf/wlan0/proxy_arp

#     where L and R stand for the numbers of your interfaces on

#    the left and on the right side

#  4. Turn on the ip_forwarding flag:

echo 1 > /proc/sys/net/ipv4/ip_forward

# For permanence, add or uncomment the following line in /etc/sysctl.conf:

# net.ipv4.ip_forward = 1

```

If hostapd is working, those scripts should give you a starting point.

Good luck - Will

----------

## andrewwalker27

Many thanks for the info, looks like I might have to look around for a new wireless card though!

----------

## JC99

I have an atheros wireless card using the ath5k kernel driver for my wireless access point.

Here is my wireless access point setup. 

Maybe that guide can help you out if you decide to buy an atheros wireless card. That guide is my exact setup and everything works great.

----------

## andrewwalker27

Don't suppose you could give me an idea of which card to buy and where from, either PCI or PCI express would do. I'm guessing that there chipsets exist in numerous manufacturers cards and I wouldn't know which one to get.

----------

## cwr

I use a T-Link card, but I don't have the exact ID; I think most if not all of them use Atheros,

and mine, which is about a year old, works fine with hostapd and the current drivers.

Will

----------

