<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Freebsd on Simon Žekar — unix, communications, stupidities</title><link>https://simon.zekar.com/tags/freebsd/</link><description>Recent content in Freebsd on Simon Žekar — unix, communications, stupidities</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Fri, 08 Mar 2013 21:58:46 +0000</lastBuildDate><atom:link href="https://simon.zekar.com/tags/freebsd/index.xml" rel="self" type="application/rss+xml"/><item><title>FreeBSD view bandwidth and total bytes transferred for interface</title><link>https://simon.zekar.com/2013/03/08/freebsd-view-bandwidth-transferred/</link><pubDate>Fri, 08 Mar 2013 21:58:46 +0000</pubDate><guid>https://simon.zekar.com/2013/03/08/freebsd-view-bandwidth-transferred/</guid><description>&lt;p>Always installed &lt;a href="http://sourceforge.net/projects/nload/">nload&lt;/a> on the server for which I wanted to view the bandwidth usage on.&lt;/p>
&lt;p>But there’s preinstalled not-so-fancy-but-usable utility for FreeBSD:&lt;/p>
&lt;p>&lt;code>systat -ifstat 1&lt;/code>&lt;/p>
&lt;p>S.&lt;/p></description></item><item><title>FreeBSD disk/partition resize – grow on version 8.2 and newer under vmware vSphere / ESXi</title><link>https://simon.zekar.com/2013/03/01/freebsd-disk-partition-resize-grow-on-version-8-x-and-newer-under-vmware-vsphere-esxi/</link><pubDate>Fri, 01 Mar 2013 21:47:15 +0000</pubDate><guid>https://simon.zekar.com/2013/03/01/freebsd-disk-partition-resize-grow-on-version-8-x-and-newer-under-vmware-vsphere-esxi/</guid><description>&lt;p>This one is easier than &lt;a href="https://simon.zekar.com/2012/05/18/freebsd-grow-partition-disk-vmware-esxi/">previous&lt;/a> (FreeBSD 7.x or older).&lt;/p>
&lt;p>It may be possible to do it all live but you need to find a way for FreeBSD to see the growed disk size.&lt;/p>
&lt;ul>
&lt;li>Shut down the server&lt;/li>
&lt;li>Grow the disk size&lt;/li>
&lt;li>Boot FreeBSD in single user mode (number 4 at boot)&lt;/li>
&lt;/ul>
&lt;p>Check the partitions layout:&lt;/p>
&lt;p>&lt;code>gpart show&lt;/code>&lt;/p>
&lt;p>Set the system in evil mode that will allow gpart to change live filesystem:&lt;/p>
&lt;p>&lt;code>sysctl kern.geom.debugflags=16&lt;/code>&lt;/p>
&lt;p>Grow the whole disk – consumer. Number 1 is the consumer index shown with gpart show&lt;/p>
&lt;p>&lt;code>gpart resize -i 1 da0&lt;/code>&lt;/p>
&lt;p>Grow desired provider – partition. Number 6 is the provider index shown with gpart show&lt;/p>
&lt;p>&lt;code>gpart resize -i 6 da0s1&lt;/code>&lt;/p>
&lt;p>Now with partition resized you can growfs&lt;/p>
&lt;p>&lt;code>growfs /dev/da0s1f&lt;/code>&lt;/p>
&lt;p>Reboot for a clean feeling and you’re done.&lt;/p>
&lt;p>S.&lt;/p></description></item><item><title>syncing FreeBSD server with NTP is simpler than you may think</title><link>https://simon.zekar.com/2011/03/25/syncing-freebsd-server-with-the-ntp-clock/</link><pubDate>Fri, 25 Mar 2011 22:55:24 +0000</pubDate><guid>https://simon.zekar.com/2011/03/25/syncing-freebsd-server-with-the-ntp-clock/</guid><description>&lt;p>After setting up a config file for the &lt;a href="http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-ntp.html">NTP on every server&lt;/a>, i figured out that a stock settings just work.&lt;/p>
&lt;p>so adding:&lt;/p>
&lt;pre tabindex="0">&lt;code>ntpd_enable=&amp;#34;YES&amp;#34;
ntpdate_enable=&amp;#34;YES&amp;#34;
&lt;/code>&lt;/pre>&lt;p>to the /etc/rc.conf just does the trick (and starting services if not rebooting the server).&lt;/p>
&lt;p>After some moments of running the ntp client you can check it with:&lt;/p>
&lt;pre tabindex="0">&lt;code># ntpq -c peers
remote refid st t when poll reach delay offset jitter
==============================================================================
*ntp2.Housing.Be 128.32.206.55 2 u 16 64 377 189.371 -14.785 5.513
mighty.poclabs. 169.229.70.64 3 u 28 64 377 132.913 -14.411 5.034
+vps1.cobryce.co 64.235.98.66 3 u 16 64 377 180.600 -22.410 5.258
&lt;/code>&lt;/pre>&lt;p>where servers marked with * are the selected server and + are the candidates for ntp sync.&lt;/p></description></item><item><title>FreeBSD and shared iLo 2 port on HP servers</title><link>https://simon.zekar.com/2010/04/24/freebsd-and-shared-ilo-2-port-on-hp-servers/</link><pubDate>Sat, 24 Apr 2010 00:10:53 +0000</pubDate><guid>https://simon.zekar.com/2010/04/24/freebsd-and-shared-ilo-2-port-on-hp-servers/</guid><description>&lt;p>In order for &lt;a href="http://h18000.www1.hp.com/products/servers/management/remotemgmt.html">HP iLo 2 management interface&lt;/a> to continue working on a shared ethernet port after &lt;a href="http://www.freebsd.org/">FreeBSD&lt;/a> kernel loads the bge drivers, you must add following line to /boot/loader.conf&lt;/p>
&lt;p>&lt;code>hw.bge.allow_asf=&amp;quot;1&amp;quot;&lt;/code>&lt;/p>
&lt;p>And reboot.&lt;/p>
&lt;p>Hope it will save you some minutes figuring it out…&lt;/p>
&lt;p>S.&lt;/p></description></item><item><title>FreeBSD massive port forwarding</title><link>https://simon.zekar.com/2009/02/07/freebsd-massive-port-forwarding/</link><pubDate>Sat, 07 Feb 2009 22:15:08 +0000</pubDate><guid>https://simon.zekar.com/2009/02/07/freebsd-massive-port-forwarding/</guid><description>&lt;p>&lt;a href="http://portfwd.sourceforge.net/">Portfwd&lt;/a> was the choice of software when I ever needed to forward a port from the server to another server – multiple hops away (not NAT port mapping).&lt;/p>
&lt;p>It uses configuration like this (193.2.1.66 is the local ip, 193.2.1.80 is destination server IP):&lt;/p>
&lt;pre tabindex="0">&lt;code>bind-address 193.2.1.66
tcp { 55443 { =&amp;gt; 193.2.1.80:443 } }
tcp { 55022 { =&amp;gt; 193.2.1.80:22 } }
&lt;/code>&lt;/pre>&lt;p>But it fails doing its job right when you use this on a really busy port/service (500 or more simultaneous established TCP connections).&lt;/p>
&lt;p>&lt;a href="http://www.openbsd.org/faq/pf/">pf&lt;/a> does the forwarding well even over 1000 TCP connections. Example:&lt;/p>
&lt;pre tabindex="0">&lt;code>rdr on em0 proto tcp from any to 193.2.1.66 port 55443 -&amp;gt; 193.2.1.80 port 443
rdr on em0 proto tcp from any to 193.2.1.66 port 55022 -&amp;gt; 193.2.1.80 port 22
nat on em0 from any to 193.2.1.80 -&amp;gt; 193.2.1.66
&lt;/code>&lt;/pre>&lt;p>– the em0 is the name of the outside interface. Without the nat rule, destination server would see a packet with source ip of the client so it would send a packet back directly to the client which causes asymmetric routing and very possible problems. The nat rule changes the source IP to the port forwarders one.&lt;/p>
&lt;p>Happy forwarding,&lt;br>
S.&lt;/p></description></item><item><title>understanding freebsd memory usage</title><link>https://simon.zekar.com/2009/01/30/understanding-freebsd-memory-usage/</link><pubDate>Fri, 30 Jan 2009 22:07:17 +0000</pubDate><guid>https://simon.zekar.com/2009/01/30/understanding-freebsd-memory-usage/</guid><description>&lt;p>I think it is better to write in english, since I’m often googling around about some problem and land on a site in chinese with some configuration pasted in the site.&lt;/p>
&lt;p>The problem is I don’t know what poor chinese boy wrote: “This configuration is working for me:” or “This configuration is not working at all, can someone help me:”. So I try it. Never worked.&lt;/p>
&lt;p>Recently I found a &lt;a href="http://lists.freebsd.org/pipermail/freebsd-questions/2005-February/075925.html">post&lt;/a> which nicely describes statuses of FreeBSD memory allocation.&lt;/p>
&lt;p>Top shows:&lt;/p>
&lt;p>&lt;code>Mem: 4589M Active, 13G Inact, 489M Wired, 733M Cache, 214M Buf, 886M Free&lt;/code>&lt;/p>
&lt;p>And the snip from the post:&lt;/p>
&lt;p>Memory normally moves along the following path:&lt;/p>
&lt;p>Wired -&amp;gt; Active -&amp;gt; Inactive -&amp;gt; Cached -&amp;gt; Free&lt;/p>
&lt;p>and then when it gets allocated and used it moves back to Wired.&lt;/p>
&lt;p>The difference between the categories is mainly that “Inactive” and&lt;br>
“Cached” memory still contains data that the system might be able to&lt;br>
reuse, while “Free” memory is completely free and unused.&lt;br>
In order to use Cached or Inactive memory it might need to be flushed&lt;br>
first, with Inactive probably being dirty and Cached probably not.&lt;br>
(“Active” memory is almost certainly dirty and is therefore somewhat&lt;br>
more expensive to reuse.&lt;/p></description></item><item><title>samouničenje FreeBSD-ja</title><link>https://simon.zekar.com/2009/01/30/freebsd-self-destruct/</link><pubDate>Fri, 30 Jan 2009 21:44:45 +0000</pubDate><guid>https://simon.zekar.com/2009/01/30/freebsd-self-destruct/</guid><description>&lt;p>Ker je jutri &lt;a href="http://www.tamara.si/2009/01/29/v-soboto-se-vidimo/">srečanje blogerjev&lt;/a>, jaz pa že skoraj pol leta nisem nič napisal, imam slabo vest in pišem…&lt;/p>
&lt;p>Po svetu imam kar nekaj strežnikov in pride čas, da strežnik zamenjam za novega, ob tem pa nočem da podatki pridejo v roke “nasledniku” strežnika. Poleg &lt;a href="http://sourceforge.net/projects/srm">varnega brisanja datotek&lt;/a> sem si vedno želel pognati kakšen destruktiven ukaz, ki bi strežnik zares pokončal.&lt;/p>
&lt;p>Takoj pride ideja, &lt;a href="http://en.wikipedia.org/wiki/Dd_(Unix)">dd&lt;/a> !! Vendar je FreeBSD malo zaščitniški glede pisanja po raw diskih:&lt;/p>
&lt;pre tabindex="0">&lt;code>[root@dolfi ~]# dd if=/dev/zero of=/dev/da0
dd: /dev/da0: Operation not permitted
&lt;/code>&lt;/pre>&lt;p>Rešitev se skriva v sysctl zastavici. Hvala, &lt;a href="http://default.co.yu/default/">bc&lt;/a> !&lt;/p>
&lt;p>&lt;code>[root@dolfi ~]# sysctl kern.geom.debugflags=16&lt;/code>&lt;/p>
&lt;p>po spremembi zastavice, bo dd deloval. Uničujoče. Poskusite v službi.&lt;/p></description></item><item><title>FreeBSD mount_smbfs .nsmbrc</title><link>https://simon.zekar.com/2008/08/28/freebsd-mount_smbfs-nsmbrc/</link><pubDate>Thu, 28 Aug 2008 22:39:24 +0000</pubDate><guid>https://simon.zekar.com/2008/08/28/freebsd-mount_smbfs-nsmbrc/</guid><description>&lt;p>Tale je za v arhiv, ker naslednjič bom vedel, da sem stvar že rešil, ampak ne kako…&lt;/p>
&lt;p>Torej za avtomatski mount windows share-a iz /etc/fstab je konfiguracija sledeča…&lt;/p>
&lt;pre tabindex="0">&lt;code>/etc/fstab:
//BACKUP_USER@BACKUP_SERVER/BACKUP_SHARE /back/ar4 smbfs rw,-N 0 0
&lt;/code>&lt;/pre>&lt;pre tabindex="0">&lt;code>~/.nsmbrc:
[default]
workgroup=WORKGROUP
[BACKUP_SERVER]
addr=10.10.10.10
[BACKUP_SERVER:BACKUP_USER]
password=geslo
&lt;/code>&lt;/pre></description></item></channel></rss>