About Linux FAQ

Browse More FAQs:

OpenBSD Change / Set IP Address For Network Interface

Posted by Vivek on Thursday May 8, 08 (1 weeks ago) @1:13 pm

This FAQ is part 3 of 4 in the series OpenBSD Networking

Q. How do I configure or change existing IP address under OpenBSD operating system? How do I configure TCP / IP under OpenBSD?

A. . Under OpenBSD network interface-specific configuration stored in files located at /etc directory. First you need to find out your interface name using ifconfig command. If your interface name is pcn0, open /etc/hostname.pcn0 file for TCP/IP configuration.

The hostname.* and bridgename.* files contain information regarding the configuration of each network interface. One file should exist for each interface that is to be configured, such as hostname.fxp0 or bridgename.bridge0. However, a configuration file is not needed for lo0.

Task Find out current interface name and IP information

Type the following command at a shell prompt:
# ifconfig
Sample output:

lo0: flags=8049 mtu 33224
        groups: lo
        inet 127.0.0.1 netmask 0xff000000
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x4
pcn0: flags=8843 mtu 1500
        lladdr 00:0c:29:7a:b5:ce
        groups: egress
        media: Ethernet autoselect (autoselect)
        inet 74.86.49.141 netmask 0xfffffff0 broadcast 74.86.49.143
        inet6 fe80::20c:29ff:fe7a:b5ce%pcn0 prefixlen 64 scopeid 0x1
pflog0: flags=0<> mtu 33224
enc0: flags=0<> mtu 1536

Task: View pcn0 interface TCP / IP configuration

Type the following command:
# cat /etc/hostname.pcn0
Sample output:

inet 74.86.49.141 255.255.255.240 NONE

Task: Change IP configuration

To set new IP address open interface configuration file /etc/hostname.pcn0
# vi /etc/hostname.pcn0
Append/modify configuration:
inet 192.168.1.5 255.255.255.0 NONE
Save and close the file.

How do I restart or update networking configuration

To reset or restart an existing interface to its default state or update state, by invoking the following, where pnc0 is the interface name:
# sh /etc/netstart pnc0

Assign ip address using ifconfig command

You can assign the address of 192.168.1.5 with a network mask of 255.255.255.0 to interface pnc0, use:
# ifconfig pnc0 inet 192.168.1.5 netmask 255.255.255.0

Navigation for OpenBSD Networking«OpenBSD Change HostnameOpenBSD Restart Networking Service»

Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

Related Linux / UNIX FAQ:

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Please do not use the comment form to ask for help / question. Ask your question on the excellent Linux tech support forum. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , , , , , ~ Last updated on: May 8, 2008

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.