{"id":670,"date":"2015-03-13T12:58:46","date_gmt":"2015-03-13T10:58:46","guid":{"rendered":"http:\/\/dety.net.ua\/?p=670"},"modified":"2015-03-13T12:59:59","modified_gmt":"2015-03-13T10:59:59","slug":"pfsense-dhcp-issues-from-provider","status":"publish","type":"post","link":"https:\/\/dety.net.ua\/?p=670","title":{"rendered":"PFSense + DHCP issues from provider"},"content":{"rendered":"<p>I met a strange issue with an internet channel from my provider: it doesn&#8217;t assign an IP (PFSense gets 0.0.0.0 and the provider blocks me) via DHCP or the channel stops working(IP is assigned).<\/p>\n<p>I suppose provider has got several DHCP-servers and they are configured with to much security.<\/p>\n<p>So, I wrote a script to detect these issues, change a mac and reset dhcp-client:<\/p>\n<blockquote><p>#!\/bin\/sh<\/p>\n<p># Prepare a mail<br \/>\necho &#8220;To: admin@contoso.com&#8221; &gt; \/usr\/local\/etc\/mail2.txt<br \/>\necho &#8220;From: admin@mydomain.com&#8221; &gt;&gt; \/usr\/local\/etc\/mail2.txt<br \/>\necho &#8220;Subject: DHCP RESET&#8221; &gt;&gt; \/usr\/local\/etc\/mail2.txt<br \/>\necho &#8220;text&#8221; &gt;&gt; \/usr\/local\/etc\/mail2.txt<\/p>\n<p># Check ping<br \/>\nping -c 2 -S 8.8.8.50 8.8.8.1 &gt;\/dev\/null 2&gt;&amp;1<br \/>\nif [ $? -eq 0 ]; then<br \/>\necho &#8221; Ping [OK]&#8221;<br \/>\nISP1_stat=&#8221;0&#8243;<br \/>\necho &#8220;Ping OK, checking the DHCP &#8230;&#8221; &gt;&gt; \/usr\/local\/etc\/mail2.txt<br \/>\nelse<br \/>\necho &#8221; Ping [FAILED]&#8221;<br \/>\nISP1_stat=&#8221;1&#8243;<br \/>\necho &#8220;Ping failed&#8221; &gt;&gt; \/usr\/local\/etc\/mail2.txt<br \/>\nfi<\/p>\n<p># Get IP-address for rl0<br \/>\nmac=`ifconfig rl0 | grep ether | awk &#8216;{print $2}&#8217;`<br \/>\nip=`ifconfig rl0 | grep &#8220;inet &#8221; | awk &#8216;{print $2}&#8217;`<br \/>\necho $ip $mac<br \/>\nif [ &#8220;$ip&#8221; == &#8220;&#8221; ] || [ &#8220;$ip&#8221; == &#8220;0.0.0.0&#8221; ] || [ &#8220;$ISP1_stat&#8221; == &#8220;1&#8221; ]; then<br \/>\necho &#8220;No IP assigned for rl0 &#8230; \/n Resetting MAC &#8230; \/n&#8221;<br \/>\nifconfig rl0 down<br \/>\nif [ &#8220;$mac&#8221; -eq &#8220;c8:d3:a3:83:c9:a2&#8221; ]; then<br \/>\nifconfig rl0 ether c8:d3:a3:83:c9:a3<br \/>\nfi<br \/>\nif [ &#8220;$mac&#8221; -eq &#8220;c8:d3:a3:83:c9:a3&#8221; ]; then<br \/>\nifconfig rl0 ether c8:d3:a3:83:c9:a2<br \/>\nfi<br \/>\nifconfig rl0 up<br \/>\nkillall dhclient<br \/>\ndhclient rl0<br \/>\n\/usr\/local\/sbin\/ssmtp admin@contoso.com &lt; \/usr\/local\/etc\/mail2.txt<br \/>\nfi<br \/>\necho $ISP1_STAT<br \/>\necho &#8220;rl0 ip: $ip &#8211; everything is ok.&#8221;<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>I met a strange issue with an internet channel from my provider: it doesn&#8217;t assign an IP (PFSense gets 0.0.0.0 and the provider blocks me) via DHCP or the channel stops working(IP is assigned). I suppose provider has got several DHCP-servers and they are configured with to much security. So, I wrote a script to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,13],"tags":[],"class_list":["post-670","post","type-post","status-publish","format-standard","hentry","category-freebsd","category-novosti"],"_links":{"self":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts\/670","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=670"}],"version-history":[{"count":3,"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts\/670\/revisions"}],"predecessor-version":[{"id":673,"href":"https:\/\/dety.net.ua\/index.php?rest_route=\/wp\/v2\/posts\/670\/revisions\/673"}],"wp:attachment":[{"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=670"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=670"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dety.net.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=670"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}