You are not logged in.

#1 2021-05-16 11:01:14

ricco75
Member
Registered: 2020-11-11
Posts: 22

How force a network activated even if there is no wire ??

Hello every everybody

i have got a problem with an intelligent switch wired bewind my computer is slower to start than my computer and finaly when arch linux is starter it like to have no connection wired at the startup.
No ethernet card activated even if all connection are wired 30seconds after it's boot.
Need to restart the computer and everythings are correct....

How to solve this problem ???
I think i have missed something... ?

Thanks in advance

Description='Static ethernet connection enp0s10'
Interface=enp0s10
Connection=ethernet
IP=static
Address=('192.168.0.90/24')
Gateway='192.168.0.254'
DNS=('192.168.0.254')

AutoWired=yes

## For IPv6 autoconfiguration
#IP6=stateless

## For IPv6 static address configuration
#IP6=static
#Address6=('1234:5678:9abc:def::1/64' '1234:3456::123/96')
#Routes6=('abcd::1234')
#Gateway6='1234:0:123::abcd'
[Unit]
Description=IPv4 DHCP server
After=network.target network-online.target
Wants=network-online.target

[Service]
Type=forking
#ExecStart=/usr/bin/dhcpd -4 -q -cf /etc/dhcpd.conf -pf /run/dhcpd4/dhcpd.pid
ExecStart=/usr/bin/dhcpd -4 -q -cf /etc/dhcpd.conf -pf /run/dhcpd4/dhcpd.pid %I
RuntimeDirectory=dhcpd4
PIDFile=/run/dhcpd4/dhcpd.pid
User=dhcp
AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_NET_RAW
ProtectSystem=full
ProtectHome=on
KillSignal=SIGINT
# We pull in network-online.target for a configured network connection.
# However this is not guaranteed to be the network connection our
# networks are configured for. So try to restart on failure with a delay
# of two seconds. Rate limiting kicks in after 12 seconds.
RestartSec=2s
Restart=on-failure
StartLimitInterval=12s

[Install]
WantedBy=multi-user.target

Last edited by ricco75 (2021-05-16 11:16:43)

Offline

#2 2021-05-16 11:45:15

ricco75
Member
Registered: 2020-11-11
Posts: 22

Re: How force a network activated even if there is no wire ??

hello

I have found the solution for the 1st card for the moment and i think it's same for the other.

https://wiki.archlinux.fr/Connexions_reseau


sudo nano /etc/systemd/system/network.service
[Unit]
Description=Network Connectivity
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-enp0s10.device
After=sys-subsystem-net-devices-enp0s10.device

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/ip link set dev enp0s10 up
ExecStart=/sbin/ip addr add 192.168.0.90/255.255.255.0 broadcast 192.168.0.255 dev enp0s10
ExecStart=/sbin/ip route add default via 192.168.0.1
ExecStop=/sbin/ip addr flush dev enp0s10
ExecStop=/sbin/ip link set dev enp0s10 down

[Install]
WantedBy=multi-user.target

Offline

#3 2021-05-16 21:53:15

ricco75
Member
Registered: 2020-11-11
Posts: 22

Re: How force a network activated even if there is no wire ??

Oupppps no
it's not the same for the second card.
Have you got a idea ???
thanks

Offline

#4 2021-05-16 21:54:49

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: How force a network activated even if there is no wire ??

Turn the switch on first?


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#5 2021-05-16 22:49:02

seth
Member
Registered: 2012-09-03
Posts: 60,943

Re: How force a network activated even if there is no wire ??

ExecStartPre=/usr/bin/sleep 30

Systemd can configure an interface w/o carrier,  https://github.com/NixOS/nixpkgs/issues/62844

Edit: need sleep

Last edited by seth (2021-05-16 22:49:26)

Offline

#6 2021-05-17 13:28:39

Maniaxx
Member
Registered: 2014-05-14
Posts: 757

Re: How force a network activated even if there is no wire ??

Have you checked the LEDs? The switch might go crazy on Layer1 during initialization. Either "no power" or worse "bad state" confusing the client.
What happens if you pull the cable and boot up the system?
You could try to delay bringing up the NIC but if a network restart doesn't even work something more serious might be going on. Maybe try to reload the driver.

Last edited by Maniaxx (2021-05-17 13:41:39)


sys2064

Offline

#7 2021-05-17 19:15:16

ricco75
Member
Registered: 2020-11-11
Posts: 22

Re: How force a network activated even if there is no wire ??

Hello
The Computer start  around 20s
The switch is a Gigabit Layer 2 boot in around  45s.

i have make 2 services :
- 1 with RJ45 Motherboard port activated : name : network.service
- 1 with RJ45 USB converter port activated : name : network2.service

If there is no wire connected to ;
- the motherboard, interface is up
- the usb converter is down

network.service

  GNU nano 5.7                               /etc/systemd/system/network.service
[Unit]
Description=Network Connectivity
Wants=network.target
Before=network.target

#MOTHERBOARD RJ45 PORT
BindsTo=sys-subsystem-net-devices-enp0s10.device
After=sys-subsystem-net-devices-enp0s10.device

#USB ETHERNET RJ45 PORT
#BindsTo=sys-subsystem-net-devices-enp0s4flu4.device
#After=sys-subsystem-net-devices-enp0s4flu4.device

[Service]
Type=oneshot
RemainAfterExit=yes
#MOTHERBOARD RJ45 PORT
ExecStart=/sbin/ip link set dev enp0s10 up
ExecStart=/sbin/ip addr add 192.168.0.90/255.255.255.0 broadcast 192.168.0.255 dev enp0s10
ExecStart=/sbin/ip route add default via 192.168.0.254
ExecStop=/sbin/ip addr flush dev enp0s10
ExecStop=/sbin/ip link set dev enp0s10 down

#USB ETHERNET RJ45 PORT
#ExecStart=/sbin/ip link set dev enp0s4flu4 up
#ExecStart=/sbin/ip addr add 192.168.1.253/255.255.255.0 broadcast 192.168.1.255 dev enp0s4flu4
#ExecStart=/sbin/ip route add default via 192.168.1.254
#ExecStop=/sbin/ip addr flush dev enp0s4flu4
#ExecStop=/sbin/ip link set dev enp0s4flu4 down

[Install]
WantedBy=multi-user.target

network2.service

 GNU nano 5.7                      /etc/systemd/system/network2.service
[Unit]
Description=Network Connectivity USB
Wants=network.target
Before=network.target

#MOTHERBOARD RJ45 PORT
#BindsTo=sys-subsystem-net-devices-enp0s10.device
#After=sys-subsystem-net-devices-enp0s10.device

#USB ETHERNET RJ45 PORT
BindsTo=sys-subsystem-net-devices-enp0s4flu4.device
After=sys-subsystem-net-devices-enp0s4flu4.device

[Service]
Type=oneshot
RemainAfterExit=yes

#MOTHERBOARD RJ45 PORT
#ExecStart=/sbin/ip link set dev enp0s10 up
#ExecStart=/sbin/ip addr add 192.168.0.90/255.255.255.0 broadcast 192.168.0.255 dev enp0s10
#ExecStart=/sbin/ip route add default via 192.168.0.254
#ExecStop=/sbin/ip addr flush dev enp0s10
#ExecStop=/sbin/ip link set dev enp0s10 down

#USB ETHERNET RJ45 PORT
ExecStart=/sbin/ip link set dev enp0s4flu4 up
ExecStart=/sbin/ip addr add 192.168.1.253/255.255.255.0 broadcast 192.168.1.255 dev enp0s4flu4
ExecStart=/sbin/ip route add default via 192.168.1.254
ExecStop=/sbin/ip addr flush dev enp0s4flu4
ExecStop=/sbin/ip link set dev enp0s4flu4 down

[Install]
WantedBy=multi-user.target

Last edited by ricco75 (2021-05-17 19:16:14)

Offline

Board footer

Powered by FluxBB