Archive for the ‘OpenBSD’ category

pf.conf – quick commands list

April 5th, 2011

Here is a quick list of pf.conf commands that are useful.

     # pfctl -f /etc/pf.conf     Load the pf.conf file
     # pfctl -nf /etc/pf.conf    Parse the file, but don't load it

     # pfctl -sr                 Show the current ruleset
     # pfctl -ss                 Show the current state table
     # pfctl -si                 Show filter stats and counters
     # pfctl -sa                 Show EVERYTHING it can show

if you found this helpful feel free to donate to:
ZEC: t1NQp1UuqQbmnXzazbLTSreS2AbaZpRBuTM
LTC: LZyNF1qkBUA7XFz83m5xwzGgmmj1owQn9d
BTC: 1PY95KFPTEJTR7f2NnSgaB6xB9pwDJkcJz

OpenBSD – Change Network interface settings

March 27th, 2010

* /etc/hostname.if – This is where you set a IP address, netmask and broadcast address of the interface. Replace “if” with the name of the network interface, like sk0, sis1, etc. You are able to determine the available network interfaces using the command ifconfig(8). Checkout the man-page of hostname.if(5) for more details. One example of what you could find in a hostname.if file: inet 192.168.1.1 255.255.255.0 192.168.1.255 or just dhcp if you would want to use DHCP. When you are using DHPC, you don’t need to read the rest, you are done!

* /etc/mygate – The default route to the internet. One IP address (can be IPv4 or IPv6) will let the TCP/IP stack know where to send non-local traffic to.

* /etc/myname – The hostname of the system, in the longest syntax, including domain and toplevel domain, like host1.example.com. Normally you will find this name and it’s IP in /etc/hosts. (see below)

* /etc/hosts – The manual resolver. Don’t use this too much, better rely on DNS to resolve hostname to IP addressed and the other way around. But; it’s common to at least put the hostname and localhost in /etc/hosts. One example line would be: 192.168.1.1 host1.example.com host1

* /etc/resolv.conf – The system needs to know how can resolve names to IP addresses, this is the file you need! It contains a few items, like domain example.com. This tells the resolver that all hostnames you are searching for without a top level domain, are relative to example.com. If you would like to add more “local domains”, you can use the search otherexample.com thirdexample.com variable. Do take care not to add too many domains; it will be confusing to what host you are connecting. The most important is to tell the resolver that there are nameservers in use. Each nameserver that it could use has it’s own line, like this: nameserver 192.168.1.2.

Example resolv.conf file

search example.com
nameserver 192.168.1.1
nameserver 192.168.2.2
lookup file bind

Once the changes have been made to restart the interface you need to type:

sh /etc/netstart if

were if is the interface ID

Mark an interface down i.e. stop networking service and transmission via interface called pnc0:

# ifconfig pnc0 down

To bring back interface, type:

# ifconfig pnc0 up
if you found this helpful feel free to donate to:
ZEC: t1NQp1UuqQbmnXzazbLTSreS2AbaZpRBuTM
LTC: LZyNF1qkBUA7XFz83m5xwzGgmmj1owQn9d
BTC: 1PY95KFPTEJTR7f2NnSgaB6xB9pwDJkcJz