6 Replies Latest reply: Dec 26, 2013 5:52 AM by EdStevens RSS

How to configure Oracle Linux 6.5 to request ip address from dhcp server

884659 Newbie
Currently Being Moderated

I have installed Oracle Linux 6.5 (minimal installation) on a virtual machine created on VMware vSphere 5.5.   I have tried to configure dhcp during the installation by editing IPv4 Settings of System eth0 to use Automatic (DHCP) but somehow it does not work.

 

Then I changed the ifcfg-eth0 to use static ip address and that works.

 

Here is the content of /etc/sysconfig/network:

 

NETWORKING=yes

HOSTNAME=TESTOL

 

Here is the content of /etc/sysconfig/network-scripts/ifcfg-eth0 using static ip address:

 

DEVICE=eth0

TYPE=Ethernet

UUID=xxxxxxxx.xxxx-xxxx-xxxxxxxxxxxx

ONBOOT=yes

NM_CONTROLLED=yes

BOOTPROTO=none

HWADDR=xx:xx:xx:xx:xx:xx

IPADDR:##.##.###.###

PREFIX=24

GATEWAY=##.##.###.###

DNS1=##.##.###.###

DOMAIN:test.com

DEFROUTE=yes

PEERDNS=yes

PEERROUTES=yes

IPV4_FAILURE_FATAL=yes

IPV6INIT=no

NAME="System eth0"

 

Based on my understanding, I should able to use dhcp by changing ifcfg-eth0 (I commented the parameters not needed for dhcp by adding #) but I have tried the following ifcfg-eth0 and it does not work:

 

DEVICE=eth0

TYPE=Ethernet

UUID=xxxxxxxx.xxxx-xxxx-xxxxxxxxxxxx

ONBOOT=yes

NM_CONTROLLED=yes

#BOOTPROTO=no

BOOTPROTO=dhcp

HWADDR=xx:xx:xx:xx:xx:xx

#IPADDR:##.##.###.###

#PREFIX=24

#GATEWAY=##.##.###.###

DNS1=##.##.###.###

#DOMAIN:test.com

DEFROUTE=yes

PEERDNS=yes

PEERROUTES=yes

IPV4_FAILURE_FATAL=yes

IPV6INIT=no

NAME="System eth0"

 

I have also tried to add GATEWAY=##.##.###.### to /etc/sysconfig/network but that does not help.

 

I have checked that dhclient package is installed by using rpm -qa dhclient.

 

I'm new to Linux.

 

Thanks for any help

  • 1. Re: How to configure Oracle Linux 6.5 to request ip address from dhcp server
    Dude! Guru
    Currently Being Moderated

    If this is your first experience with Oracle Linux, I recommend you perform a default installation instead of going minimal, which is just going to make things more difficult for no good reason. Enterprise Linux is not MS Windows and the difference between default and minimal installations do not compare.

     

    You also do not want to use the rpm utility to install any software and use yum instead. The yum utility is standard. Rpm does not resolve software dependencies.

     

    Your ifcfg-eth0 script is missing the line that specifies to use DHCP:

     

    BOOTPROTO=dhcp

     

    You can also use the network configuration utility, even in text mode, by typing the following at the command prompt of root:

     

    system-config-network

     

    If the above utility is not installed:

     

    yum install system-config-network-tui

     

    You will have to configure an appropriate yum repository file. The process is explained in the Oracle Linux release notes:

     

    https://oss.oracle.com/el6/docs/RELEASE-NOTES-U5-en.html

    See 3.2.3. About Oracle Linux Installation Media

     

    Then insert the DVD or attach the DVD iso image to your virtual machine and mount it as following:

     

    mkdir -p /media/ISOimage

    mount /dev/cdrom /media/ISOimage

     

    The path "/media/ISOimage" should be the same as you specified in the yum repository file.

     

    After that you can use the yum utility to list or install software.

  • 2. Re: How to configure Oracle Linux 6.5 to request ip address from dhcp server
    BillyVerreynne Oracle ACE
    Currently Being Moderated

    Your config seems fine - the BOOTPROTO entry says DHCP.

     

    For VMs I suggest not using settings such as HWADDR and UUID. Unlike real iron, one can easily (and accidentally) reset the MAC addresses of virtual NICs. And render your guest o/s network settings invalid as these no longer refer to the correct VM h/w.

     

    I would test DHCP with the following basic settings only:

    DEVICE=eth0

    TYPE=Ethernet

    ONBOOT=yes

    BOOTPROTO=dhcp

    DEFROUTE=yes

    PEERDNS=yes

     

    And use ifconfig (or ifup and ifdown) to test it, while keeping an eye on /var/log/messages.

     

    How is the virtual NIC defined on the host o/s? I prefer bridge mode as that makes the VM just another piece of h/w on the subnet.

  • 3. Re: How to configure Oracle Linux 6.5 to request ip address from dhcp server
    884659 Newbie
    Currently Being Moderated

    I have found out that there is no dhcp server set up in the subnet.  The /var/log/messages has "DHCPDISCOVER" entries and "No DHCPOFFERS received" entry but I don't think those entries indicate no dhcp server.    Originally, I thought either I have configured ifcfg-eth0 incorrectly or dhcp server is out of addresses to assign.   I want to know whether any log in the virtual machine TESTOL will indicate no dhcp server.  Also, what will be the log entry if a dhcp server is out of addresses to assign?    When I google about dhcp, I see the entry "No working leases in persistent database - sleeping", does that mean out of addresses or something else?

     

    Thanks for all the help.

  • 4. Re: How to configure Oracle Linux 6.5 to request ip address from dhcp server
    Dude! Guru
    Currently Being Moderated

    DHCP discovery happens at the network link layer using UDP and does not require a pre-existing TCP/IP subnet configuration on the host system.

     

    In a VM environment a DHCP server is typically provided by your VM software that provides automatic routing between a certain virtual machine network adapter type and the host system. I suggest you verify that you are using the correct vm network adapter type and correct MAC address in your config files. There may be some VMware Spere network specific issues, which are however beyond of the scope of this forum.

     

    My suggestion is as follows. Cut and paste or type the following exactly as shown to your root command prompt:

     

    cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF

    DEVICE="eth0"

    ONBOOT="yes"

    NM_CONTROLLED=no

    BOOTPROTO="dhcp"

    EOF

     

    rm -f /etc/udev/rules.d/70-persistent-net.rules

     

    shutdown -r now

     

    After that your eth0 adapter should be assigned a DHCP based address, provided you configured the correct VM network adapter or DHCP is assigned by your host network. I tested the above Oracle Linux 6.5 and it works.

  • 5. Re: How to configure Oracle Linux 6.5 to request ip address from dhcp server
    BillyVerreynne Oracle ACE
    Currently Being Moderated

    If you do not have a DHCP server on the subnet that the VM connects to, then no DHCP address will be offered. You need a DHCP/BootP relay (RFC 1542)  on that subnet to relay the DHCP client broadcast to the subnet on which the DHCP server resides. Routers can be configured to this effect.

     

    If there is a DHCP server and your DHCP client does not get an address - that could be to MAC bindings, where the DHCP server is configured with static IP allocation to MAC addresses.

  • 6. Re: How to configure Oracle Linux 6.5 to request ip address from dhcp server
    EdStevens Guru
    Currently Being Moderated

    In addition to all the very good technical information you've already received, I'd like to point out that often the solution to a problem is to question the premise.

     

    In this case, that means asking why you want to configure for dhcp in the first place.  Running a server with a DHCP assigned IP address is like running a business that changes it's phone number every day .....   how do you expect clients to locate it when the address keeps changing?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points