OpenBSD: connection problems with some sites in internet


I’m experiencing some problems when trying to connect, via web browser, with some sites as ebay or google. I’ve discovered that I get a better experience browsing when the MTU in the wifi interface (iwn0) is lower than 1500. So I put in /etc/hostname.iwn0:

 

mtu 1440 up

This is a very odd thing. MTU path discovery is permitted in my firewall configuration (icmp_types = “{ echoreq, unreach }”) and even deactivating PF the problems remain.

 

Posted in Uncategorized | Tagged , | Leave a comment

OpenBSD: hibernation rules!!!!


Simply great! hibernation in i386 works great!. It seems it could be there some issues but in my experience is pretty usable.

This is the first time I’m able to see hibernation working in a BSD laptop since my Thinkpads T20, T23 and T41 with their bios solution with a dedicated partition. So well done OpenBSD.

 

Posted in BSD, OpenBSD | Leave a comment

OpenBSD: How to avoid resolv.conf to be touched by dhclient


I prefer to provide DNS address of my choice instead those from my network provider. Usually OpenDNS servers are a good option.

So, to avoid dhclient touch ‘/etc/resolv.conf’ I configure the /etc/dhclient.conf as follows:

initial-interval 1;
send host-name “myhostname”;
#request subnet-mask, broadcast-address, routers, domain-name,
#       domain-name-servers, host-name;
#send dhcp-lease-time 3600;
supersede domain-name-servers 208.67.222.222, 208.67.220.220 ;
supersede domain-name “”;
request subnet-mask, broadcast-address, routers;

And /etc/resolv.conf.tail :

lookup file bind

 

Posted in BSD, OpenBSD | Leave a comment

OpenBSD: Laptop cpu temperature control with APM


In OpenBSD, all versions I tested, I note a performance decrease (in such way as not smooth mouse movement, or web page scrolling) when the maching is doing any heavy reading/writing task or cpu compsuming (i.e. ziping/unziping/copying a big file), even when only one core is running this process and the other ones are running at low load.

In Marc Espie’s words (http://permalink.gmane.org/gmane.os.openbsd.misc/207078):

Yes, there's something deeply fucked up somewhere in our 
scheduler/disk-handling/whatever. The issue is known.

It appears it is complicated to fix properly without replacing
it by a lot of other problems, some of which pertain to keeping
relatively old archs in working condition, or so I'm told.

A workaround to minimize this effect is running APM in automatic mode (maybe the preferred option for most people). I used to running it in Cooling mode to avoid temperature increases.

Now I use a script to control the APM working mode, automatic when the temperature is lower than a certain threshold, cooling when it increases.

The code is:

</code>

<code>#!/bin/sh

TIME=5 #seconds
CPU_UP_TH=65
GPU_UP_TH=70
CPU_LOW_TH=55
GPU_LOW_TH=65

while :
do
cpu0=`sysctl hw.sensors.cpu0.temp0 | cut -d= -f 2 | cut -d. -f 1`
gpu0=`sysctl hw.sensors.itherm0.temp4 | cut -d= -f 2 | cut -d. -f 1`
apm=`/usr/sbin/apm -P`

echo "CPU0: ${cpu0} GPU0: ${gpu0} APM: ${apm}"

if [ ${cpu0} -gt ${CPU_UP_TH} ] || [ ${gpu0} -gt ${GPU_UP_TH} ]; then
if [ ${apm} == 1 ]; then
/usr/sbin/apm -C
echo "apm -C"
fi
fi

if [ ${cpu0} -lt ${CPU_LOW_TH} ] || [ ${gpu0} -lt  ${GPU_LOW_TH} ]; then
if [ ${apm} == 2 ]; then
/usr/sbin/apm -A
echo "apm -A"
fi
fi

sleep ${TIME}
done</code>

<code>

It can be grabbed from http://pastebin.com/HG5rc9tQ

Use it at your own risk :). Probably it needs to be modified, to adjust thresholds in other laptops.

It would be great if APM work in such way… even apmd needs to be patched in 5.4 for SMP machines (http://nixbsd.wordpress.com/2012/07/03/openbsd-patch-apmd-for-smp-architectures/)

Posted in BSD, OpenBSD | Tagged , , | Leave a comment

OpenBSD: ntfs-3g supported !!!


I can’t believe it!!!

http://www.planet-bsd.net/article/31

I’m anxious for testing it … One of those things you miss when moving to OpenBSD from FreeBSD or Linux…

 

Posted in OpenBSD | Leave a comment

Linux: share 3g connection with the internal network


It’s very easy to share an internet connection with iptables and NAT+IP Forward+IP Masquerade. But in my case I needed to share the 3G connection via wifi, and my computer’s nic is not able to work in ad-hoc mode. So I have to use an external wifi router. This router is connected to my Thinkpad R61’s eth0 port, and it needs to obtain its wan IP address via DHCP. So a DHCP server is needed in order to provide the IP and the Gateway for the wifi router.

I coded a simple script as:

/etc/myserver_start.sh

#!/bin/sh

systemctl stop NetworkManager.service

sleep 2

ifconfig eth0 192.168.2.1 up
service dhcpd restart
sleep 2
ifconfig eth0 192.168.2.1 up

sleep 2
wvdial 3g &

sleep 2

/etc/firewall.sh

First relevant line disables the NetworkManager, to avoid the eth0 port gets an IP. eth0 must have an static ip.

Middle lines configures the static IP server address, restart the dhcpd server, and start the 3g connection with wvdial.

Last line launch the firewall (redundant if it is configured as a service).

All the need configurations can be grabbed from:

Linux: DHCP server

Linux: 3G connection with wvdial

Linux: a home firewall

Posted in Linux | Leave a comment

Linux: 3G connection with wvdial


Simply configuration file for a Vodafone 3G connection with a Huawei modem:

/etc/wvdial.conf

[Dialer 3g]
Phone = *99***1#
Username = vodafone
Password = vodafone
Stupid Mode = 1
Dial Command = ATDT
Modem = /dev/ttyUSB0
Baud = 460800
Init2 = ATZ
Init3 = ATE0V1&D2&C1S0=0+IFC=2,2
ISDN = 0
Modem Type = Analog Modem
Init5 =AT+CGDCONT=1,”IP”,”ac.vodafone.es”

To connect:

wvdial 3g

(Remember replace fake quotes (“) in the script with the right ones)

Posted in Linux | 1 Comment