LAN server with two network cards, can't telnet / ping to the second even if it works
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.
Related videos on Youtube
maframaran
Updated on September 18, 2022Comments
-
maframaran over 1 year
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. Sowpa_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.
-
ott-- almost 11 yearsHow about putting eth0 and wlan0 beyond a br0 bridge interface?
-
maframaran almost 11 yearseth0 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.
-
user almost 11 yearsThis 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.
-
maframaran almost 11 yearsWhat 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.
-
user almost 11 years@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. -
maframaran over 10 years@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.