How to set DHCP offered ip address to particular ethernet in freebsd

In this post we will learn How to set DHCP offered ip address to particular ethernet in freebsd.
I freshly installed the freebsd 9.0-RELEASE in Virtual box. I added two ethernet or NIC to virtual machine.
After restart I found only my first ethernet has the ip address. The second ethernet does’not have any ip.

This tutorial is applicable to VPS and dedicated server also.

Follow the given below steps to get dhcp ipaddress

Step 1: First check does the Operating System has detected the ethernet or not.
Run the given below command.

freebsd# ifconfig


See the below given screenshot of output,here you can see the 2nd ethernet is detected but it has no ip address

freebsd-dhcp
freebsd-dhcp

Step 2: Edit the /etc/rc.conf file and add the line.

ifconfig_em1="DHCP"

Why ifconfig_em1, why not em2 em3 or other number
Answer: See in screenshot the em1 ethernet card does not have ip address, the em2 em3 em4 does’nt exist.

Step 3: Then run the given below command.
Command pattern is : /sbin/dhclient interface

freebsd# /sbin/dhclient em1

See the result in screenshot

freebsd-dhcp-result
freebsd-dhcp-result

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.