DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 5th October 2018
bsd007's Avatar
bsd007 bsd007 is offline
Always learning
 
Join Date: Sep 2014
Posts: 219
Default How to set static IP under OpenBSD ?

How to set static IP under OpenBSD ?

Code:
$ ifconfig                                                                 
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 32768
        index 3 priority 0 llprio 3
        groups: lo
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
        inet 127.0.0.1 netmask 0xff000000
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        lladdr 60:45:cb:87:53:a5
        index 1 priority 0 llprio 3
        groups: egress
        media: Ethernet autoselect (100baseTX full-duplex,rxpause,txpause)
        status: active
        inet 192.168.0.100 netmask 0xffffff00 broadcast 192.168.0.255
enc0: flags=0<>
        index 2 priority 0 llprio 3
        groups: enc
        status: active
pflog0: flags=141<UP,RUNNING,PROMISC> mtu 33136
        index 4 priority 0 llprio 3
        groups: pflog
udav0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
        lladdr 00:e0:4c:53:44:58
        index 5 priority 0 llprio 3
        media: Ethernet none
I want to set static IP on udav0 namely IP Address, subnet mask, default gateway and dns servers.
__________________
OpenBSD 6.4
Intel(R) Core(TM) i3-6100 CPU
Ram 4GB
Intel HD Graphics

Last edited by bsd007; 5th October 2018 at 04:29 PM.
Reply With Quote
  #2   (View Single Post)  
Old 5th October 2018
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 6,345
Default

FAQ 6 (http://www.openbsd.org/faq/faq6.html) gives an overview of networking configuration. Briefly:

  • IP address and netmask are set via ifconfig(8) command, and are provisioned permanently via a hostname.if(5) file. You would name this file /etc/hostname.udav0.
  • A default static route is set in the mygate(5) file. This won't be applicable to your environment, as you use DHCP with the re(4) NIC. Individual routes are set with the route(8) command, added to the hostname.if(4) file for provisioning on boot. Please see the hostname.if(5) man page for an example of adding a route() command.
  • Domain name resolution is system-wide, not by individual NIC. It is set via the resolv.conf(5) file. This file is replaced every time your re(4) NIC obtains a new lease from the local DHCP server, so editing the file directly will not be helpful. You can supersede settings, such as the address(es) of domain name servers, by creating a dhclient.conf(5) file, or you can create a resolv.conf.tail(5) file which will be appended to /etc/resolv.conf each time a new DHCP lease is obtained.
Please note: Your re(4) and udav(4) NICs cannot be used on the same IP network at the same time. To use both at the same time, they must be on different networks. There are two exceptions to this rule: carp(4) and trunk(4) are designed to share a single IP address over multiple NICs.

Additionally, with two different ISPs and two NICs on different networks, you might want to explore Equal Cost Multipath Routing, as described in the FAQ chapter mentioned above.

Last edited by jggimi; 5th October 2018 at 05:28 PM. Reason: clarity, and added comments about DNS scope
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Static shells? Jautenim OpenBSD General 2 13th September 2015 12:49 AM
FreeCode goes static shep News 0 18th June 2014 09:59 PM
Trouble after changing static IP to dynamic IP on OpenBSD gateway magrin OpenBSD General 5 5th April 2014 10:38 AM
snd_emu10k1 and static kly FreeBSD General 3 17th September 2009 01:28 PM
Cannot assign static IP. bsdnewbie999 OpenBSD General 5 21st June 2008 09:50 AM


All times are GMT. The time now is 05:35 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick