Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have an issue with an Ubuntu 12.04 LTS (updated) server.

For reasons too long to detail, it has got one eth0 interface assigned to 192.168.1.9 and one Wifi wlan0 interface assigned to 192.168.1.10. Both MUST work since boot time.

I also installed (I need of monitoring software) Lubuntu desktop-core and removed Network manager (rebooted) and using wpa_supplicant + /etc/network/interface hardcoded configuration and fixed IPs.

Everything works like a charm... hardware wise. From the Lubuntu desktop I can browse the internet from eth0. If I ifdown eth0 and then unplug it, I can happily browse the internet through wlan0. So wpa_supplicant looks like it's doing its job.

The problem is...

I need to be able to have both interfaces up at the same time and both must respond to pings, SSH connects from the other computers in the LAN, etc.. The wlan0 is the one that will need to be used when communicating with the gateway/router (at 192.168.1.1) to exit to the internet.

But if I have both interfaces up, eth0 keeps working, but wlan0 becomes unreachable (nor it will connect to anything any more, so the issue is bidirectional). Trying to ping from My Win 8 computer will say the same error that you see when there's no route to host, too bad it's still on the same segment of the LAN: my Win 8 is at 192.168.1.69 and server's wlan0 is at 192.168.1.10.

Do you have any idea about where I could start look after?

Here are some configuration files

  • ifconfig:

    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:18 errors:0 dropped:0 overruns:0 frame:0
              TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:1613 (1.6 KB)  TX bytes:1613 (1.6 KB)
    
    wlan0     Link encap:Ethernet  HWaddr 00:c0:49:fc:db:3f  
              inet addr:192.168.1.10  Bcast:192.168.1.255  Mask:255.255.255.0
              inet6 addr: fe80::2c0:49ff:fefc:db3f/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:16376 errors:0 dropped:0 overruns:0 frame:0
              TX packets:3337 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:4675792 (4.6 MB)  TX bytes:543084 (543.0 KB)
    
  • When I enable the eth0 with ifup, I get this stanza added:

    eth0      Link encap:Ethernet  HWaddr 00:0e:a6:aa:5b:be  
              inet addr:192.168.1.9  Bcast:192.168.1.255  Mask:255.255.255.0
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    
  • route -n:

    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         192.168.1.1     0.0.0.0         UG    100    0        0 wlan0
    192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0
    192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
    

If I disable eth0 of course the relevant line goes away. IPTables shows clean (fresh Ubuntu install), I'm using UFW but I have disabled it at the moment as well.

  • iptables -L -nv:

    Chain INPUT (policy ACCEPT 0 packets, 0 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 0 packets, 0 bytes)
     pkts bytes target     prot opt in     out     source               destination         
    
  • In the hosts file I have both interfaces, set to different names.

  • In resolv.conf I've only got the DNS servers IP and domain clause.
share|improve this question
    
How about putting eth0 and wlan0 beyond a br0 bridge interface? –  ott-- Jul 29 '13 at 20:53
    
eth0 is going to be disabled later. My issue is that even disabling eth0, wlan0 lets me browse internet etc. from the server, but is unreachable by any other computer in the LAN. –  Dario Fumagalli Jul 29 '13 at 21:32
    
This is odd. Let's see if I understand correctly: on boot, wlan0 is brought up, eth0 remains disabled and everything works fine over wlan0. After you bring up eth0, no traffic passes over wlan0? (Confirm the ifconfig packet counts.) If you then bring eth0 down again then what happens; does wlan0 come back to life? Firewall rules remain all-permissive throughout? Can you please edit route -n output from all three states (immediately after boot, after bringing up eth0 and after bringing down eth0) into your question, clearly labelled as to which is which? My guess is a default route issue. –  Michael Kjörling Jul 30 '13 at 11:59
add comment

1 Answer 1

I have faced a similar problem before. If a machine has two network devices, then both of them can't see each other by default. Setting up network routes is one issue, but it took me a long time to find out, that I have to set up ip_forwarding, too.

echo 1 > /proc/sys/net/ipv4/ip_forward

But there is another problem with your configuration. I think you can't set up two standard gateways for the same ip range. I would like to put your lan into the range 192.168.2.0/24 and your wlan into the range 192.168.1.0/24.

share|improve this answer
    
The OP only has one default route, through 192.168.1.1 over wlan0 (as desired). 192.168.1.0/24 is reachable over both eth0 and wlan0 (that's what the two separate routes are for), so I fear that without an outgoing interface specifier behavior will either be non-deterministic, or the system will always use one of the interfaces (likely the one first brought up, which in turn may be non-deterministic in practice). –  Michael Kjörling Jul 30 '13 at 11:50
    
What do you mean by "outgoing interface specifier"? If you could please tell me how to configure it, I will try it out and report back. –  Dario Fumagalli Jul 30 '13 at 12:08
    
@DarioFumagalli Some applications might allow you to specify explicitly which interface to use. You could probably use iptables (PREROUTING, maybe) to target an outgoing IP packet to use a specific interface. In IPv6, I think it's even standardized how to specify the interface to use: you could connect to e.g. fe80::1%wlan0 and the connection would be made over the wlan0 interface (of course, what constitutes a valid interface would differ from one system to the next); for link-local addresses, this is a real concern. That said, please have a look at my comment to the question itself. –  Michael Kjörling Jul 30 '13 at 18:54
    
Any way to use UFW for this? I have it working on all our other servers and I'd rather have everything aligned...Moreover my issue at the moment is at receiving the packets. As I said eth0 is going to get deactivated sooner or later anyway, I am interested into having wlan0 respond from and send to everywhere. Edit: to simplify: I'd be just fine not using eth0 at all ever again, I just need wlan0 to function and accept incoming pings and SSH connections, something that ATM it's not doing even deactivating eth0. –  Dario Fumagalli Jul 30 '13 at 21:03
    
@Ronin Tom I have not flagged any answer as final, because they all address what I don't really care about (the two interfaces seeing each other) while they don't talk about the rest of the network not seeing these interfaces. –  Dario Fumagalli Aug 12 '13 at 7:42
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.