You are not logged in.

#1 2008-01-22 05:11:52

phabulosa
Member
From: Mountain View, CA
Registered: 2007-10-17
Posts: 182
Website

How to set up a wifi access point

I have successfully build a router/firewall with dnsmasq and shorewall following the Archlinux wiki.


I am just wondering what I need to enable it as an wifi access point

I have successfully set up my wifi card in "AP" mode, because I can see the essid from other device.

At the same time, I was replaced

interface=eth0
to
interface=ath0 in /etc/dnsmasq.conf

It should work, right?

But my devices cannot be assigned any IPs.

Why?

Thanks

Offline

#2 2008-01-22 06:43:17

byte
Member
From: Düsseldorf (DE)
Registered: 2006-05-01
Posts: 2,046

Re: How to set up a wifi access point

Show your dnsmasq.conf (without comments).


1000

Offline

#3 2008-01-22 07:41:27

phabulosa
Member
From: Mountain View, CA
Registered: 2007-10-17
Posts: 182
Website

Re: How to set up a wifi access point

byte wrote:

Show your dnsmasq.conf (without comments).

Here is my dnsmasq.conf

interface=eth0
interface=ath0
dhcp-range=10.0.0.3,10.0.0.14,255.255.255.240,1h

Offline

#4 2008-01-22 07:45:33

phabulosa
Member
From: Mountain View, CA
Registered: 2007-10-17
Posts: 182
Website

Re: How to set up a wifi access point

Here is the network related configuration my rc.conf

eth1="eth1 192.168.2.15 netmask 255.255.255.0 broadcast 192.168.0.255"
eth0="eth0 10.0.0.2 netmask 255.255.255.240 broadcast 10.0.0.15"
ath0="ath0 10.0.0.1 netmask 255.255.255.240 broadcast 10.0.0.15"
INTERFACES=(eth1 eth0 ath0)

gateway="default gw 192.168.2.1"
ROUTES=(gateway)

BTW, I am running this computer behind my current router now before it can replace it. (the type of small dsl routers you can buy)

Offline

#5 2008-01-22 07:54:03

phabulosa
Member
From: Mountain View, CA
Registered: 2007-10-17
Posts: 182
Website

Re: How to set up a wifi access point

I found and resolved some issues.

1. My wifi card uses madwifi driver, so it was not activated as "Master" mode when boot up.
2. I hacked /etc/rc.d/network and add a couple lines
     

# don't bring up an interface that's already up
        [ "$(/sbin/ifconfig ${1} 2>/dev/null | grep UP)" ] && return 0
                # My hacked code in order to set my wifi card (madwifi) in a "master" mode
                eval iwopt="\$wlanopt_${1}"
                if [ "$iwopt" != "" ]; then
                        /bin/sleep 10
                        sh -c "/usr/bin/wlanconfig $1 destroy"
                        sh -c "/usr/bin/wlanconfig $iwopt"
                        /bin/sleep 2
                fi
                # End of my code
        eval iwcfg="\$wlan_${1}"

Also, I add one line in /etc/conf.d/wireless
     

wlanopt_ath0="ath0 create wlandev wifi0 wlanmode ap"

Then, my card is in "master" mode.
3. I experienced new problems:
     My device cannot be assigned with an ip, but the dnsmasq log shows it gave out an ip already.
     I can fix this problem by turning OFF my other interface eth0.

Offline

#6 2008-01-22 07:58:25

phabulosa
Member
From: Mountain View, CA
Registered: 2007-10-17
Posts: 182
Website

Re: How to set up a wifi access point

Questions:

1. What should I do in order to configure dnsmasq to listen on TWO interfaces ( one wired, one wireless) ?
2. Can I assign different dhcp ip range on these two interfaces? What should I do?
3. If I want the two interfaces to assign ips in the same range, what should I do?
4. Can I then set these two interfaces in the same "zone" if I use shorewall as the router/firewall?

Thanks!

I will write my experience of building this wire/wireless router as a wiki because nothing was mentioned in the Arch Wiki pages yet.

Offline

#7 2008-02-05 00:54:00

V01D
Member
Registered: 2006-07-18
Posts: 128

Re: How to set up a wifi access point

I'm interested on answers to these questions also smile

Offline

#8 2008-02-05 06:58:55

phabulosa
Member
From: Mountain View, CA
Registered: 2007-10-17
Posts: 182
Website

Re: How to set up a wifi access point

V01D wrote:

I'm interested on answers to these questions also smile

I pretty much figured out these problems by myself after ignored for days.

Questions:

1. What should I do in order to configure dnsmasq to listen on TWO interfaces ( one wired, one wireless) ?
2. Can I assign different dhcp ip range on these two interfaces? What should I do?

You can add something like the following in /etc/dnsmasq.conf:

interface=eth0
dhcp-range=x.x.x.x,......
interface=ath0
dhcp-range=x.x.x.x,.....

dnsmasq will recognize two interfaces and assign two dhcp-range parameters respectively.

3. If I want the two interfaces to assign ips in the same range, what should I do?

Pretty much you cannot do that. You have to give two interface two DIFFERENT SUBNET.

However, my plan was to give 10.0.0.0~127 to eth0 and 10.0.0.128~255 to ath0. I can do that for sure back tweaking netmask to 255.255.255.128.

You can read very nice explanation in Shorewall docs.

4. Can I then set these two interfaces in the same "zone" if I use shorewall as the router/firewall?

Yes, you can do this. By adding something in /etc/shorewall/interfaces like the following:

loc           eth0                 dhcp,xxx,xxx,xxx,xxx
loc           ath0                 dhcp,xxx,xxx,xxx,xxx

Have fun!!

Offline

#9 2008-02-07 11:00:04

meqif
Member
From: Portugal
Registered: 2006-12-16
Posts: 60
Website

Re: How to set up a wifi access point

3. If I want the two interfaces to assign ips in the same range, what should I do?

Correct me if I'm wrong, but you could create a bridge (br0) composed of eth0 and ath0. That way you have only one interface and one range, I think.

Last edited by meqif (2008-02-08 10:34:05)


Ricardo Martins ><>< ricardomartins.cc ><>< GPG key: 0x1308F1B4

Offline

#10 2008-02-08 01:54:25

phabulosa
Member
From: Mountain View, CA
Registered: 2007-10-17
Posts: 182
Website

Re: How to set up a wifi access point

meqif wrote:

Correct me if I'm wrong, but you could create a bridge (br0) composed of eth0 and ath0. That way you have only one interface and one range, I think.

Yes, I think you can do that.
However, it depends on what you want to achieve. For an example, what I want to do is to separate Wifi and LAN apart, and giving different shorewall (iptable) setup.

That's why I did in a way of my previous post.

Offline

#11 2008-02-08 10:35:32

meqif
Member
From: Portugal
Registered: 2006-12-16
Posts: 60
Website

Re: How to set up a wifi access point

I should have quoted the question I was answering. I edited my post to reflect that. Thanks for sharing your findings with us. smile


Ricardo Martins ><>< ricardomartins.cc ><>< GPG key: 0x1308F1B4

Offline

Board footer

Powered by FluxBB