매번 "ethtool"을 수동으로 실행하지 않고 자동으로 인터넷 연결을 시작하는 방법

매번 "ethtool"을 수동으로 실행하지 않고 자동으로 인터넷 연결을 시작하는 방법

Linux가 부팅될 때마다 아래 두 명령을 수동으로 사용하여 인터넷에 연결해야 합니다.

ethtool -s eth0 autoneg off speed 100 duplex full

ifup eth0

부팅 후 바로 실행 하면 ethtool eth0문제가 다음과 같이 설명됩니다 Link detected: no. https://paste.debian.net/hidden/d2b0d461/

이 라우터의 케이블을 이전 DSL 라우터 연결(다른 ISP이지만 Linux 컴퓨터에 동일한 이더넷 케이블을 사용하더라도)로 변경하면 동일한 Linux 컴퓨터가 재부팅 후 인터넷 연결을 수신하므로 다른 추가 명령이 필요하지 않습니다.

Lubuntu가 부팅될 때 자동으로 인터넷 연결을 시작하는 방법을 찾고 있습니다.

/etc/네트워크/인터페이스:

# 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:

#!/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

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:~$

Lubuntu를 시작할 때 다음 오류가 발생합니다.

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:

#
# /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

이것이 어떻게 발생하는지 아신다면 동일한 머신 + 동일한 OS(Linux의 경우 구성 변경 없음) + 동일한 이더넷 케이블이 항상 자동으로 인터넷을 "수신 및 유지"합니다(추가 수동 명령 없음). 3가지 다른 라우터 모델 모두에 대해.

네 번째 문제가 있는 연결 및 라우터를 제외하고 3개의 연결 및 라우터는 모두 동일한 ISP에서 제공됩니다.

최고의 소원.

답변1

rc.local의 이 오류 메시지는 xrandr 오류입니다. xrandr은 rc.local에서 작동하지 않습니다. 그런 다음 rc.local을 실행하는 데 사용되므로 sh -e첫 번째 오류가 발생하면 종료됩니다. 따라서 ethtool 라인은 실행되지 않습니다.

답변2

최종 결과는 더 많은 수동 명령이 필요 없이 재부팅/종료/절전 후 자동으로 인터넷에 액세스하기 위한 것 같습니다.

/etc/네트워크/인터페이스

# 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

#!/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

관련 정보