View previous topic :: View next topic |
Author |
Message |
The Doctor Moderator
Joined: 27 Jul 2010 Posts: 2678
|
Posted: Mon May 04, 2015 12:19 am Post subject: [SOLVED]Can't get to the internet with two cards |
|
|
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 Code: | network={
ssid="<Foo>"
psk="<bar>"
} |
and my /etc/conf.d/net Code: | 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 Code: | 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 Code: | 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 _________________ First things first, but not necessarily in that order.
Apologies if I take a while to respond. I'm currently working on the dematerialization circuit for my blue box.
Last edited by The Doctor on Mon May 04, 2015 1:51 am; edited 1 time in total |
|
Back to top |
|
|
davidm Guru
Joined: 26 Apr 2009 Posts: 557 Location: US
|
Posted: Mon May 04, 2015 1:14 am Post subject: |
|
|
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. |
|
Back to top |
|
|
The Doctor Moderator
Joined: 27 Jul 2010 Posts: 2678
|
Posted: Mon May 04, 2015 1:19 am Post subject: |
|
|
traceroute gives command not found Code: | 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
|
_________________ First things first, but not necessarily in that order.
Apologies if I take a while to respond. I'm currently working on the dematerialization circuit for my blue box. |
|
Back to top |
|
|
davidm Guru
Joined: 26 Apr 2009 Posts: 557 Location: US
|
Posted: Mon May 04, 2015 1:31 am Post subject: |
|
|
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. |
|
Back to top |
|
|
The Doctor Moderator
Joined: 27 Jul 2010 Posts: 2678
|
Posted: Mon May 04, 2015 1:51 am Post subject: |
|
|
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. _________________ First things first, but not necessarily in that order.
Apologies if I take a while to respond. I'm currently working on the dematerialization circuit for my blue box. |
|
Back to top |
|
|
|