Jump to content

Set the correct routes for at0 **Bounty for solution**


Mr.miYagi

Recommended Posts

Hi all

Im stuck @ setting up a wifi AP on a Pineapple. Tried on a laptop with the same results. Im sure the fault is a routing issue. Its driving me crazy since day's / weeks.

Tried different setups and infusions but i dont get it working.

So now im willing to give 0.10 BTC (or equivalent in you FIAT) bounty for a solution.

Here the setup:

PIneapple is connected trough a lan cable to a linux laptop, wp5 script is running there, so the pineapple has WAN, laptop too.

Plug in Alfa wifi card, will be listed as wlan1

airmon-ng start wlan1

start airbase-ng, on wlan1 - created interface at0 is listed

After that i put at0 up and bridge it with br-lan

ifconfig at0 up

br-ctl addif br-lan at0

Now the clients gets a ip (range 172.16.42.100-150) in the logs i can see the replies from dnsmask. But the clients didnt get WAN/internet. While the to connection to the Pineapple (172.16.42.1) web portal is very slow.

I can install infusions, so internet is working, And with the networkmanager infusion i can get up and working a AP with wlan1.

I think im missing something with setting up at0 on a Ip or set a route. But every combinazion a try, it didnt work.

Something like: ifconfig at0 172.16.42.xxx netmask 255.255.255.0

add route -net xxx.xxx.xxx.xxx netmask 255.255.255.0 gw xxx.xxx.xxx.xxx

I used the search function and google. Found a lot about that, but not specific in case of at0 and wifi pineapple.

Thanks for help

Link to comment
Share on other sites

The pineapple has already bridget eth0(wan)/wlan0/1

Before i start "brctl show" lists this:
Bridge-name

br-lan

STP enabled

no

interfaces

eth0

wlan1

So your solution:

ifconfig at0 up (thats exactly what im doing)

br-ctl addif br-lan at0 (same as by now)

br-ctl addif br-lan wlan0 (i dont use this interface, why bridge it? U meant wlan1? Itsalready bridged...)

In the logs i see dnsmasq ack for IP, but still no internet for my clients...

so at0 and eth0 are bridget correctly, something with the IP routing must be wrong. Do i have to set a IP for at0?

So still no internet on my clients...

Link to comment
Share on other sites

Route Table:

Destination Gateway Genmask Flags Metric Ref Use Iface
default 172.16.42.42 0.0.0.0 UG 0 0 0 br-lan
172.16.42.0 * 255.255.255.0 U 0 0 0 br-lan

Wlan1 has no ip, since the command "ifconfig at0 up" is executed without a ip nor netmask.

Tried something new:

The wlan0/1 is managed by hostapd, and maybe cause some problem to my at0 interface.

So now i tried to stop the hostapd with "killall hostapd"

now wlan0/1 disappears from ifconfig. Still there the br-lan interface with the 172.16.42.1 adress.

then i restart my steps,

airmon-ng start wlan1 (create interface mon0)

airbase-ng -e test -P -C 30 -c 6 mon0 (create interface at0)

ifconfig at0 up

brctl addif br-lan at0

now i see at0 on ifconfig and brctl. But now i dindt get even an ip on clients.

This is the job from dnsmasq right? How to repoint dnsmasq on at0 without messing up the already working settings?

Link to comment
Share on other sites

Don't do a killall hostapd. i suggest you reboot your pineapple now to make sure all services and configurations are loaded proper.

We also need your GW ip adress, subnet and all of that stuff. If i'm correct, this is your setup:

Alfa <=USB=>Pineapple<=ethernet=>laptop

^

||

Wireless

||

v

Router/gw/ap/internet

Link to comment
Share on other sites

more like that:



Alfa <=USB=>Pineapple(172.16.42.1 on br-lan)<=ethernet=>laptop(172.16.42.42 on eth0)


^


||


Wireless (192.168.2.102 on wlan0)


||


v


Router/gw/ap/internet (192.168.2.100)




After a factory reset and fresh connection to a laptop i have in ifconfig:


br-lan ip:172.16.42.1 bcadd:172.16.42.255 mask: 255.255.255.0


eth0 with no ip


and routes as statet in post above


/etc/config/dhcp



config 'dnsmasq'
option 'domainneeded' '1'
option 'boguspriv' '1'
option 'filterwin2k' '0'
option 'localise_queries' '1'
option 'rebind_protection' '1'
option 'rebind_localhost' '1'
option 'local' '/lan/'
option 'domain' 'lan'
option 'expandhosts' '1'
option 'nonegcache' '0'
option 'authoritative' '1'
option 'readethers' '1'
option 'leasefile' '/tmp/dhcp.leases'
option 'resolvfile' '/tmp/resolv.conf.auto'

config 'dhcp' 'lan'
option 'interface' 'lan'
option 'start' '100'
option 'limit' '150'
option 'leasetime' '12h'
option 'ignore' '0'
list 'dhcp_option' '3,172.16.42.42'
list 'dhcp_option' '3,172.16.42.1'
list 'dhcp_option' '6,172.16.42.1,8.8.8.8'
list 'dhcp_option' '6,172.16.42.1,208.67.222.222'

#config 'dhcp' 'wan'
# option 'interface' 'wan'
# option 'ignore' '1'
# option 'start' '100'
# option 'limit' '150'
# option 'leasetime' '12h'
# list 'dhcp_option' '3,172.16.42.42'
# list 'dhcp_option' '6,172.16.42.1,8.8.8.8'
# list 'dhcp_option' '6,172.16.42.1,208.67.222.222'
Edited by Mr.miYagi
Link to comment
Share on other sites

Ok for that kind of setup your better of settting a static ip on your laptop. lets say 172.16.42.254 ( this becomes your GW for the 172.16.42.XXX network, DO NOT SET A GW HERE )

Also enable ip routing on this device. ( if its windows use enable share internet connection on wireless, also check firewalling )

Linux you need something like:

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
iptables -A FORWARD -i eth0 -j ACCEPT

Now configure the Pineapple:

nameserver as 8.8.8.8 or 8.8.4.4 ( or 192.168.2.100 if router does dns )

DHCP server settings in pineapple:

dns set as 172.16.42.1

gateway set as 172.16.42.254

Now you run your commands:

airmon-ng start wlan1
start airbase-ng, on wlan1 - created interface at0 is listed
ifconfig at0 up
br-ctl addif br-lan at0

Then should do it. If not do the following tests:

ping 172.16.42.1

ping 172.16.42.254

ping 192.168.2.100

nslookup www.google.com or dig www.google.com ( dont know wich command you use )

Link to comment
Share on other sites

The laptop has a static ip 172.16.42.42

This is made by the wp4.sh script from the pineapple wiki.

So you mean i have to change this adress?

But when i do this, the pineapple will loose connection to my Laptop?!

When i activate the wlan0 as ap, it dosent change the ip from the laptop and its working. So it must work also with the wlan1/at0?

Iprefer to keep the setting on my laptop, because they are set automatically and later i want to change to a 3g stick.

It must be possible to swap the configuration from wlan0 to at0.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...