1

There is home network: 192.168.1.0/24, default gateway 192.168.1.1 (DHCP)

There is a web server which is running on a host, lets call the host "server".

There are several devices which are connected to the router via wifi (clients).

Problem: clients can't connect to the server when it is connected to the network via wifi. But they are able to connect to it when it is connected via ethernet.

"can't connect" means:

  • http ://192.168.1.15/myservice - "Oops! Google Chrome could not connect to 192.168.1.15"

  • telnet/ping 192.168.1.15 - "Destination Host Unreachable"

Server: Ubuntu 12.04 x86_64 (kernel 3.8.0-35-generic)

# ufw status

Status: inactive

# iptables -L

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Server ethernet network configuration

# ifconfig eth2

inet addr:192.168.1.14  Bcast:192.168.1.255  Mask:255.255.255.0

# netstat -rn

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth2
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth2
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth2

Server wifi network configuration

# ifconfig eth3

inet addr:192.168.1.15  Bcast:192.168.1.255  Mask:255.255.255.0

# netstat -rn

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth3
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth3
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth3

JIC, I'm able to connect to my wifi interface from(!) the server (but probably it just connects via loopback interface instead).

What the problem?

  • Wifi access points can be set to not let clients talk to each other. This setting is sometimes called "AP isolation". It could explain the behavior you're experiencing. – Daniel B Jun 4 '16 at 22:43
0

How does your server get its IP address?

Generally, DHCP assigns different IP addresses to different interfaces, despite the fact the NICs in question may belong to the same pc.

As a matter of fact, how could the DHCP server know that two distinct NICs belong to the same pc? All the DHCP server sees are the MAC addresses of the two cards, and they are different. Hence, it assigns different IP addresses.

As a test, try

  http://192.168.1.15/myservice 

using, instead of 15, the IP address of the Web server when it is connected via wifi. I bet it will work.

The simplest solution, by far, will be leaving the server always connected through the same NIC card. The second easiest solution is to enable Address Reservation for the MAC address of the Web server's ethernet card, and to spoof the same address onto the wireless card of the Web server when it is connected to the via wifi.

If you are confused by the word spoof, it means to mask the true MAC address of the wireless card, and make it look like it has a different MAC address. There are programs to do this in all OSes.

0

The wi-fi interface may be coming up AFTER system services start, whereas the ethernet connection comes up BEFORE services start.

If your web server is explicitly bound to the wi-fi address and starts before wi-fi does, then it may try to open a listening port, fail, and just forget about that IP address altogether -- meaning no connections afterward.

Remember, the wi-fi has to authenticate with your router before anything can use it (including ALL system services). If you're doing this manually after the system starts, it's suspect.

  • No, vice versa, wifi is started automatically and ethernet interface I have to enable manually. The service is bound to all interfaces: # netstat -altn | grep LIST | grep :80 => tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN – gumkins Jan 19 '14 at 13:44
0

Old question is old, but still... I notice no one mentioned the potential of the web server being bound to a specific IP address in spite that the can't connect error shown is on 192.168.1.15 while the eth2 is clearly configured for 192.168.1.14 and eth3 for 192.168.1.15. In such a case one should check that their web server is bound to the correct IP or is set to use any available IP.

0

While I think all of the answers already provided are good guesses, I think there's 2 possibilities here. Either Daniel B. was on to something with the "AP isolation" idea, or there's a problems with arp.

I couldn't be of much help telling you how to check for your routers "AP isolation" settings because I'm sure it's quite dependent on whether or not that functionality exists in your particular router and what sort of UI your router offers. Being that this question is quite old I don't imagine that I'll get a response on that either but if OP does respond I'd be willing to research it and provide instructions for how to check/fix.

I can tell you how to check if it's a problem with arp. If you're running windows clients, start an administrative command prompt. In windows 10, click start, type "cmd" and then right click on command prompt and select "run as administrator" on the context menu. At the command prompt, you can type "arp -a";

C:\Windows\system32>arp -a 192.168.1.15

Interface: 192.168.0.123 --- 0x13
Internet Address      Physical Address      Type
192.168.1.15          00-50-56-3e-ce-3e     dynamic

Make sure that the MAC address listed matches the MAC address of your wireless card. If it's not, you could try clearing the arp cache...

C:\Windows\system32>arp /d 192.168.1.15

Try to ping the server address 192.168.1.15 from your client again and then check the arp cache again to see if it gets the correct MAC address for the wireless card on your server. If it doesn't then there's probably some settings you need to change on your wireless router and, again, I can't really provide much help with that without more information.

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.