LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   problem "creating" an access point with dnsmasq (https://www.linuxquestions.org/questions/linux-networking-3/problem-creating-an-access-point-with-dnsmasq-446078/)

samel_tvom 05-18-2006 10:10 AM

problem "creating" an access point with dnsmasq
 
Hello!

I have just purchased a D-link DWL-G520 wireless card. It works with madwifi.
It can connect to my netgear accesspoint/router and everything is fine.

Now I want this card to be an access point. So I do the following:
Code:

#iwconfig ath0 mode Master
#iwconfig ath0 essid "HAXX"
#ifconfig ath0 10.0.0.1

And then I can find it with my laptop (which also can connect to my netgear AP)
So far so good, now I just have to configure dnsmasq (or so he thought...)

My dnsmasq.conf looks like this:

Code:

resolv-file=/etc/resolv.conf
no-poll
domain-needed
bogus-priv
strict-order

interface=ath0
interface=eth1

dhcp-range=192.168.0.10,192.168.0.50,12h
dhcp-range=10.0.0.10,10.0.0.100,12h

dhcp-host=00:0A:E4:52:6B:12,alice
dhcp-host=00:40:CA:45:10:9C,bob

dhcp-authoritative

And the output from ifconfig looks like:
Code:

root@force:~# ifconfig
ath0      Link encap:Ethernet  HWaddr 00:15:E9:30:8C:4A 
          inet addr:10.0.0.1  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::215:e9ff:fe30:8c4a/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1492  Metric:1
          RX packets:192 errors:689383 dropped:0 overruns:0 frame:689383
          TX packets:8 errors:282 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:200
          RX bytes:104152 (101.7 KiB)  TX bytes:1648 (1.6 KiB)
          Interrupt:5 Memory:c8b40000-c8b50000

eth0      Link encap:Ethernet  HWaddr 00:40:CA:1C:97:77 
          inet addr:85.235.31.133  Bcast:85.235.31.255  Mask:255.255.255.0
          inet6 addr: fe80::240:caff:fe1c:9777/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:517621 errors:0 dropped:0 overruns:0 frame:0
          TX packets:72772 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:69874515 (66.6 MiB)  TX bytes:70195546 (66.9 MiB)
          Interrupt:11 Base address:0x1080

eth1      Link encap:Ethernet  HWaddr 00:90:27:5C:A0:5A 
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::290:27ff:fe5c:a05a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:263787 errors:0 dropped:0 overruns:0 frame:0
          TX packets:723590 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:45560011 (43.4 MiB)  TX bytes:762141527 (726.8 MiB)

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:72953 errors:0 dropped:0 overruns:0 frame:0
          TX packets:72953 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:21471070 (20.4 MiB)  TX bytes:21471070 (20.4 MiB)

So I thought everything was tiptop. On the AP I issue
Code:

#dnsmasq -d
When I try to connect to the AP with my laptop by doing

Code:

#iwconfig wlan0 essid "HAXX"
#dhcpcd wlan0 (have tried dhclient as well)

I get no ip, but the AP gives:

Code:

root@force:/var/lib/misc# dnsmasq -d
dnsmasq: started, version 2.22 cachesize 150
dnsmasq: DHCP, IP range 10.0.0.10 -- 10.0.0.100, lease time 12h
dnsmasq: DHCP, IP range 192.168.0.10 -- 192.168.0.50, lease time 12h
dnsmasq: read /etc/hosts - 12 addresses
dnsmasq: reading /etc/resolv.conf
dnsmasq: using nameserver 81.88.9.220#53
dnsmasq: using nameserver 81.88.9.218#53
dnsmasq: DHCPDISCOVER(ath0) 00:0e:2e:3f:37:f5
dnsmasq: DHCPOFFER(ath0) 10.0.0.10 00:0e:2e:3f:37:f5
dnsmasq: DHCPDISCOVER(ath0) 00:0e:2e:3f:37:f5
dnsmasq: DHCPOFFER(ath0) 10.0.0.10 00:0e:2e:3f:37:f5
dnsmasq: DHCPDISCOVER(ath0) 00:0e:2e:3f:37:f5
dnsmasq: DHCPOFFER(ath0) 10.0.0.10 00:0e:2e:3f:37:f5

It looks like the AP tries to offer the ip but somehow it doesn't work. I know that it's nothing wrong on the client side, because if issue the command on the client(laptop):
Code:

#iwconfig wlan0 essid "NETGEAR"
#dhcpcd wlan0

I get an ip.

What's wrong, how should I fix it?

Thanks!

amocjr 01-12-2008 07:59 PM

Did you ever solve this? I'm having a very similar problem, but with wired clients. If you did solve it, your solution would be appreciated.

samel_tvom 01-13-2008 11:08 AM

Hi there,

Don't know if it'll help 'cause I don't use the card as a connectionpoint anymore. But when I did, I had things set up something like this:
Code:

ifconfig ath0 down
ifconfig wifi0 down
wlanconfig ath0 destroy
wlanconfig ath0 create wlandev wifi0 wlanmode ap
iwconfig ath0 essid FreeNet
ifconfig ath0 192.168.1.1 up

My firewall settings are:
Code:

IPTABLES='/sbin/iptables'
EXTIF='eth0'
INTIF='eth1'
WLAN='ath0'
WAN='85.24.184.122'
        /bin/echo 1 > /proc/sys/net/ipv4/ip_forward

        $IPTABLES -F
        $IPTABLES -X

        $IPTABLES -X -t nat
        $IPTABLES -F -t nat

        $IPTABLES -X -t filter
        $IPTABLES -F -t filter

        # enable masquerading to allow LAN internet access
        $IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE

        # forward LAN traffic from $INTIF1 to Internet interface $EXTIF
        $IPTABLES -A FORWARD -i $INTIF -o $EXTIF -m state --state NEW,ESTABLISHED -j ACCEPT
      # allow ping
        $IPTABLES -A INPUT -p icmp -i $EXTIF -j ACCEPT

        # Allowing access to the FTP server"
        $IPTABLES -A INPUT -i $EXTIF -p tcp --dport 21 -j ACCEPT

        ### SUBNET 192.168.0.1 ###

        ## Allowing access to the NFS server
        ## $IPTABLES -A INPUT -i $INTIF -p tcp --dport 2049 -j ACCEPT




        # ftp ports - supports passive mode
        $IPTABLES -A INPUT -i $EXTIF -p tcp --dport 50000:60000 -j ACCEPT
        $IPTABLES -A OUTPUT -p tcp --source-port 50000:60000 -j ACCEPT


        # Allowing access to the ssh server on port 22
        $IPTABLES -A INPUT -i $EXTIF -p tcp --dport 22 -j ACCEPT

        # Allowing access to the web server on port 80
        $IPTABLES -A INPUT -i $EXTIF -p tcp --dport 80 -j ACCEPT


        # DC port, see http://www.nongnu.org/microdc
        $IPTABLES -A INPUT -i $EXTIF -p tcp --dport 10101 -j ACCEPT

        # bittorrent ports
        $IPTABLES -A INPUT -i $EXTIF -p tcp --dport 6881:6999 -j ACCEPT
        $IPTABLES -A OUTPUT -p tcp --source-port 6881:6999 -j ACCEPT

        # TOR PORTS
  # ORPort 9001
        $IPTABLES -A INPUT -i $EXTIF -p tcp --dport 9001 -j ACCEPT
        # DirPort 9030
        $IPTABLES -A INPUT -i $EXTIF -p tcp --dport 9030 -j ACCEPT



        # block out all other Internet access on $EXTIF
        $IPTABLES -A INPUT -i $EXTIF -m state --state NEW,INVALID -j DROP
        $IPTABLES -A FORWARD -i $EXTIF -m state --state NEW,INVALID -j DROP


        #### $IPTABLES -A OUTPUT -p tcp --dport 22 -j ACCEPT

        # doesn't belong here but what the heck
        route add -host 255.255.255.255 dev eth1

Can't really help you to much, I'm in CAR and my server is in sweden, really don't wanna mess with settings.

Good luck!


All times are GMT -5. The time now is 08:47 PM.