General
IP Aliases (multi-homed NIC)
# cat /etc/hostname.dc0
inet 192.168.0.2 255.255.255.0 media 100baseTX
inet alias 192.168.0.3 255.255.255.255
inet alias 192.168.0.4 255.255.255.255
notice the full subnet mask on aliases.
reboot, or bring up manually:
# ifconfig dc0 inet alias 192.168.0.3 netmask 255.255.255.255
To view these aliases you must use the command:
$ ifconfig -A
DHCP Client
To use the DHCP client dhclient(8) included with OpenBSD, edit /etc/hostname.xl0
(this is assuming your main ethernet interface is xl0. All you need to put in
this hostname file is 'dhcp':
# echo dhcp > /etc/hostname.xl0
If you want to start a DHCP client from the command line, make sure
/etc/dhclient.conf exists, then try:
# dhclient fxp0
Where fxp0 is the interface on which you want to receive DHCP.
No matter how you start the DHCP client, you can edit the /etc/dhclient.conf
file to not update your DNS according to the dhcp server's idea of DNS by first
uncommenting the 'request' lines in it (they are examples of the default
settings, but you need to uncomment them to override dhclient's defaults.)
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, host-name, lpr-servers, ntp-servers;
and then remove domain-name-servers. Of course, you may want to remove hostname,
or other settings too.
By changing options in your dhclient.conf(5) file, you're telling the DHCP
client how to build your resolv.conf(5) file. The DHCP client overrides any
information you already have in resolv.conf(5) with the information it
retrieves from the DHCP server. Therefore, you'll lose any changes you made
manually to resolv.conf.