# Wireless wlan0 can connect and get IP but not reach internet

## Thaidog

I am trying to get a wireless card (ndiswrapper) to see the internet. It can get an IP from multiple APs but can not reach the internet on any of them. It should be able to see b networks also, but they are not coming up.

card: bxm43xx Linksys WMP54GS

currently using wireless-tools

----------

## NeddySeagoon

Thaidog,

Multiple APs on the same network or multiple APs on different networks ?

Multiple APs at the same time ?

Thats unlikely to work because I don't think you can associate with more than one AP at a time.

Post the ourput of route, so we can see your routing table and the content of /etc/resolv.conf so we can look at your nameserver setup.

----------

## Thaidog

 *NeddySeagoon wrote:*   

> Thaidog,
> 
> Multiple APs on the same network or multiple APs on different networks ?
> 
> Multiple APs at the same time ?
> ...

 

Multiple APs on different networks - not at the same time. Manually connecting to them with:

wilist wlan0 scan

iwconfig wlan0 essid linksys

dhcp -t 1- wlan0

Output or route:

zawacki danz # route

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.1.0     *               255.255.255.0   U     0      0        0 wlan0

192.168.0.0     *               255.255.255.0   U     0      0        0 eth1

loopback        *               255.0.0.0       U     0      0        0 lo

default         192.168.0.100   0.0.0.0         UG    0      0        0 eth1

zawacki danz # cat /etc/resolv.conf

# Generated by dhcpcd from eth1, wlan0

# /etc/resolv.conf.head can replace this line

search Nostro hargray.com

nameserver 192.168.0.100

nameserver 64.203.254.30

nameserver 64.203.254.31

# /etc/resolv.conf.tail can replace this line

----------

## NeddySeagoon

Thaidog,

Your routing table, reformatted for easy reading

```
Destination   Gateway       Genmask       Flags Metric Ref Use Iface

192.168.1.0      *          255.255.255.0  U      0     0  0   wlan0

192.168.0.0      *          255.255.255.0  U      0     0  0   eth1

loopback         *          255.0.0.0      U      0     0  0   lo

default       192.168.0.100 0.0.0.0        UG     0     0  0   eth1
```

A few things, wlan0 can only reach the 192.168.1.0/24 network as it lacks a route anywhere else.

Your default route, which is a catch all for packets not routed by earlier entries in the routing table sends things to 192.168.0.100 on eth1.

To reach the internet using wlan0, you need it to have the default route, presumably yu have another route to the internet on the  192.168.1.0/24 network ?

You may normally only have a single default route at a time.

----------

## Thaidog

 *NeddySeagoon wrote:*   

> Thaidog,
> 
> Your routing table, reformatted for easy reading
> 
> ```
> ...

 

Whoops sorry about the formating. This computer I am setting up will only connect to the Internet with the wlan0 connection. right now I have a second nic card in it just so I can set it up (it will go to a friend's house) 

Right now I am connecting it to different neighbor's ap's because it does not want to see my two g/b and b aps for some reason (although it will see both of mine after wlan0 connects to an AP on the b channel and you rescan for APs)

----------

## Thaidog

OK I am trying to test the networ on the ssid "linksys" so the ifconfig wlan0 says this:

```
wlan0     Link encap:Ethernet  HWaddr 00:1A:70:38:7A:EB

          inet addr:192.168.1.108  Bcast:192.168.1.255  Mask:255.255.255.0

          inet6 addr: fe80::21a:70ff:fe38:7aeb/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:4 errors:0 dropped:0 overruns:0 frame:0

          TX packets:20 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:1300 (1.2 Kb)  TX bytes:1965 (1.9 Kb)

          Interrupt:19 Memory:fcffc000-fcffe000

```

So I added this to /etc/conf.d/net:

routes_wlan0=( "192.168.1.100/254 via 192.168.1.255" )

But it is still not seeing www.ggole.com (even after reboot)

It seems to not really see anything in mt /etc/conf.d/net file at all!

----------

## Thaidog

Ok I added a default route of 192.168.1.1 and now I can acces the internet.

----------

## NeddySeagoon

Thaidog,

```
routes_wlan0=( "192.168.1.100/254 via 192.168.1.255" ) 
```

The 100/254 has to be wrong, the 254 is a bit count of the network part of the IP address, normally /24 for a 192.168.x.x network

via  192.168.1.255 looks a bit suspicious too. 192.168.1.255 would normally be your broadcast address.

To get to the internet, you need a default route for wlan0 and not for the wired card. 

Start the system normally, so route looks like:-

```
Destination   Gateway       Genmask       Flags Metric Ref Use Iface

192.168.1.0      *          255.255.255.0  U      0     0  0   wlan0

192.168.0.0      *          255.255.255.0  U      0     0  0   eth1

loopback         *          255.0.0.0      U      0     0  0   lo

default       192.168.0.100 0.0.0.0        UG     0     0  0   eth1
```

Stop eth1 with

```
 /etc/init.d/net.eth1 stop
```

 so route looks like:-

```
Destination   Gateway       Genmask       Flags Metric Ref Use Iface

192.168.1.0      *          255.255.255.0  U      0     0  0   wlan0

loopback         *          255.0.0.0      U      0     0  0   lo
```

Now add a default route for wlan0 with

```
route add default gw <IP Addr of gateway>
```

<IP Addr of gateway> will be 192.168.1.... whatever the next hop towards the internet is, often the wireless AP IP.

Now, as you are on a borrowed AP, the nameservers in /etc/resolv.conf may not work, it will be OK if you are on the same ISP.

If you have problems, change the first nameserver to 4.2.2.1, which is a public namserver.

----------

## Thaidog

 *NeddySeagoon wrote:*   

> Thaidog,
> 
> ```
> routes_wlan0=( "192.168.1.100/254 via 192.168.1.255" ) 
> ```
> ...

 

looks like I posted at the same time you did... just got it working. 

Any tips on how to get it up at boot time?

----------

## NeddySeagoon

Thaidog,

You need to set it up like this

----------

## Thaidog

 *NeddySeagoon wrote:*   

> Thaidog,
> 
> You need to set it up like this

 

Actually I have been following that guide with wireless-tools - It seems like my /etc/conf.d/net file is not working with the wireless mods I made:

```

zawacki danz # cat /etc/conf.d/net

# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /etc/conf.d/net.example and save your configuration

# in /etc/conf.d/net (this file :]!).

#config_eth0=( "null" )

config_eth1=( "dhcp" )

config_eth2=( "null" )

modules=( "iwconfig" )

#wpa_supplicant_eth2="b43-pci-bridge"

#iwconfig_eth2="mode_managed"

config_wlan0=( "dhcp" )

essid_wlan0="linksys"

dns_servers_linksys=( "192.168.1.1" )

# Prefer iwconfig over wpa_supplicant

#modules=( "iwconfig" )

routes_wlan0=( "192.168.1.1/24 via 192.168.1.1" )

# Configure WEP keys for Access Points called ESSID1 and ESSID2

# You may configure up to 4 WEP keys, but only 1 can be active at

# any time so we supply a default index of [1] to set key [1] and then

# again afterwards to change the active key to [1]

# We do this incase you define other ESSID's to use WEP keys other than 1

#

# Prefixing the key with s: means it's an ASCII key, otherwise a HEX key

#

# enc open specified open security (most secure)

# enc restricted specified restricted security (least secure)

key_ESSID1="[1] s: key [1] enc open"

#key_ESSID2="[1] aaaa-bbbb-cccc-dd key [1] enc restricted"

# The below only work when we scan for available Access Points

# Sometimes more than one Access Point is visible so we need to

# define a preferred order to connect in

preferred_aps=( "linksys" "zawacki" )

```

----------

