-2

I'm having two private LANs on different subnets, e.g. 192.168.100.0/24 and 192.168.200.0/24. Both of these LANs are on DHCP. Inbetween them there is a (Linux) server connected to both of them on different interfaces, e.g. eth0 and wlan0.

Hosts on both subnets are allowed to communicated within and across both LANs which works perfectly well when using IP addresses. Within one of the LANs communication between hosts works fine based on local hostnames. What doesn't work across the two LANs is name resolution.

Example: if I want to reach a host on the other LAN I can successfully do ping 192.168.100.33 but not ping MediaServer. If I'm sitting on the same LAN then both work fine.

Both LANs are quite heterogeneous with e.g. PCs, Laptops, Printers, NAS, Mediaserver, Smartphones, etc. and changing (therefore DHCP).

I searched for quite some time (but I'm still new to this topic) and think this is done on NetBios, WINS. I tried a lot with forwarding (like the example below; ferm syntax for iptables) but that all didn't help unfortunately.

interface eth0   protocol udp dport 137 mod addrtype dst-type BROADCAST DNAT to 192.168.200.255;
interface wlan0  protocol udp dport 137 mod addrtype dst-type BROADCAST DNAT to 192.168.100.255;

I'm stuck right now probably because I'm missing something important or misunderstand something. Any hints and tips are highly appreciated!

Dante
  • 1

1 Answers1

0

You might want to set up a DNS Server on a machine reachable from both networks (for ex: your linux machine) and specify the address of the DNS server on all the hosts. Some interesting links :

https://wiki.debian.org/Bind9

https://jack-brennan.com/dns-with-bind9-on-debian-part-22/

You can also workaround (not really recommended) this by editing your /etc/hosts file and adding manually the ip addresses and the hostnames of the machines.

Here is an example :


root@wagmachine:~# cat /etc/hosts

192.168.1.35 machine2


My machine will now translate machine2 to 192.168.1.35

However, be careful that the second solution will only work on the host where you edited the /etc/hosts file. For this solution to work, you need to modify the /etc/hosts on ALL hosts.

Also, if your DHCP is distributing addresses dynamically, you will need to edit the /etc/hosts often making it a bad long-term solution.

Best Regards,

Nicolas

  • Many thanks for your comments Nicolas, very much appreciated. Unfortunately, any changes on the devices themselves is prohibitive (e.g. think of Smartphone of guests, printers, etc. where editing /etc/hosts isn't an option). Each device can reach each other device in any of the two LANs based on IP-addresses. Also this works within any of the two LANs with local hostnames (e.g. "Printer-1") but not across the two LANs. I think what I need to understand and learn is how this local name resolution works (I assume somthing like NetBios) and then I could connect the two LANs for that protocol. – Dante Feb 17 '17 at 08:13