FreeBSD > How to change IP address or setup new ip address to existing interface

by nixcraft on December 1, 2004 · 7 comments

1) Use ifconfig command as follows:
ifconfig interface inet IP

Example(s):
ifconfig lnc0 inet 202.54.1.22

Note lnc0 is Ethernet interface name can be Obtained using ifconfig -a command.

2) To setup up ip permanently open file /etc/rc.conf ; add/modify network entries:
vi /etc/rc.conf

And setup values as follows:
hostname="fbsdx.test.com"
ifconfig_lnc0="inet 192.168.0.6 netmask 255.255.255.0"

Note ifconfig_lnc0 is Ethernet interface name can be Obtained using ifconfig -a command.

3) Again re-run /etc/netstart script.

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

We're here to help you make the most of sysadmin work. So, subscribe!

{ 7 comments… read them below or add one }

1 Anonymous September 5, 2005

Thanks for this tip. It was very helpful

Reply

2 Hyip July 19, 2008

Could you please set up an .exe file to do the above procedure
I think making a .exe file with the above commands will make the job easier for repeatedly changing ip addresses

Reply

3 Claus Larsen December 16, 2008

An exe file, do you have any idea about what you are saying, exe files is a windows thing.

Reply

4 Senphet December 15, 2009

.exe for bsd!? thanks for the good laugh ; )

Reply

5 wakka wakka September 10, 2010

lmao, maybe he meant a .bat file not .exe!

Reply

6 ozy-ns December 20, 2010

The .bat file is from windows too ;)

Reply

7 TnyTm February 17, 2011

Friggen windows nerds with your exe and bat files. However can you create a vbs script perhaps. I like the idea of changing the IP address easily from script. vbs would be nice.

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 13 + 15 ?
Please leave these two fields as-is:
Are you a human being? Solve the simple math so we know that you are a human and not a bot.



Previous post:

Next post: