{"id":1232,"date":"2021-05-31T09:15:49","date_gmt":"2021-05-31T15:15:49","guid":{"rendered":"https:\/\/wmbuck.net\/blog\/?p=1232"},"modified":"2021-07-10T16:11:48","modified_gmt":"2021-07-10T22:11:48","slug":"waiting-for-networks","status":"publish","type":"post","link":"https:\/\/wmbuck.net\/blog\/?p=1232","title":{"rendered":"Waiting for networks"},"content":{"rendered":"\n<p>I was revising some things in my startup scripts. I have a sort of generalized startup script in all the boxes in my constellation, which is capable of doing 8 or 10 different things that various of the boxes need to do at startup. <\/p>\n\n\n\n<p>For example, the various gateway boxes need to open up (auto)ssh connections to my house with reverse tunnels so I can reach them. On some boxes I want them to open a vncserver so I can get a graphical environment up. On some others they may need to mount some filesystems, with smb or nfs. On some of them I want them to figure out where their router is, in case I want to open up their router in a browser. On some I need them to establish the keychain. <\/p>\n\n\n\n<!--more-->\n\n\n\n<p>I noted that some of the raspbian pis would fail sometimes because the startup would run before the network was fully up, and I had to &#8220;relearn&#8221; that raspbian has a setting in raspi-config to wait for the network. Hmmm. How do they do that? <\/p>\n\n\n\n<p>I dug around and I learned that if you ask raspbian to wait for the network what it actually does is to use dhcpcd5 -q -w. The w parameter says &#8220;Wait for an address to be assigned before forking to the background.&#8221; Cool. <\/p>\n\n\n\n<p>I only use dhcpcd5 on the raspbian boxes, on most of the other linux boxes I use dhclient, or the inbuilt client in NetworkManager or systemd-networkd. While dhclient doesn&#8217;t have a similar parameter that I can find, NetworkManager does have a command for this: nm-online. On a system which used systemd-networkd and did not have NetworkManager, this can also be done with the one-shot systemd-networkd-wait-online service, but I haven&#8217;t done that. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was revising some things in my startup scripts. I have a sort of generalized startup script in all the boxes in my constellation, which is capable of doing 8 or 10 different things that various of the boxes need to do at startup. For example, the various gateway boxes need to open up (auto)ssh &hellip; <a href=\"https:\/\/wmbuck.net\/blog\/?p=1232\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Waiting for networks<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[42,40,46,4,41,45,50,9],"tags":[],"class_list":["post-1232","post","type-post","status-publish","format-standard","hentry","category-arch-linux","category-boot-issues","category-gateways","category-linux","category-networking","category-raspberry-pi","category-raspbian","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1232"}],"collection":[{"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1232"}],"version-history":[{"count":2,"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1232\/revisions"}],"predecessor-version":[{"id":1265,"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1232\/revisions\/1265"}],"wp:attachment":[{"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1232"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1232"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wmbuck.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}