Keep WiFi internet while a PC-to-PC Ethernet network is active

I often use an Ethernet cable to connect my computer to another computer for various purposes. But when I do that, I cannot use the internet even though I’m still connected to a WiFi access point. I’m presuming that’s because openSUSE is trying to reach the internet through the Ethernet cable, which has precedence over WiFi.

Is there a way to enable internet usage via WiFi while I’m connected to another computer over Ethernet?

Of course this is possible. But I suppose you want more then this answer alone.

To get a better answer you should provide much more information. As you have seen here n many threads, it is very nice to tell which openSUSE level and which DE (if any) you are using.

Also in the case of network problems telling a lot about how your network is configured helps to helpyou… Things like
. network manager or ifup;
. DHCP or not.
When you have only limited knowledge, that is no problem. You start to tell what you know, and we carry on asking you for the rest.

Almost no matter how you have your networking configured(or mis-configured), if your Default Gateway and DNS points to your WiFi you should not have any problems. Ideally, your wireless and wired interfaces should be configured with different NetworkIDs, but even if that isn’t the case theoretically I don’t think that should be a problem.

If I were to hazard a guess, for some reason your machine is slow connecting to your WiFi so your machine built a routing table to your other machine first. If that is what is happening, then either resolve the timing issues or better yet change the NetworkID between your two machines.

Tony

Apologies for my late response. I accidentally deleted a mail saying that there were replies to this topic, so I forgot about this thread. Anyhow… I’m using network manager. Both WiFi and my Ethernet connection use DHCP. As I said, my Ethernet cable connects two PCs. To make this work, I run a DHCP server on my computer.

Ideally, your wireless and wired interfaces should be configured with different NetworkIDs, but even if that isn’t the case theoretically I don’t think that should be a problem.

I’m not sure what you mean with NetworkID. I can give you this information though.

WiFi connection
IP address: 192.168.1.7
Netmask: 255.255.255.0
Gateway/nameserver: 192.168.1.1

Ethernet connection
IP address: 192.168.0.52
Netmask: 255.255.255.0
Gateway: 192.168.0.1 (I did ‘/sbin/ifconfig eth0 192.168.0.1’ before starting the DHCP server)
Nameservers: 8.8.8.8, 8.8.4.4
Search domains: digitalairlines.com (I don’t know what this does, but I bet it has got something to do with the default DHCP configuration)

It looks like you configured a unique NetworkID, but I’ll explain what it is…

When a machine is assigned a network address, it actually comprises two parts split by the Network Mask. So as an example in a default Class C network your machine might be assigned an address 192.168.0.2 with a subnet mask 255.255.255.0. The mask splits the address after the third octet which means that the NetworkID is 192.168.0 with the specific Machine Address ID is 2. The reason why it’s called the NetworkID is because all machines in your network must have the same NetworkID to belong to the same Network while the Machine Address ID must be unique on that Network.

Recommendations:
Remove the Gateway config from your Ethernet connection, that config is only for connecting to remote networks and you don’t want packets routed that way, only directly through your WiFi (leave the field empty).
Remove the Nameserver entries from your Ethernet connections, those should be blank.
Enter Hostname and if necessary LMhost configs on each machine using your 192.168.0 addresses (each entry should point to the other machine). That should over-ride the current DHCP config which tells each of your machines to route using the wireless connections.

IMO that should get you working.
Tony

I didn’t enter the gateway and nameserver values myself. Those were all obtained with DHCP. Here’s where I got these values from:

http://i.imgur.com/Ezli7.png

You’re looking at the wrong network interface.

Summary:
Your WiFi interface should be configured automatically by DHCP from your wireless router, this is because that should be your primary and default path for all packets routed to most machines and to networks outside your LAN.

Your wired connection between your two machines should be configured manually with static addresses, but because you don’t intend any traffic over this wired connection be used to connect to any other machines, the NIC configuration should not be configured with any “discovery” services or routes like DNS or a Gateway.

Lastly, you want your wired connection to take priority over routing connections any other way (like through your wireless router), so you configure your Hosts and optionally LMhosts files because normally a machine will use those entries before entries from any other source (like DNS or WINS Nameservers).

You <may> need to purge and re-build the local network caches. Off the top of my head, I don’t remember how to do that on Linux, but simply re-booting both machines should do this, too.

When this is done, you can test by pinging the other machine by name, you should return results using your wired interface IP addresses.

Hopefully that should be sufficient for your situation. If you still have a problem, there are additional steps which can be taken.

Tony

On Windows XP I could make the connection work without DHCP by configuring computer 1 with “IP: 192.168.0.1 - Gateway: 192.168.0.2” and computer 2 with “IP: 192.168.0.2 - Gateway: 192.168.0.1”. Is this what you mean? Cuz’ I once tried creating a similar setup between two openSUSE computers and that didn’t work. It could be because I accidentally used IP addresses that were in use by wlan0, but I’m gonna have to verify that tomorrow.

Isn’t that already the default setting in openSUSE/KDE/NetworkManager?

Those things sound new to me. Could you explain step by step what I have to do?

No. Even in Windows, you shouldn’t be configuring that way. The “Gateway” is a designated portal to a different network, not to be configured simply to access another machine in the same network, and that’s the case no matter what OS you’re running. In fact, by configuring the Gateway setting over your wired LAN, you are telling each machine that it’s possible to access the Internet through the wired connection which would be wrong and with unpredictable consequences. If you had that setting, you’d then need to additionally configure router priorities to tilt likelihoods to route directly to the wireless router which is foolish when there’s no point to ever route over the hard wire to a remote network.

Regardless what you believe to be the default setting, you should doublecheck the configuration is as I described.

The simplest way to configure the Hosts file is to do it through YAST, it’ll automatically open the file for viewing. Inspect the current entries, use the same format for your new entries.

Tony

Here are /etc/hosts and /etc/samba/lmhosts. What should I add/edit/remove?

hosts This file describes a number of hostname-to-address

mappings for the TCP/IP subsystem. It is mostly

used at boot time, when no name servers are running.

On small systems, this file can be used instead of a

“named” name server.

Syntax:

IP-Address Full-Qualified-Hostname Short-Hostname

127.0.0.1 localhost.localdomain localhost

special IPv6 addresses

::1 localhost ipv6-localhost ipv6-loopback

fe00::0 ipv6-localnet

ff00::0 ipv6-mcastprefix
ff02::1 ipv6-allnodes
ff02::2 ipv6-allrouters
ff02::3 ipv6-allhosts
127.0.0.2 geeko-s6n.home geeko-s6n

This file provides the same function that the lmhosts file does for

Windows. It’s another way to map netbios names to ip addresses.

See section ‘name resolve order’ in the manual page of smb.conf for

more information.

127.0.0.1 localhost

Like this?

http://i.imgur.com/3g4wo.png http://i.imgur.com/AUVFj.png

I do not know why /etc/samba/… is mentioned here. I can not find you mentioning SAMBA earlier in this thread. You were just asking about a network connection (LANs).

Please, use CODE tags when copying computer text here: Posting in Code Tags - A Guide

tsu2 mentioned something about LMhosts:

I didn’t know what it was, but I went looking for the file.

pdedecker@geeko-s6n:~> locate lmhosts
/etc/samba/lmhosts
/usr/share/man/man5/lmhosts.5.gz
/windows/C/Windows/System32/drivers/etc/lmhosts.sam
/windows/C/Windows/winsxs/x86_microsoft-windows-lmhsvc_31bf3856ad364e35_6.1.7600.16385_none_52973e8a51a9d054/lmhosts.sam

That’s why I mentioned something about SAMBA.

Yes, the question was more or less to @tsu2, because I thought he magicaly found out you are using Samba ;). But again, your last block above would have been better not using QUOTE, but CODE tags.

:slight_smile:
When I mentioned LMhosts, I hope I carefully qualified it as “optionally” because I was trying to cover my bases what you intended to do over your network connection without delving into the “NetBIOS Name Resolution vs Hostname resolution” discussion.

If you’re not dealing with SAMBA or other NetBIOS Name resolution technologies, you don’t have to configure LMhosts.

Your Network Manager screenshots look good except that you should likely also check the box to “Connect Automatically”

Tony