Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
script for up interface
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
ttre
n00b
n00b


Joined: 04 Aug 2016
Posts: 29

PostPosted: Wed Aug 17, 2016 9:23 am    Post subject: script for up interface Reply with quote

Code:
enp0s29f0u1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.0.203  netmask 255.255.255.0  broadcast 10.0.0.255
        inet6 fe80::26a5:b629:f948:92c3  prefixlen 64  scopeid 0x20<link>
        ether 00:e0:4c:53:44:58  txqueuelen 1000  (Ethernet)
        RX packets 11465  bytes 13286926 (12.6 MiB)
        RX errors 174  dropped 39  overruns 50  frame 234
        TX packets 8076  bytes 1762336 (1.6 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 12  bytes 780 (780.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 12  bytes 780 (780.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp2s0b1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether c4:46:19:0b:5b:dc  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


After some time wlp2s0b1 and enp0s29f0u1 are down.
I dont know why, maybe it is hardware problem.
I have to up my enp0s29f0u1 so I do:
# ifconfig enp0s29f0u1 down
# ifconfig enp0s29f0u1 up
# dhcpcd

1. Is possible to do script for automate it ?
Check for every 30s if enp0s29f0u1 is up, and if it's not do ifconfig enp0s29f0u1 down ; ifconfig enp0s29f0u1 up ; dhcpcd

2. Is there any log when I can see what happen in my hardware ?


Last edited by ttre on Sun Oct 30, 2016 9:08 am; edited 2 times in total
Back to top
View user's profile Send private message
xaviermiller
Administrator
Administrator


Joined: 23 Jul 2004
Posts: 7895
Location: ~Brussels - Belgique

PostPosted: Wed Aug 17, 2016 9:25 am    Post subject: Reply with quote

Hi!

If you run dhcpcd as a service, it will do it automatically for you.
_________________
Kind regards,
Xavier Miller
Back to top
View user's profile Send private message
ttre
n00b
n00b


Joined: 04 Aug 2016
Posts: 29

PostPosted: Wed Aug 17, 2016 9:56 am    Post subject: Reply with quote

I have:

Code:
rc-update -a
               binfmt | boot                         
             bootmisc | boot                         
               cronie |      default                 
                 dbus |      default                 
                devfs |                       sysinit
                dmesg |                       sysinit
                 fsck | boot                         
             hostname | boot                         
              hwclock | boot                         
              keymaps | boot                         
            killprocs |              shutdown       
    kmod-static-nodes |                       sysinit
                local |      default                 
           localmount | boot                         
             loopback | boot                         
              modules | boot                         
             mount-ro |              shutdown       
                 mtab | boot                         
      net.enp0s29f0u1 |      default                 
             netmount |      default                 
               procfs | boot                         
                 root | boot                         
            savecache |              shutdown       
                 swap | boot                         
            swapfiles | boot                         
               sysctl | boot                         
                sysfs |                       sysinit
            syslog-ng |      default                 
         termencoding | boot                         
         tmpfiles.dev |                       sysinit
       tmpfiles.setup | boot                         
                 udev |                       sysinit
              urandom | boot                       
Back to top
View user's profile Send private message
ian.au
Guru
Guru


Joined: 07 Apr 2011
Posts: 422
Location: Australia

PostPosted: Wed Aug 17, 2016 10:03 am    Post subject: Reply with quote

https://wiki.gentoo.org/wiki/Dhcpcd

https://wiki.gentoo.org/wiki/Network_management_using_DHCPCD
Code:
root #rc-update add dhcpcd default
root #/etc/init.d/dhcpcd start


edit: cut emerge dhcpcd as noticed you have it installed after posting
Back to top
View user's profile Send private message
ttre
n00b
n00b


Joined: 04 Aug 2016
Posts: 29

PostPosted: Thu Aug 18, 2016 3:22 pm    Post subject: Reply with quote

ok, it works now.
Back to top
View user's profile Send private message
ttre
n00b
n00b


Joined: 04 Aug 2016
Posts: 29

PostPosted: Sun Oct 30, 2016 9:08 am    Post subject: Reply with quote

xaviermiller wrote:
Hi!

If you run dhcpcd as a service, it will do it automatically for you.


Yes it works, but IP disappears for 20-40s, and after that it shows up again.
Usually IP shows only for few sec, and it disappears for 20-40s again.
ping to any site doesn't work in that time.

Is it possible to change frequency of dhcpcd checking status and take ip from router often than normal?

How to disable IPv6, maybe it helps ?
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2583

PostPosted: Mon Oct 31, 2016 10:17 am    Post subject: Reply with quote

ttre wrote:
Yes it works, but IP disappears for 20-40s, and after that it shows up again.
Usually IP shows only for few sec, and it disappears for 20-40s again.

Where do you see it appears or disappears? What do you have in your output of # dhcpcd -dB?
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6737
Location: Blighty

PostPosted: Mon Oct 31, 2016 3:45 pm    Post subject: Reply with quote

dhcpcd (like nearly all network managers) removes the IP address when the carrier is lost.
When the carrier is aquired an address is renegotiated.
This is likey what you are seeing, so you're correct in that the software is reacting to a hardware issue.

dhcpcd does this so that there is almost zero chance of sending data from invalid (duplicate or wrong network) addresses because the kernel makes no attempt at deciding this.
Well, on Linux anyway. NetBSD -current does DaD for IPv4 addresses (only kernel which does this AFAIK) AND re-runs DaD for IPv4 and IPv6 when the carrier comes back up - sending from the address won't go anywhere until DaD hs completed. dhcpcd can take this into account so the IP address never vanishes and the application stands a good chance of continuing - like say ssh.
Anyway, I'm not really here to advertise NetBSD as it's a Gentoo forum, but if the above is really important to anyone then you know a little more.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum