Friday, March 8, 2013

OpenBSD bridge port

To make a bridge port in OpenBSD. You have to do the following things

1. Create a file called /etc/hostname.bridge0,  and add the following line:
            add [interface name1]
            add [interface name2]
            up
2. In indiual interface files /etc/hostname.[interface name] either put IP or following line
        up media autoselect
   for IP write following line
        inet [ip address] [netmask] [broadcast address]

Source:
http://www.cyberciti.biz/faq/setting-up-a-network-bridge-in-openbsd/
   
       

Wednesday, March 6, 2013

openBSD firewall NAT rules

1. Source NAT rule:

pass out on [external interface name] from [internal interface name]:network to any nat-to [external interface name]

2. Destination NAT rule:

pass in on [external interface name] proto tcp from [external source ip] to any port 80  rdr-to [internal dst interface]

Also you need to add alias IP at external interface to take care of arp request. The sample config(/etc/hostname.[interface name] for interface is as following

 inet [ipaddress] [mask ] [broadcast address]
 for alias ip add the following line
inet alias  [ipaddress] [mask] [broadcast address]