Page 1 of 1

How to Configure a Static IP Address

Posted: Fri Feb 24, 2017 9:22 am
by NevilleGoddard
When booting GhostBSD sometimes there is a pause while the DHCP network is starting. This slows things down a little while but there is an easy way around this.
First open up a terminal and type -

Then you'll get output that looks something like this:

em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
ether bc:5f:f4:fb:a2:a9
inet netmask 0xffffff00 broadcast
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
inet netmask 0xff000000

The important things to look for here are :

em0 (your network device mat be different - adjust accordingly)

inet and

netmask 0xffffff00 (on your system your numbers may be different so adjust accordingly)

Then log in as root
Then type -

ifconfig em0 inet netmask 0xffffff00

(from your terminal output)
then still as root:

dhclient em0

(again - adjust accordingly)
The output from this command will contain something similar to:

DHCPACK from - (your number may be different) remember for when editing /etc/rc,conf

then the command:

route add default
-(or your number)

then edit /etc/rc.conf:


ee /etc/rc.conf

Go down with your keyboard arrow keys to the line:


and comment (#) this line so it looks like this:


then under this line enter these lines:

ifconfig_em0="inet netmask 0xffffff00"

Make sure you use exactly the same numbers as your terminal output above and be careful to put correct spaces and quotation marks.

then press Esc save changes and reboot and you should have your static ip address working and slightly faster boot times. :D

If for some reason you want to go back and undo all these changes then:

Open a terminal, log in as root:
Then type :

ee /etc/rc.conf

Go down with your arrow keys to the 2 lines that you made before:

ifconfig_em0="inet netmask 0xffffff00"

and comment them (#) so they look like this:

#ifconfig_em0="inet netmask 0xffffff00"

Or you can just delete them

Then go to the line :


and uncomment it so it looks like this:


Press Esc and save changes when prompted and reboot and it will back to the way it was before

Re: How to Configure a Static IP Address

Posted: Fri Feb 24, 2017 12:54 pm
by ASX

Code: Select all

ifconfig_em0="inet netmask 0xffffff00"
please note that the above can also be written as:

Code: Select all

ifconfig_em0="inet netmask"

Code: Select all

Also, be sure to use an IP address outside the range used from the DHCP server, else you risk a duplicate IP address.

Re: How to Configure a Static IP Address

Posted: Tue Jul 18, 2017 6:16 am
by CarolineSmith
Thanks for explaining here on how to configure a static IP Address which is really helpful for IT students who are getting help with assignment from me at Quality Assignment UK.

Re: How to Configure a Static IP Address

Posted: Tue Jul 18, 2017 6:41 am
by NevilleGoddard
No worries. Glad I could help!

Re: How to Configure a Static IP Address

Posted: Tue Jul 18, 2017 11:39 am
by Kernelpanic
NevilleGoddard wrote:No worries. Glad I could help!
You did it ;)