Set a static IP address in FreeBSD

Windows Articles

How to install Lighttpd on Ubuntu 20.04?

There are many web services in Unix but we always look for the one that best suits our needs. In this case,...

How to install Docker on Ubuntu 20.04 / Debian 10?

Docker is a fairly popular technology in today's sysadmin. It is logical to think because it means a complete change in the way images...

How to install Mantis Bug Tracker on Ubuntu 20.04?

Hi, folks. In this post, I will help you to install Mantis Bug Tracker on Ubuntu 20.04 If you...

How to install WordPress with Nginx on Ubuntu 20.04?

Hi, folks. In this post, we will help you install Wordpress with Nginx on Ubuntu 20.04. It's a lot easier than you...

Electron 9.0 available

News has arrived that many developers are going to love. And that is that Electron this great cross-platform application framework has released...
Mel Khamlichi
Mel Khamlichihttp://www.osradar.com
Founder of Osradar, from Amsterdam Netherlands

Default Configuration of the Network on FreeBSD is DHCP. Let me show you how to change or set IP addresses from Dynamic to Static. i will take this example from my FreeBSD  VM. but that should work  also for bare metal servers.

My   Network Configuration i :

root@FreeBSD12:~ # ifconfig
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=81009b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,VLAN_HWFILTER>
ether 00:0c:29:ac:76:78
inet6 fe80::20c:29ff:feac:7678%em0 prefixlen 64 scopeid 0x1
inet 192.168.65.162 netmask 0xffffff00 broadcast 192.168.65.255
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
inet 127.0.0.1 netmask 0xff000000
groups: lo
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
root@FreeBSD12:~ #

Netmask  : This 0xffffff00 is written in dotted-quad notation as 255.255.255.0

Find  My gateway

root@FreeBSD12:~ # netstat -rn
Routing tables

Internet:
Destination Gateway Flags Netif Expire
default 192.168.65.2 UGS em0
127.0.0.1 link#2 UH lo0
192.168.65.0/24 link#1 U em0
192.168.65.162 link#1 UHS lo0

DNS Server

Because its an VM, the DNS server is the same as the gateway. in your case my DNS is something else.

root@FreeBSD12:~ # cat /etc/resolv.conf
# Generated by resolvconf
search localdomain
nameserver 192.168.65.2

The actual status of rc.conf file.

Lets  change  the Ip from  DHCP to static  ip  192.168.65.10 / default  gateway is 192.168.65.2 with adding the two lines  to  rc.conf

ifconfig_em0="inet 192.168.65.10 netmask 255.255.250.0"
defaultrouter="192.168.65.2"

Restart the network Services with.

/etc/netstart

Waaw cool !!

Connect from Other Server and see if the new Ip working

➤ ssh root@192.168.65.10
Warning: Permanently added '192.168.65.10' (RSA) to the list of known hosts.
Password for root@FreeBSD12.osradar.local:
Last login: Tue Dec 11 11:55:04 2018 from 192.168.65.1
FreeBSD 12.0GENERIC

Welcome to FreeBSD!

Enjoy

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to install Lighttpd on Ubuntu 20.04?

There are many web services in Unix but we always look for the one that best suits our needs. In this case,...

How to install Docker on Ubuntu 20.04 / Debian 10?

Docker is a fairly popular technology in today's sysadmin. It is logical to think because it means a complete change in the way images...

How to install Mantis Bug Tracker on Ubuntu 20.04?

Hi, folks. In this post, I will help you to install Mantis Bug Tracker on Ubuntu 20.04 If you...

How to install WordPress with Nginx on Ubuntu 20.04?

Hi, folks. In this post, we will help you install Wordpress with Nginx on Ubuntu 20.04. It's a lot easier than you...

Electron 9.0 available

News has arrived that many developers are going to love. And that is that Electron this great cross-platform application framework has released...