LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   eth0/wlan0? (https://www.linuxquestions.org/questions/slackware-14/eth0-wlan0-4175656874/)

ceh383 07-04-2019 04:09 PM

eth0/wlan0?
 
Just installed Slack 14.2 on a 10 year old laptop, I figured why not, I wanted a beater I could bring to work and not worry about.
I've got it configured how I want it and have most of the software I want installed. It's working well, well for what it is any way.

While booting I noticed it hangs for a while waiting for eth0 to obtain a DHCP address. About 99% of the time I use wireless, so to get rid of the boot lag, I decided to set a static address, in /etc/rc.d/rc.inet1.conf for eth0.

Now all ethernet traffic is sent to eth0 even though wlan0 shows as being connected, I can't even ping my access point.

Is there a way to push everything to wlan0?
Or...
A) Disable eth0 completely.
B) Live with the boot lag as eth0 waits for no DHCP address.

Thanks in advance.

rkelsen 07-04-2019 04:18 PM

eth0/wlan0?
 
Bypass all that and use networkmanager. it's installed by default

ceh383 07-04-2019 04:24 PM

Quote:

Originally Posted by rkelsen (Post 6011988)
Bypass all that and use networkmanager. it's installed by default

networkmanager is what's showing me wlan0 is connected. Perhaps I'm missing something simple here, I usually do, but I see no way to have eth0 avoid looking for DHCP or forcing wlan0 for traffic.

Can you supply some details please?

Labinnah 07-04-2019 04:29 PM

Choose something from below:
1. Make sure you not overlap network settings between eth0 and wlan0.
2. If wlan0 is static set GATEWAY to wlan0 gateway.
3. You can set DHCP_TIMEOUT[some_number] for eth0 interface to low number.
4. You can blacklist eth0 kernel module.
5. If you don't want eth0 just don't configure it. Set IFNAME[0] to wlan0.

ceh383 07-04-2019 04:38 PM

Quote:

Originally Posted by Labinnah (Post 6011992)
Choose something from below:
1. Make sure you not overlap network settings between eth0 and wlan0.

Gateway and DNS Servers are the same, is this overlapping?
Quote:

Originally Posted by Labinnah (Post 6011992)
2. If wlan0 is static set GATEWAY to wlan0 gateway.

wlan0 is DHCP, so I guess no can do.
Quote:

Originally Posted by Labinnah (Post 6011992)
3. You can set DHCP_TIMEOUT[some_number] for eth0 interface to low number.

This is a possibility, and will try it if no other suggestions.
Quote:

Originally Posted by Labinnah (Post 6011992)
4. You can blacklist eth0 kernel module.
5. If you don't want eth0 just don't configure it. Set IFNAME[0] to wlan0.

I don't want to do either of these, I can see use in leaving it up.

Thank you for the suggestions :-)

BW-userx 07-04-2019 05:35 PM

I've always turned off my NIC in BIOS on my laptops, and never experienced what you're speaking of. maybe it is not so old as to not have a means to turn off your NIC via Bios, no detect , no look?

that's what I figure mine must be doing...(?)

ceh383 07-04-2019 09:01 PM

Quote:

Originally Posted by BW-userx (Post 6012007)
I've always turned off my NIC in BIOS on my laptops, and never experienced what you're speaking of. maybe it is not so old as to not have a means to turn off your NIC via Bios, no detect , no look?

that's what I figure mine must be doing...(?)

No option for this in the BIOS on this old machine. For now, I set eth0 back to DHCP and wlan0 handles the ethernet traffic again.

TheRealGrogan 07-05-2019 02:22 AM

If that's happening with the ethernet cable disconnected from the laptop while using wifi, that's bloody silly, isn't it.

How about, blacklist your kernel module for the ethernet NIC, and unblacklist it when you want to use it? There should be no boot delay then :-)

bassmadrigal 07-05-2019 02:59 AM

If your computer is trying to get an address from the dhcp server during boot, it is likely because it is requested via /etc/rc.d/rc.inet1.conf.

If you go in there and change USE_DHCP[0]="yes" under eth0 to USE_DHCP[0]="", it won't hunt for an IP on boot anymore.

ceh383 07-05-2019 09:15 AM

Quote:

Originally Posted by TheRealGrogan (Post 6012104)
If that's happening with the ethernet cable disconnected from the laptop while using wifi, that's bloody silly, isn't it.

Yes it is, and that is exactly what it does.

Quote:

Originally Posted by TheRealGrogan (Post 6012104)
How about, blacklist your kernel module for the ethernet NIC, and unblacklist it when you want to use it? There should be no boot delay then :-)

That's a good thought, I may try it if there are no better solutions.

Quote:

Originally Posted by bassmadrigal (Post 6012108)
If your computer is trying to get an address from the dhcp server during boot, it is likely because it is requested via /etc/rc.d/rc.inet1.conf.

If you go in there and change USE_DHCP[0]="yes" under eth0 to USE_DHCP[0]="", it won't hunt for an IP on boot anymore.

That's where I set the IP address for eth0, and I set USE_DHCP[0]="no".
I tried your suggestion, it seems to work well enough, and will be easy enough to change later if needed.

Thanks all

luvr 07-05-2019 11:06 AM

Do you even need these /etc/rc.d/inet* thingies if you use NetworkManager anyway?

Did you opt for NetworkManager when you configured the network during install? That's what I do nowadays, and I no longer experience any of the issues that you describe.

GazL 07-05-2019 03:22 PM

I replaced rc.inet1 with this:
Code:

#!/bin/sh

case "${1:-start}" in
        start)  echo "Starting Network Interfaces..."
                ip -batch - <<-EOF
                        address flush dev lo
                        address add 127.0.0.1 dev lo
                        link set lo up
                EOF

                if  [ ! -e /var/run/wpa_supplicant/wlan0 ]; then
                        iw reg set GB
                        wpa_supplicant -B -c /etc/wpa_supplicant/wlan0.conf -i wlan0 >/dev/null
                fi
                dhcpcd -q -b -L -M wlan0 eth0
                ;;
        stop)  echo "Stopping Network Interfaces..."
                dhcpcd -q -k
                sleep 2
                ip -batch - <<-EOF
                        link set eth0 down
                        link set wlan0 down
                EOF
                if [ -e /var/run/wpa_supplicant/wlan0 ]; then
                        wpa_cli -i wlan0 terminate >/dev/null
                fi
                ;;
esac

I can't say I've noticed any delay when eth0 isn't plugged in. The wlan0 interface gets assigned a higher metric than eth0, so eth0 will be used in preference to wlan0 when both are connected.

rkelsen 07-05-2019 06:05 PM

Quote:

Originally Posted by ceh383 (Post 6011990)
Perhaps I'm missing something simple here, I usually do, but I see no way to have eth0 avoid looking for DHCP or forcing wlan0 for traffic.

There are a couple of steps to this.

Step 1.

Code:

# chmod -x /etc/rc.d/rc.netdevice
Step 2.

Edit the eth0 section of /etc/rc.d/rc.inet1.conf so that it looks like this:

Code:

# Config information for eth0:
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""

Once you make these changes and reboot, networkmanager will be in control and you should no longer have the problem.

273 07-05-2019 07:28 PM

Quote:

Originally Posted by ceh383 (Post 6012184)
Yes it is, and that is exactly what it does.


That's a good thought, I may try it if there are no better solutions.


That's where I set the IP address for eth0, and I set USE_DHCP[0]="no".
I tried your suggestion, it seems to work well enough, and will be easy enough to change later if needed.

Thanks all

Why are you giving it an IP address if you don't want to use it?

ceh383 07-05-2019 08:51 PM

Quote:

Originally Posted by GazL (Post 6012332)
I replaced rc.inet1 with this:
Code:

#!/bin/sh

case "${1:-start}" in
        start)  echo "Starting Network Interfaces..."
                ip -batch - <<-EOF
                        address flush dev lo
                        address add 127.0.0.1 dev lo
                        link set lo up
                EOF

                if  [ ! -e /var/run/wpa_supplicant/wlan0 ]; then
                        iw reg set GB
                        wpa_supplicant -B -c /etc/wpa_supplicant/wlan0.conf -i wlan0 >/dev/null
                fi
                dhcpcd -q -b -L -M wlan0 eth0
                ;;
        stop)  echo "Stopping Network Interfaces..."
                dhcpcd -q -k
                sleep 2
                ip -batch - <<-EOF
                        link set eth0 down
                        link set wlan0 down
                EOF
                if [ -e /var/run/wpa_supplicant/wlan0 ]; then
                        wpa_cli -i wlan0 terminate >/dev/null
                fi
                ;;
esac

I can't say I've noticed any delay when eth0 isn't plugged in. The wlan0 interface gets assigned a higher metric than eth0, so eth0 will be used in preference to wlan0 when both are connected.

Thank you for this, I'll give it a try.

Quote:

Originally Posted by rkelsen (Post 6012353)
There are a couple of steps to this.

Step 1.

Code:

# chmod -x /etc/rc.d/rc.netdevice
Step 2.

Edit the eth0 section of /etc/rc.d/rc.inet1.conf so that it looks like this:

Code:

# Config information for eth0:
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""

Once you make these changes and reboot, networkmanager will be in control and you should no longer have the problem.

If the above doesn't work for me, I'll give this a try. Thank you.

Quote:

Originally Posted by 273 (Post 6012361)
Why are you giving it an IP address if you don't want to use it?

A) Thought it would get rid of the DHCP caused delay at boot.
B) It would still be usable at home if I needed it.

273 07-06-2019 09:09 AM

No, just giving an IP address is not aq good idea. Please just take a little time to read about IP.

onebuck 07-06-2019 10:27 AM

Member Response
 
Hi,

When you are using networkmanager then the '/etc/rc.d/rc.inet1.conf' should be in the default state (original install state). Plus be sure to change '/etc/rc.d/rc.networkmanager' to executable state.

For /etc/rc.d/rc.inet1.conf' option 'USE_DHCP[0]=""' instead of USE_DHCP[0]="no" the null will not set anything for the device[0];
Quote:

From /etc/rc.d/rc.inet1.conf;

# /etc/rc.d/rc.inet1.conf
#
# This file contains the configuration settings for network interfaces.
# If USE_DHCP[interface] is set to "yes", this overrides any other settings.
# If you don't have an interface, leave the settings null ("").

# You can configure network interfaces other than eth0,eth1... by setting
# IFNAME[interface] to the interface's name. If IFNAME[interface] is unset
# or empty, it is assumed you're configuring eth<interface>.

# Several other parameters are available, the end of this file contains a
# comprehensive set of examples.

# =============================================================================
Personally, I prefer to not use networkmanager but setup my systems statically. My Laptops do not move much except when I leave for Florida for the winter. Then I will setup a small netbook for when I need to link for mobile use.

If you want to interchange Ethernet use then you can look at;
Quote:

ifplugd <- 'ifplugd is a Linux daemon which will automatically configure your ethernet device when a cable is plugged in and automatically unconfigure it if the cable is pulled. This is useful on laptops with onboard network adapters, since it will only configure the interface when a cable is really connected. ifplugd interfaces with your distribution's native network configuration utilities.'
Hope this helps.
Have fun & enjoy Slackware!
:hattip:

ceh383 07-06-2019 10:31 AM

Quote:

Originally Posted by 273 (Post 6012529)
No, just giving an IP address is not aq good idea. Please just take a little time to read about IP.

I'm well aware of Internet Protocol addressing. Of the 32 internet connected devices in my home 26 have static addresses. Of the 6 with dynamic addresses, 3 have address reservations based on MAC address.
One of my Windows laptops has a static ethernet address and a dynamic wireless address, it works fine. This is the second laptop I've installed Slackware on, the first one had 13.37 and I don't recall having this issue, but that was several years ago.

ceh383 07-06-2019 10:36 AM

Quote:

Originally Posted by GazL (Post 6012332)
I replaced rc.inet1 with this:
Code:

#!/bin/sh

case "${1:-start}" in
        start)  echo "Starting Network Interfaces..."
                ip -batch - <<-EOF
                        address flush dev lo
                        address add 127.0.0.1 dev lo
                        link set lo up
                EOF

                if  [ ! -e /var/run/wpa_supplicant/wlan0 ]; then
                        iw reg set GB
                        wpa_supplicant -B -c /etc/wpa_supplicant/wlan0.conf -i wlan0 >/dev/null
                fi
                dhcpcd -q -b -L -M wlan0 eth0
                ;;
        stop)  echo "Stopping Network Interfaces..."
                dhcpcd -q -k
                sleep 2
                ip -batch - <<-EOF
                        link set eth0 down
                        link set wlan0 down
                EOF
                if [ -e /var/run/wpa_supplicant/wlan0 ]; then
                        wpa_cli -i wlan0 terminate >/dev/null
                fi
                ;;
esac


I tried this solution, it didn't work on this machine, WIFI would connect/disconnect randomly.

ceh383 07-06-2019 10:46 AM

Quote:

Originally Posted by onebuck (Post 6012539)

If you want to interchange Ethernet use then you can look at;
Quote:

ifplugd <- 'ifplugd is a Linux daemon which will automatically configure your ethernet device when a cable is plugged in and automatically unconfigure it if the cable is pulled. This is useful on laptops with onboard network adapters, since it will only configure the interface when a cable is really connected. ifplugd interfaces with your distribution's native network configuration utilities.'
Hope this helps.
Have fun & enjoy Slackware!
:hattip:

This does look interesting, it is rather old. Will it work with 14.2?

GazL 07-06-2019 02:22 PM

Quote:

Originally Posted by ceh383 (Post 6012542)
I tried this solution, it didn't work on this machine, WIFI would connect/disconnect randomly.

The modified rc.inet1 script shouldn't have any bearing on the wifi dropping out as that's all internal to wpa_supplicant. All I can say is that it's been rock solid here. Oh well, was worth a go.

bassmadrigal 07-06-2019 03:34 PM

Quote:

Originally Posted by ceh383 (Post 6012542)
I tried this solution, it didn't work on this machine, WIFI would connect/disconnect randomly.

This issue happens sometimes with Network Manager as well, and the solution there is to use dhclient instead of dhcpcd. You could try that here.

ceh383 07-06-2019 04:34 PM

Quote:

Originally Posted by bassmadrigal (Post 6012597)
This issue happens sometimes with Network Manager as well, and the solution there is to use dhclient instead of dhcpcd. You could try that here.

Just implemented this change, so far it looks stable. I'll give it some time before I mark this as solved, only time will tell.

Thank you and thank all who pitched in.


All times are GMT -5. The time now is 09:03 AM.