0

I have a ethernet connection eth0 and a wifi usb connection wlan0 on my raspbian box which both connect to a router with internet.

In my etc/network/interfaces file I have a setup that allows me to connect via SSH to my eth0 or wlan0 iface.

...

iface eth0 inet static
        address 192.168.1.100
        netmask 255.255.255.0
        gateway 192.168.1.1

...

iface wlan0 inet static
        address 192.168.1.200
        netmask 255.255.255.0

...

This config is fine and works as expected.

However this setup causes conflict with another software that demands each to have iface to be on its own subnet.

When I reconfigure my /etc/network/interfaces file like so

...

iface eth0 inet static
        address 192.168.1.100
        netmask 255.255.255.0
        gateway 192.168.1.1

...

iface wlan0 inet static
        address 192.168.2.200
        netmask 255.255.255.0

...

As wlan0 is now apart of another subnet (192.168. 2 .200) I can no longer connect to it through SSH, I also can not reach it via ping 192.168.2.200 from a Windows Machine.

When connected to eth0 through SSH, cmd tcpdump returns

...

23:05:27.296764 IP 192.168.1.5.49846 > 192.168.1.100.ssh: Flags [.], ack 2284256, win 252, length 0
23:05:27.297540 IP 192.168.1.100.ssh > 192.168.1.5.49846: Flags [P.], seq 2284256:2284544, ack 17665, win 594, length 288
23:05:27.298780 IP 192.168.1.5.49846 > 192.168.1.100.ssh: Flags [.], ack 2284544, win 251, length 0
23:05:27.299201 IP 192.168.1.100.ssh > 192.168.1.5.49846: Flags [P.], seq 2284544:2284832, ack 17665, win 594, length 288
23:05:27.300434 IP 192.168.1.5.49846 > 192.168.1.100.ssh: Flags [.], ack 2284832, win 256, length 0
23:05:27.301316 IP 192.168.1.100.ssh > 192.168.1.5.49846: Flags [P.], seq 2284832:2285120, ack 17665, win 594, length 288
23:05:27.302296 IP 192.168.1.100.ssh > 192.168.1.5.49846: Flags [P.], seq 2285120:2285280, ack 17665, win 594, length 160
23:05:27.302712 IP 192.168.1.5.49846 > 192.168.1.100.ssh: Flags [.], ack 2285120, win 255, length 0
23:05:27.303873 IP 192.168.1.5.49846 > 192.168.1.100.ssh: Flags [.], ack 2285280, win 254, length 0

...

What I have Tried

  • Updated /etc/network/interfaces and changed netmask to netmask 255.255.0.0 Still the problem remains
  • What's your ip_forward setting? – thrig Sep 4 '15 at 16:28
  • @thrid cat /proc/sys/net/ipv4/ip_forward returns 1, I have tried changing it to 0 but both configs do not allow a connection to 192.168. 2 .200 – buntybudia Sep 4 '15 at 16:31
  • You probably need to verify that the traffic for wlan0 is actually not going to through eth0 since that has the default gateway information. If it goes to the 192.168.1.0/24 network, it may not know how to route the packets back to the 192.168.2.0/24 network. If it is coming in wlan0 but the response are going out eth0, you should be able to do something like ip rule from 192.168.2.200 lookup 3 and ip route add table 3 default via 192.168.2.1 (assuming that's the wlan0 gateway) which will tell it to use a different gateway for traffic originating from the wlan0 IP. – Bratchley Sep 4 '15 at 16:53
  • You can usually verify which interface it's going out either with a tcpdump or a -j LOG iptables rule both of which will show you the interface it's leaving out of. – Bratchley Sep 4 '15 at 16:55
  • @Bratchley I dont understand how the traffic possibly could be going through wlan0 when I cannot connect to it? wlan0 is assigned to ip 192.168.** 2 .200, I am unable to connect in SSH to this address or receive a response when pinging it. I added to my post a cut from the cmd **tcpdump – buntybudia Sep 4 '15 at 23:09
0

It's unclear what is your network configuration. In the SOHO segment the Wifi router should have taken care of this. If you do not use any routers and that box is just connected to the ethernet and has a Wifi access point, then the only solution I can think of is to configure a bridge using eth0 and wlan0 and assign an IP address from 192.168.1.0/24 to that br0 interface.

You can read on how to configure bridges on Linux at, for example, https://wiki.debian.org/BridgeNetworkConnections

  • I am using a router, I was also begining to believe it is a router issue too, but is it a issue we can resolve from a config within linux? – buntybudia Sep 4 '15 at 16:36
  • It depends on the router. Usually routers are configured with a bridge inside them, so they span a single network across ethernet and Wifi, so I understand why it could be difficult to assign two subnets to your box. It would be easier to help if you shared what kind of software does not like 2 interfaces looking into the same network. – galaxy Sep 4 '15 at 16:39
  • The software which rejects same subnet ifaces is isc-dhcp-server, which returns the error Multiple interfaces match the same subnet: wlan0 eth0, I can get rid of this error by changing eth0 and wlan0 to ....1.100 and ....2.200 – buntybudia Sep 4 '15 at 17:06
  • For the ISC dhcpd server, you could run a bridge, and then instruct dhcpd to listen on the bridge interface. – thrig Sep 4 '15 at 21:05
  • @thrig The problem is I am not experienced much on linux networking, let alone DHCPD, I am trying to follow tutorials online, if I attempt the bridge like you suggest its like to require me to change other settings. I would ideally like to just run wlan0 on a 192.168. 2 .200, It would allow me to follow the tutorial this way. Thanks for the suggestion. – buntybudia Sep 4 '15 at 23:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.