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
2 Answers 2
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!
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
-
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.buntybudia– buntybudia2015年09月04日 05:35:07 +00:00Commented Sep 4, 2015 at 5:35
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.