snowboardinsteve
Posts: 2
Joined: Sun Jan 20, 2013 12:41 pm

Routing help with 2 interfaces - wireless and wired

Mon Mar 25, 2013 7:19 pm

Hello guys and girls,

Fairly new to Linux, need a bit of help with networking if anyone would be so kind. I'm trying to use the Pi as an intermediary to wake-on-lan my PC as my house is all wireless. I want to remotely SSH to my Pi which is wired to my PC and send the magic packet over the ethernet cable. Basically I want this chain to happen:
Me => Internet => My router => WiFi => Pi => Wired ethernet => PC.

The beginning and end of that process work fine, and I can get the Pi to see both local networks at the same time, but I can't seem to also access the internet from the Pi.

Here's my set-up right now:
10.0.0.x is the wired connection, where the Pi is the gateway 10.0.0.1 and my pc is 10.0.0.2
192.168.0.x is the wireless network, where the router is 192.168.0.1 and the Pi is 192.168.0.6

cat /etc/network/interfaces

Code: Select all

# Loopback network interface for local connections
auto lo
iface lo inet loopback

# Configure WiFi LAN
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
        wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

# Configure ethernet LAN
auto eth0
iface eth0 inet static
        address 10.0.0.1
        netmask 255.255.255.0
        gateway 10.0.0.1

# Required
iface default inet dhcp
sudo route -n

Code: Select all

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.0.1        0.0.0.0         UG    0      0        0 eth0
10.0.0.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0
I understand that my routing table is wrong, and I've been experimenting with adding routes to the interfaces file for most of the day but I always seem to break one or both of the interfaces. With the configuration above I can ping the router and my PC successfully, but I can't access the internet.

So how do I set wlan0 to be the default interface, and just send 10.0.0.x through eth0?

Many thanks,
Stephen

broo0ose
Posts: 317
Joined: Wed Dec 14, 2011 3:59 pm
Location: Wirral, UK

Re: Routing help with 2 interfaces - wireless and wired

Mon Mar 25, 2013 10:04 pm

I'd try

Code: Select all

sudo route add default gw 192.168.0.1 wlan0
HTH

snowboardinsteve
Posts: 2
Joined: Sun Jan 20, 2013 12:41 pm

Re: Routing help with 2 interfaces - wireless and wired

Mon Mar 25, 2013 11:52 pm

broo0ose wrote:I'd try

Code: Select all

sudo route add default gw 192.168.0.1 wlan0
HTH
Perfect, thank you!

For anyone stumbling across this at a later date let me just say that routes added from the terminal are cleared when the system reboots. To make them persistent I used:

Code: Select all

sudo nano /etc/network/interfaces
and added this to the end of the file:

Code: Select all

# Routing
post-up route del default gw 10.0.0.1 eth0
post-up route add default gw 192.168.0.1 wlan0

Ced
Posts: 22
Joined: Thu Jan 03, 2013 5:33 pm
Location: Martinique, FWI

Re: Routing help with 2 interfaces - wireless and wired

Sat Mar 30, 2013 12:35 am

Do you think this configurations applies if i connect my Pi on internet with a dongle WiFi and i connect it with ethernet wire on an ethernet relay board ?

jgillard
Posts: 2
Joined: Mon Apr 29, 2013 8:16 pm

Re: Routing help with 2 interfaces - wireless and wired

Mon Apr 29, 2013 8:18 pm

I don't know if I should make a new thread or continue this one but I'm trying to do the same thing as the OP. I've tried the wakeonlan package but that won't force the WOL over ethernet, and I'm afraid I don't know the steps to replicate what's being done in the messages above me. Any help would be much appreciated

broo0ose
Posts: 317
Joined: Wed Dec 14, 2011 3:59 pm
Location: Wirral, UK

Re: Routing help with 2 interfaces - wireless and wired

Tue Apr 30, 2013 8:26 pm

jgillard wrote:I don't know if I should make a new thread or continue this one but I'm trying to do the same thing as the OP. I've tried the wakeonlan package but that won't force the WOL over ethernet, and I'm afraid I don't know the steps to replicate what's being done in the messages above me. Any help would be much appreciated
The steps above are just about routing between 2 networks, one on wired ethernet, the other on WiFi. I don't think 2 networks are necessary to implement WoL so this thread may be a red herring for you. I'd start a new thread and ask the question from scratch I'm sure someone can help.

Return to “Networking and servers”