Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: How to reconnect network cable programmatically

  1. #1

    Default How to reconnect network cable programmatically

    openSUSE 11.2
    My network connection breaks almost every day. I don't know whose this problem - is it my system or my provider. Everything goes ok until some moment when network disappears and ping my gateway returns "Unreachable host". In that situation i usually plug out cable and plug it in again - now network works.
    I wounder if there is a way to do something from console which has the same effect as plugging out/in cable?
    Or may be more preferred way - can i know what exactly doesn't work when network disappears? What i must repair? May be it save me from reconnecting cable

  2. #2
    Join Date
    Sep 2009
    Location
    Seattle, WA
    Posts
    276

    Default Re: How to reconnect network cable programmatically

    Quote Originally Posted by itten View Post
    openSUSE 11.2
    My network connection breaks almost every day. I don't know whose this problem - is it my system or my provider. Everything goes ok until some moment when network disappears and ping my gateway returns "Unreachable host". In that situation i usually plug out cable and plug it in again - now network works.
    I wounder if there is a way to do something from console which has the same effect as plugging out/in cable?
    Or may be more preferred way - can i know what exactly doesn't work when network disappears? What i must repair? May be it save me from reconnecting cable
    Clarification, by cable do you mean a lan cable or a broadband cable? I'll assume you mean lan cable.

    You could try as root:
    Code:
    service network restart
    Please provide some more information: kernel version, desktop and version, whether controlled with ifup or a network manager, computer make/model, and ethernet card.

    Give us that info and get back to us here.
    Tom Taylor - retired penguin
    AMD Phenom II x4 955 -- 4GB RAM -- 2x1.5TB sata3
    openSUSE 12.3x86_64 openSUSE 13.1-M2x86_64
    KDE 4.8.5, FF 14.0.1 - 8- KDE 4.10.0, FF 20.0
    registered linux user 263467

  3. #3

    Default Re: How to reconnect network cable programmatically

    Yes, i mean lan cable.
    My system:
    openSUSE 11.2 (x86_64)

    uname -a
    Linux host-120-5-75 2.6.31.8-0.1-desktop #1 SMP PREEMPT 2009-12-15 23:55:40 +0100 x86_64 x86_64 x86_64 GNU/Linux

    kde4-config --version
    Qt: 4.5.3
    KDE: 4.3.4 (KDE 4.3.4) "release 2"

    I use ifup.

    cat /proc/cpuinfo
    processor : 0
    vendor_id : GenuineIntel
    cpu family : 6
    model : 15
    model name : Intel(R) Core(TM)2 Duo CPU E6750 @ 2.66GHz
    stepping : 11
    cpu MHz : 1998.000
    cache size : 4096 KB
    physical id : 0
    siblings : 2
    core id : 0
    cpu cores : 2
    apicid : 0
    initial apicid : 0
    fpu : yes
    fpu_exception : yes
    cpuid level : 10
    wp : yes
    flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm lahf_lm tpr_shadow vnmi flexpriority
    bogomips : 5331.83
    clflush size : 64
    cache_alignment : 64
    address sizes : 36 bits physical, 48 bits virtual
    power management:

    processor : 1
    vendor_id : GenuineIntel
    cpu family : 6
    model : 15
    model name : Intel(R) Core(TM)2 Duo CPU E6750 @ 2.66GHz
    stepping : 11
    cpu MHz : 1998.000
    cache size : 4096 KB
    physical id : 0
    siblings : 2
    core id : 1
    cpu cores : 2
    apicid : 1
    initial apicid : 1
    fpu : yes
    fpu_exception : yes
    cpuid level : 10
    wp : yes
    flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm lahf_lm tpr_shadow vnmi flexpriority
    bogomips : 5331.76
    clflush size : 64
    cache_alignment : 64
    address sizes : 36 bits physical, 48 bits virtual
    power management:

    I don't know what exactly you need to know about ethernet card. Here is what i found

    PCI 19.0: 0200 Ethernet controller
    [Created at pci.318]
    UDI: /org/freedesktop/Hal/devices/pci_8086_294c
    Unique ID: rBUF.I8NDuGkSsw1
    SysFS ID: /devices/pci0000:00/0000:00:19.0
    SysFS BusID: 0000:00:19.0
    Hardware Class: network
    Model: "Intel 82566DC-2 Gigabit Network Connection"
    Vendor: pci 0x8086 "Intel Corporation"
    Device: pci 0x294c "82566DC-2 Gigabit Network Connection"
    SubVendor: pci 0x8086 "Intel Corporation"
    SubDevice: pci 0x0001
    Revision: 0x02
    Driver: "e1000e"
    Driver Modules: "e1000e"
    Device File: eth0
    Memory Range: 0x93200000-0x9321ffff (rw,non-prefetchable)
    Memory Range: 0x93224000-0x93224fff (rw,non-prefetchable)
    I/O Ports: 0x3400-0x341f (rw)
    IRQ: 31 (14817 events)
    HW Address: 00:19:d1:9e:9e:59
    Link detected: yes
    Module Alias: "pci:v00008086d0000294Csv00008086sd00000001bc02sc00i00"
    Driver Info #0:
    Driver Status: e1000e is active
    Driver Activation Cmd: "modprobe e1000e"
    Config Status: cfg=no, avail=yes, need=no, active=unknown

    If you want something else - just tell me how to get it.
    Thanks for your reply
    openSUSE 11.2 x64, KDE, Nvidia 9500 GT

  4. #4

    Default Re: How to reconnect network cable programmatically

    Put a this tiny script in ~/bin/ with a short name you can remember easily.

    Do something like this
    #!/bin/bash
    sudo /etc/init.d/network restart

    It would be convenient to implement something like this to /etc/sudoers
    %users ALL = NOPASSWD: /etc/init.d/network

    Call the script from the command line (when it is placed in ~/bin/ your system will know the PATH) or create a shortcut in your desktop environment or both.

  5. #5
    Join Date
    Jan 2009
    Location
    Switzerland
    Posts
    1,529

    Default Re: How to reconnect network cable programmatically

    Wrong driver module. To me it seems you need the e1000 driver. Can you try it?
    Technology is 'stuff that doesn't work yet.' -- Bran Ferren

  6. #6
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    19,806
    Blog Entries
    14

    Default Re: How to reconnect network cable programmatically

    Quote Originally Posted by vodoo View Post
    Wrong driver module.
    Could very well be. Please issue command below, right after a network disconnect:

    dmesg | tail -20

    That should show the disconnect and maybe a reason why.
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  7. #7

    Default Re: How to reconnect network cable programmatically

    Quote Originally Posted by vodoo View Post
    Wrong driver module. To me it seems you need the e1000 driver. Can you try it?
    How can i do this change?


    Please issue command below, right after a network disconnect:
    dmesg | tail -20
    ok, as far as i get the next disconnect


    joostvanrooij, thanks. If nothing will help i'll try your advice
    openSUSE 11.2 x64, KDE, Nvidia 9500 GT

  8. #8
    Join Date
    Jan 2009
    Location
    Switzerland
    Posts
    1,529

    Default Re: How to reconnect network cable programmatically

    How can i do this change?
    There is a file /etc/modprobe.d/50-blacklist.conf

    Edit this file and add a line (as user root)

    Code:
    blacklist e1000e
    Then - still as root - type on the command line:

    Code:
    modprobe -r e1000e
    modprobe e1000
    rcnetwork restart
    Check that the network is ok (visit some website).

    Eventually reboot to check that the right module comes up now on boot. You do this on the command line with

    Code:
    lsmod
    Technology is 'stuff that doesn't work yet.' -- Bran Ferren

  9. #9

    Default Re: How to reconnect network cable programmatically

    I learned deeper into this stuff and this is what i found on intel site:
    ------------------------------------------------------
    The e1000e.x.x.x.x.tar.gz is designed to work with the Intel 82571/2/3/4/7/8, 82566/7, and 82583 PCI-E family of controllers.

    This driver includes support for Itanium 2-based and Intel EM64T systems.

    If your adapter/connection is not 82571, 82572, 82573, 82574, 82566, 82567, or 82583 -based, you should use one of the following drivers:

    - igb-x.x.x.tar.gz driver supports all Intel 82575/6-based gigabit network adapters/connections.

    - e1000-x.x.x.tar.gz driver supports all Intel 8254x-based PCI and PCI-X gigabit network adapters/connections.
    ------------------------------------------------------

    Also i went to yast to Network Settings and found there field "Module name" - there is only one available name - "e1000e"

    So i afraid i can't use e1000

    Also i checked driver version:
    /sbin/ethtool -i eth0
    driver: e1000e
    version: 1.0.2-k2
    firmware-version: 1.3-0
    bus-info: 0000:00:19.0

    So i decided to start from upgrading driver and now
    /sbin/ethtool -i eth0
    driver: e1000e
    version: 1.1.3-NAPI
    firmware-version: 1.3-0
    bus-info: 0000:00:19.0

    I'm going to wait a little and watch the difference - may be everything will be ok.
    One thing to note - the previous e1000e driver file was 230 KB and the new one is 3.5MB - it's huge difference! Is it normal?
    openSUSE 11.2 x64, KDE, Nvidia 9500 GT

  10. #10

    Default Re: How to reconnect network cable programmatically

    Two more questions:
    1)Why system doesn't update drivers? - i always update system from yast and nevertheless i had such old driver.
    2)the directory /lib/modules/2.6.31.8-0.1-desktop/kernel/drivers/net has a lot of drivers. Will i right if i say: all of them are unnecessary except my e1000e
    openSUSE 11.2 x64, KDE, Nvidia 9500 GT

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •