Set a static IP address in FreeBSD

Windows Articles

How to create backups in Windows 10 with FileFort Backup

There is no doubt that the computer is an essential element in our lives. Indeed, its uses go beyond work or study....

Trisquel 9.0 available

Trisquel is a GNU/Linux distribution endorsed and supported by the Free Software Foundation. This means that in addition to incorporating the Linux...

How to install PandoraFMS on CentOS 8?

Worldwide many IT infrastructures are running Linux on one of their servers. This opens the door to an endless number of different...

How to force close a program using PowerShell

Hi! We have mentioned in the past that Windows allows you to open multiple programs at once. In fact, that is one...

How to install the Owncloud desktop client Ubuntu 20.04?

In this post, You will learn how to install the Owncloud desktop client on Ubuntu 20.04. Many users and...
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 create backups in Windows 10 with FileFort Backup

There is no doubt that the computer is an essential element in our lives. Indeed, its uses go beyond work or study....

Trisquel 9.0 available

Trisquel is a GNU/Linux distribution endorsed and supported by the Free Software Foundation. This means that in addition to incorporating the Linux...

How to install PandoraFMS on CentOS 8?

Worldwide many IT infrastructures are running Linux on one of their servers. This opens the door to an endless number of different...

How to force close a program using PowerShell

Hi! We have mentioned in the past that Windows allows you to open multiple programs at once. In fact, that is one...

How to install the Owncloud desktop client Ubuntu 20.04?

In this post, You will learn how to install the Owncloud desktop client on Ubuntu 20.04. Many users and...
x