When working in a mixed Windows-Linux environment, you might encounter hostname resolution issues where Windows machines can't resolve Linux hostnames. This is particularly common in home networks or small office setups where machines are connected via a simple router without proper DNS configuration.
Windows primarily uses NetBIOS for name resolution in local networks, while Linux typically relies on mDNS (Avahi) or traditional DNS. When these protocols don't communicate properly, you get resolution failures.
1. Using WINS (NetBIOS Name Resolution)
Configure Samba on your Linux machines to act as WINS servers:
# /etc/samba/smb.conf [global] workgroup = WORKGROUP wins support = yes name resolve order = lmhosts host wins bcast
Restart Samba:
sudo systemctl restart smb
2. mDNS with Bonjour for Windows
Install Bonjour Print Services on Windows (originally for Mac-Windows networking):
1. Download from Apple's support site 2. Install normally 3. Restart your machine
Then try pinging using the .local suffix:
ping mylinuxmachine.local
3. Manual Hosts File Entry
For small networks, edit Windows' hosts file:
# C:\Windows\System32\drivers\etc\hosts 192.168.1.100 mylinuxmachine
Remember to run Notepad as Administrator when editing this file.
4. Configure Local DNS
If your router supports it, add static DHCP leases with hostnames:
1. Access router admin panel (typically 192.168.1.1) 2. Find DHCP reservation section 3. Assign IPs to MAC addresses with hostnames 4. Reboot all machines
Use these diagnostic tools:
# On Windows: nslookup mylinuxmachine ping -a 192.168.1.100 nbtstat -n # On Linux: avahi-resolve-host-name mylinuxmachine.local nmblookup -A 192.168.1.100
For modern systems, consider implementing Avahi on Linux and Bonjour on Windows for seamless resolution:
# Linux (Fedora/RHEL): sudo dnf install avahi nss-mdns sudo systemctl enable --now avahi-daemon # Windows: Install "Bonjour SDK" from Apple
When working in mixed OS environments, hostname resolution between Windows and Linux machines often becomes problematic. The Windows 7 machine in your case can't resolve the Fedora hostnames because they use different name resolution methods by default.
Windows primarily uses NetBIOS for hostname resolution in workgroups, while Linux typically relies on multicast DNS (mDNS) or traditional DNS. Here are the key differences:
Windows name resolution order: 1. NetBIOS name cache 2. WINS server 3. Broadcast 4. LMHOSTS file 5. Hosts file 6. DNS Linux name resolution (typical): 1. /etc/hosts 2. mDNS (Avahi) 3. DNS servers in /etc/resolv.conf
Option 1: Install Bonjour/ZeroConf on Windows
Apple's Bonjour service (based on mDNS) can bridge the gap:
1. Download and install Bonjour Print Services for Windows
2. After installation, Windows will be able to resolve .local hostnames
3. Ensure your Fedora machines have avahi-daemon running:
sudo systemctl enable avahi-daemon
sudo systemctl start avahi-daemon
Option 2: Configure Windows LMHOSTS File
Edit the LMHOSTS file located at C:\Windows\System32\drivers\etc\lmhosts
:
# Add entries like this: 192.168.1.100 mylinuxmachine #PRE
Then refresh the NetBIOS cache:
nbtstat -R
Option 3: Set Up a Local DNS Server
For more permanent solutions, consider running dnsmasq on your Linux machine:
sudo dnf install dnsmasq sudo systemctl enable dnsmasq sudo systemctl start dnsmasq
Then configure your Windows machines to use the Linux box as their primary DNS server.
Option 4: Windows Hosts File Alternative
Edit C:\Windows\System32\drivers\etc\hosts
:
192.168.1.100 mylinuxmachine 192.168.1.101 anotherlinuxbox
After implementing any of these solutions, test with:
ping mylinuxmachine nslookup mylinuxmachine
- Check firewall settings on both Windows and Linux
- Verify network connectivity between machines
- Ensure consistent network profile (Home/Work vs Public)
- Check for duplicate hostnames on the network
If you're running Samba on your Linux machines, configure /etc/samba/smb.conf
:
[global] wins support = yes name resolve order = wins lmhosts hosts bcast
Restart Samba and configure Windows to use the Linux machine as WINS server.