Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

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.

share|improve this answer
add comment

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.

share|improve this answer
    
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 at 13:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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