LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-04-2017, 03:04 AM   #1
xpdin
Member
 
Registered: May 2015
Posts: 30

Rep: Reputation: Disabled
No automatically internet connection until it is not started manually


Every time Linux boots I have to manually use the beyond two commands in order to have an working internet connection.

Code:
ethtool -s eth0 autoneg off speed 100 duplex full
Code:
dhclient eth0
I am looking for a method so the internet connection will start automatically when Lubuntu boots up.


/etc/network/interfaces:

Code:
# This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).
    
    source /etc/network/interfaces.d/*
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    #auto eth0
    iface eth0 inet dhcp
    
    ethtool -s eth0 autoneg off speed 100 duplex full
    allow-hotplug eth0
    
    #iface wlan0 inet manual
    #wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
/etc/rc.local:



Code:
 #!/bin/sh -e
        #
        # rc.local
        #
        # This script is executed at the end of each multiuser runlevel.
        # Make sure that the script will "exit 0" on success or any other
        # value on error.
        #
        # In order to enable or disable this script just change the execution
        # bits.
        #
        # By default this script does nothing.
        
        echo 500 > /sys/class/backlight/intel_backlight/brightness
        xrandr -s 960x540
        rfkill block bluetooth
        rfkill block wifi
        ethtool -s eth0 autoneg off speed 100 duplex full
        ip link set eth0 up
        ifup eth0
        dhcpcd eth0
        
        exit 0

Code:
systemctl status rc-local: 
    globalisation@WindowsXP:~$ systemctl status rc-local
    ● rc-local.service - /etc/rc.local Compatibility
       Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: 
      Drop-In: /lib/systemd/system/rc-local.service.d
               └─debian.conf
       Active: failed (Result: exit-code) since Sun 2017-06-04 00:31:28 CEST; 15min 
      Process: 636 ExecStart=/etc/rc.local start (code=exited, status=1/FAILURE)
    
    Jun 04 00:31:27 WindowsXP systemd[1]: Starting /etc/rc.local Compatibility...
    Jun 04 00:31:28 WindowsXP rc.local[636]: Can't open display
    Jun 04 00:31:28 WindowsXP systemd[1]: rc-local.service: Control process exited, 
    Jun 04 00:31:28 WindowsXP systemd[1]: Failed to start /etc/rc.local Compatibilit
    Jun 04 00:31:28 WindowsXP systemd[1]: rc-local.service: Unit entered failed stat
    Jun 04 00:31:28 WindowsXP systemd[1]: rc-local.service: Failed with result 'exit
    
    globalisation@WindowsXP:~$
When Lubuntu boots it appears these errors:
Code:
Failed to start LSB: IPV4 DHCP client with IPV4ALL support. 
See 'systemctl status dhcpcd.service' for details 
16.780656 usb 1-1.4.3: device descriptor read/64, error -110
/etc/sysctl.conf:

Code:
#
    # /etc/sysctl.conf - Configuration file for setting system variables
    # See /etc/sysctl.d/ for additional system variables.
    # See sysctl.conf (5) for information.
    #
    
    #kernel.domainname = example.com
    
    # Uncomment the following to stop low-level messages on console
    #kernel.printk = 3 4 1 3
    
    ##############################################################3
    # Functions previously found in netbase
    #
    
    # Uncomment the next two lines to enable Spoof protection (reverse-path filter)
    # Turn on Source Address Verification in all interfaces to
    # prevent some spoofing attacks
    #net.ipv4.conf.default.rp_filter=1
    #net.ipv4.conf.all.rp_filter=1
    
    # Uncomment the next line to enable TCP/IP SYN cookies
    # See http://lwn.net/Articles/277146/
    # Note: This may impact IPv6 TCP sessions too
    #net.ipv4.tcp_syncookies=1
    
    # Uncomment the next line to enable packet forwarding for IPv4
    #net.ipv4.ip_forward=1
    
    # Uncomment the next line to enable packet forwarding for IPv6
    #  Enabling this option disables Stateless Address Autoconfiguration
    #  based on Router Advertisements for this host
    #net.ipv6.conf.all.forwarding=1
    
    
    ###################################################################
    # Additional settings - these settings can improve the network
    # security of the host and prevent against some network attacks
    # including spoofing attacks and man in the middle attacks through
    # redirection. Some network environments, however, require that these
    # settings are disabled so review and enable them as needed.
    #
    # Do not accept ICMP redirects (prevent MITM attacks)
    #net.ipv4.conf.all.accept_redirects = 0
    #net.ipv6.conf.all.accept_redirects = 0
    # _or_
    # Accept ICMP redirects only for gateways listed in our default
    # gateway list (enabled by default)
    # net.ipv4.conf.all.secure_redirects = 1
    #
    # Do not send ICMP redirects (we are not a router)
    #net.ipv4.conf.all.send_redirects = 0
    #
    # Do not accept IP source route packets (we are not a router)
    #net.ipv4.conf.all.accept_source_route = 0
    #net.ipv6.conf.all.accept_source_route = 0
    #
    # Log Martian Packets
    #net.ipv4.conf.all.log_martians = 1
    #
    
    net.ipv6.conf.all.disable_ipv6 = 1
    net.ipv6.conf.default.disable_ipv6 = 1
    net.ipv6.conf.lo.disable_ipv6 = 1
Thank you.
 
Old 06-04-2017, 04:05 AM   #2
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,756

Rep: Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138
You can't use xrandr in a script like that, as there is no X-session when it runs, and you're trying to run it as root!
 
Old 06-04-2017, 04:11 AM   #3
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,756

Rep: Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138
For an automatic connection, why don't you just do the following?
Code:
# The primary network interface
    auto eth0
    iface eth0 inet dhcp
    
    ethtool -s eth0 autoneg off speed 100 duplex full
Reference:
https://help.ubuntu.com/lts/servergu...iguration.html
 
Old 06-04-2017, 10:14 AM   #4
xpdin
Member
 
Registered: May 2015
Posts: 30

Original Poster
Rep: Reputation: Disabled
I appreciate ferrari,

Have tried it, no result yet, still the same,

It also seams that the second command
Code:
dhclient eth0
after using the MANDATORY ONE
Code:
ethtool -s eth0 autoneg off speed 100 duplex full
(still all the commands take effects only manually) could be replaced with
Code:
ifup eth0
in order for the internet to work.

Maybe an important part of the next log is
Code:
Link detected: no
After boot if immediately the first command is
Code:
ethtool eth0
the output is:

Code:
:~$ sudo ethtool eth0
[sudo] password for globalisation: 
Settings for eth0:
	Supported ports: [ TP MII ]
	Supported link modes:   10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Half 1000baseT/Full 
	Supported pause frame use: No
	Supports auto-negotiation: Yes
	Advertised link modes:  10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Full 
	Advertised pause frame use: Symmetric Receive-only
	Advertised auto-negotiation: Yes
	Speed: 10Mb/s
	Duplex: Half
	Port: MII
	PHYAD: 0
	Transceiver: internal
	Auto-negotiation: on
	Supports Wake-on: pumbg
	Wake-on: g
	Current message level: 0x00000033 (51)
			       drv probe ifdown ifup
	Link detected: no
I would like to add that the same Linux machine in discussion always receives internet connection instantly/directly, even after reboot, shutdown, with no others supplementary manual commands, or any other actions, if I only change the cable from "the problematic in discussion internet connection" to the "non problematic" completely different DSL router connection(another ISP, BUT STILL THE SAME ETHERNET CABLE)

The problematic connection dependent on the manual commands "in discussion" which has internet only after the manually commands, is from another ISP and is a coaxial/tv cable modem.

Regards.

Last edited by xpdin; 06-04-2017 at 10:16 AM.
 
Old 06-04-2017, 02:35 PM   #5
xpdin
Member
 
Registered: May 2015
Posts: 30

Original Poster
Rep: Reputation: Disabled
Coud it be problems with onboard NIC?

This exactly same machine with this exactly system with "in discussion", THE SAME ETHERNET CABLE, takes/keeps internet directly/immediately even after reboot/shutdown or whatever I would do, without any manual commands, ONLY MOVING THE ETHERNET CABLE from this "in discussion" problematic router to another router connected to completely another internet connection on another ISP.

The same port on the router the same cable, even from in discussion PROBLEMATIC ROUTER also Windows 7 and Windows 10 connect to the internet instantly/directly without any clicks supplementary clicks, only changing the cable from the Linux machine to the Windows machine.

Last edited by xpdin; 06-04-2017 at 02:47 PM.
 
Old 06-04-2017, 06:54 PM   #6
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,756

Rep: Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138
Your ethtool output reports no link. Is that why you're trying to set negotiation manually? Both sides of the link need to set the same way.
 
Old 06-04-2017, 11:24 PM   #7
xpdin
Member
 
Registered: May 2015
Posts: 30

Original Poster
Rep: Reputation: Disabled
Thank you ferrari,

Can you tell me please how ?

If you have please any ideas how this could happen, I have just remembered that this in discussion same machine + same OS(Linux no changed configurations) + same Ethernet cable always "received and kept" the internet automatically (no extra manual commands) from all the 3 different models of routers.

All 3 connections and routers were from the same ISP, other than this forth problematic connection and router.

Best wishes.

Last edited by xpdin; 06-04-2017 at 11:52 PM.
 
Old 06-05-2017, 01:25 AM   #8
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,756

Rep: Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138Reputation: 1138
Yes, no configuration should be necessary for a generic dhcp ethernet connection. If I understand you correctly, the other router connections behave as expected. It is only this fourth router that has the problem. If I've understood everything you've said so far, then it isn't the cable or the host machine at fault, but the router which seems to have a problem. In general, you should get a link light as soon as the ethernet cable is plugged in at both ends. Only you can investigate the definitive cause here. Maybe it has a faulty port?
 
Old 06-05-2017, 09:02 AM   #9
xpdin
Member
 
Registered: May 2015
Posts: 30

Original Poster
Rep: Reputation: Disabled
It seams that the final result, in order to have internet access automatically after reboot/shutdown/sleep with no more manual commands:

/etc/network/interfaces

Code:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
iface eth0 inet dhcp
    pre-up ethtool -s eth0 autoneg off speed 100 duplex full

allow-hotplug eth0
/etc/rc.local

Code:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

echo 70 > /sys/class/backlight/intel_backlight/brightness
rfkill block bluetooth
rfkill block wifi
ethtool -s eth0 autoneg off speed 100 duplex full
ip link set eth0 up

exit 0
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] bash script runs perfectly when started manually - but not when started by CRON jonasbdk Linux - General 12 08-27-2014 06:54 AM
[SOLVED] Manually sharing Internet connection with phone via USB klglhqcw Linux - Newbie 5 10-04-2013 12:20 PM
[SOLVED] Unable to manually configure internet connection with PCBSD. Randicus Draco Albus *BSD 3 10-14-2011 05:37 AM
How do I manually disconnect/reconnect DHCP DSL internet connection? chaz_bro1972 Linux - Networking 34 06-06-2008 02:17 AM
How to set up internet connection manually in FC5 jojojo Linux - Newbie 2 06-03-2006 11:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration