# [SOLVED]Can't get to the internet with two cards

## The Doctor

This is a bit embarrassing, but I can't seem to get my server to see the net. This isn't the first time I've dealt with wifi from the command line, but this is the first time it has done this to me.

My server has 2 cards. The Ethernet (which connects automatically) is plugged directly into my desktop on a 192.168.2.6 while my desktop is on 192.168.2.1, but doesn't provide any internet services. This is simply a local connection to provide secure ssh and nfs on. To get the internet I'm setting up the wlan0.

My wpa_supplicant config 

```
network={

   ssid="<Foo>"

   psk="<bar>"

}
```

and my /etc/conf.d/net

```
config_eth0="192.168.2.6 netmask 255.255.255.0"

routes_eth0="default via 192.168.2.1"

modules_wlan0="wpa_supplicant"

wpa_supplicant_wlan0="-Dnl80211"

config_wlan0="192.168.1.6 netmask 255.255.255.0"

routes_wlan0="default via 192.168.1.254"
```

This seems to connect correctly. I can ping the gateway

```
ping -c 3 192.168.1.254

PING 192.168.1.254 (192.168.1.254) 56(84) bytes of data.

64 bytes from 192.168.1.254: icmp_seq=1 ttl=255 time=3.89 ms

64 bytes from 192.168.1.254: icmp_seq=2 ttl=255 time=3.12 ms

64 bytes from 192.168.1.254: icmp_seq=3 ttl=255 time=3.07 ms

--- 192.168.1.254 ping statistics ---

3 packets transmitted, 3 received, 0% packet loss, time 2003ms

rtt min/avg/max/mdev = 3.077/3.364/3.890/0.372 ms
```

But it gets 100% packet loss if I try to ping www.gentoo.org 

```
ping -c 3 89.16.167.134

PING 89.16.167.134 (89.16.167.134) 56(84) bytes of data.

--- 89.16.167.134 ping statistics ---

3 packets transmitted, 0 received, 100% packet loss, time 1999ms
```

So it doesn't do what it is supposed to.

How do I get to the internet?

EDIT: Solution is to run route add default gw 192.168.1.25

----------

## davidm

Sorry I'm not much help.  It's been a while since I set up wlan on Gentoo.  But you might want to show (but censor anything sensitive) the current output of 'route' as it could help provide a clue as to what is going on.  Also maybe 'traceroute 89.16.167.134' as well.  It should show where it's trying to route the packets.  I'm guessing it's sending it to the ethernet connection.

----------

## The Doctor

traceroute gives command not found 

```
route -n                     

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

0.0.0.0         192.168.2.1     0.0.0.0         UG    2      0        0 eth0

0.0.0.0         192.168.1.254   0.0.0.0         UG    2003   0        0 wlan0

127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo

192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0

192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

```

----------

## davidm

I believe that output of route suggests that it is indeed going to your wired connection by default (which has no internet).  From what I recall the lowest metric "wins" and the packets are routed through there.  So the high metric for your WLAN connection (2003) is causing it to route packets to the ethernet connection which has a metric of "2".

I'm not an expert but these topics might be of some help:

https://forums.gentoo.org/viewtopic-t-737588-start-0.html

https://forums.gentoo.org/viewtopic-t-377287-start-0.html

It seems there is a way to do it manually as well as a post from "petrjanda" (but from 2005) detailing a way to manually specify the metric to use in some config files to get it to work automatically.  I hope this helps...or hopefully someone else more experienced will chime in.

Also I would think something like network manager should be able to handle this on it's own.  But you may not want to go that route for various reasons.

----------

## The Doctor

Okay, if I use  route add default gw 192.168.1.25 I can get the net to work correctly. That should do since this interface should only be need very infrequently.

----------

