1

I have raspbian installed on my Raspberry Pi with a working network adapter. I have setup my /etc/network/interfaces file like the following

auto lo
iface lo inet loopback
iface eth0 inet dhcp
iface eth0 inet static
 address 192.168.1.100
 netmask 255.255.255.0
 gateway 192.168.1.1
allow-hotplug wlan0
iface wlan0 inet static
 address 192.168.2.200
 netmask 255.255.255.0
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet static
 address 192.168.42.1
 netmask 255.255.255.0
up iptables-restore < /etc/iptables.ipv4.nat

I am able to connect through SSH at address 192.168.1.100(which is ethernet - eth0), but I cannot seem to connect to SSH at address 192.168.2.200(which is wifi - wlan0)

  • I have tried changing the last address end decimals many times encase the number is reserved, but the problem still persists.

  • I have tried rebooting the system 4 times

ifconfig -a shows that wlan0 does have an IP assigned to it

eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:22
 inet addr:192.168.1.6 Bcast:192.168.1.255 Mask:255.255.255.0
 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
 RX packets:2032 errors:0 dropped:0 overruns:0 frame:0
 TX packets:1353 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:1000
 RX bytes:1973327 (1.8 MiB) TX bytes:646906 (631.7 KiB)
lo Link encap:Local Loopback
 inet addr:127.0.0.1 Mask:255.0.0.0
 UP LOOPBACK RUNNING MTU:65536 Metric:1
 RX packets:10 errors:0 dropped:0 overruns:0 frame:0
 TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:0
 RX bytes:500 (500.0 B) TX bytes:500 (500.0 B)
wlan0 Link encap:Ethernet HWaddr 22:22:22:22:22:22
 inet addr:192.168.2.200 Bcast:192.168.2.255 Mask:255.255.255.0
 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
 RX packets:10 errors:0 dropped:0 overruns:0 frame:0
 TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:1000
 RX bytes:1584 (1.5 KiB) TX bytes:288 (288.0 B)

netstat -nlt returns

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:3389 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:3350 0.0.0.0:* LISTEN

iptables -L -nv returns

Chain INPUT (policy ACCEPT 72 packets, 4383 bytes)
 pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 50 packets, 6512 bytes)
 pkts bytes target prot opt in out source destination
asked Sep 3, 2015 at 20:27
7
  • Can you ping the RPi at both addresses? Commented Sep 4, 2015 at 0:22
  • When I run ping from a windows machine, I get a reply from 192.168.1.100 but request timed out from 192.168.2.200. What does this indicate Commented Sep 4, 2015 at 5:28
  • I'm going to guess that the Windows machine is connected to the 192.168.1.0/24 wired subnet, right? Try this: Connect to your 192.168.2.0/24 network and try pinging 192.168.2.200. Connect to your 192.168.1.0/24 network and try pinging the 192.168.1.100 address. If you can ping the "local" IP but never the IP on another subnet, you are lacking a route to get to the other subnet. If you want to route through the RPi, Martin's advice below applies... If the RPi is either your default gateway, or routes to your other router. Otherwise, your normal router is needs a route to both subnets. Commented Sep 4, 2015 at 5:49
  • @bobstro You have found the issue, however I was able to discover this by changing my wlan0 config like address 192.168.1.200, as this is apart of the same subnet as eth0 it now allows me to connect. Is it possible for me to have the wlan0 on another subnet? The problem is having them on the same subnet causes confict with isc-dhcp-server - as this software cannot run interfaces on the same subnet. So I have to sacrifice one over the other, which I cannot do. Thanks for your input Commented Sep 4, 2015 at 15:47
  • I'm not clear on what you're trying to do. You have isc-dhcp-server on your RPi and it's conflicting with your existing dhcp server perhaps? You have two main options using two interfaces (or more) on the RPi: Bridge the traffic (wlan0 and eth0 are same network, one subnet typically) or route (wlan0 and eth0 are different networks, different subnets). If routing, you can do NAT and other firewall tricks. Perhaps it would be best if you simply elaborated on what you're trying to do in the end. Commented Sep 4, 2015 at 17:24

2 Answers 2

1

Another solution would be to use a bridge.

No need for the wifi to have it's own IP.

You can do

sudo apt-get install bridge-utils

Then

auto eth0
iface eth0 inet manual
auto wlan0
iface wlan0 inet manual
auto br0
iface br0 inet static
 bridge_ports eth0 wlan0
 address 192.168.1.100
 netmask 255.255.255.0
 gateway 192.168.1.1

eth0 and wlan0 will share the same IP and act as one interface.

If it works with one interface it should work with the other.

You can also add wlan1 easily with bridge_ports eth0 wlan0 wlan1

Good luck!

answered Apr 1, 2016 at 11:21
0

I'm guessing you have a routing problem. From which IP address are you trying to connect to the wifi's IP? If you're not in the same network as the interface you're trying to connect to, then you'll need to activate IP forwarding on the pi:

root@pi# sysctl net.ipv4.ip_forward=1

Also, are you sure that the machine you're trying to connect from (aka 'ssh-client') knows how to find its way to the pi's wifi network? If the pi is not the default gateway, you have to set the route accordingly:

user@ssh-client$ sudo ip route add 192.168.2.0/24 via 192.168.1.6

If the routing is fine, can you confirm that sshd on the pi actually is listening on all the neccessary IPs?

user@pi$ netstat -nlt

should show a line like this:

tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN

Check /etc/ssh/sshd_config on the pi for interesting settings.

Finally, the firwall on either the pi or the ssh-client might be in your way. You can check them with iptables -L -nv.

Hope this points you in the right direction, Martin

answered Sep 3, 2015 at 22:02
1
  • thanks, I have updated my original post with many of your cmds and there output. I am still trying to find a solution, planning to remove some of the other connections I have in my pi to attempt elimination process. Commented Sep 4, 2015 at 5:35

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.