# script for up interface

## ttre

```
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

----------

## xaviermiller

Hi!

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

----------

## ttre

I have:

```
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                        
```

----------

## ian.au

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

https://wiki.gentoo.org/wiki/Network_management_using_DHCPCD

```
root #rc-update add dhcpcd default

root #/etc/init.d/dhcpcd start
```

edit: cut emerge dhcpcd as noticed you have it installed after posting

----------

## ttre

ok, it works now.

----------

## ttre

 *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 ?

----------

## charles17

 *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?

----------

## UberLord

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.

----------

