LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how do i find my IP address in DHCP? (https://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-find-my-ip-address-in-dhcp-595482/)

iron_toupee 10-29-2007 10:03 AM

how do i find my IP address in DHCP?
 
when i put my ubuntu 7.04 into DCHP mode it shows no IP address when i do an ifconfig -a command.

what is the best way for me to determine my IP address in DHCP in bash shell?

acid_kewpie 10-29-2007 10:26 AM

if it doesn't show on, then you don't have one... regardless of how an ip address is assigned, ifconfig works exactly the same.

ilikejam 10-29-2007 10:26 AM

Ummm, are you sure you can't see the IP in ifconfig?

If the interface has an address, ifconfig will show it. Could you maybe post the output from 'ifconfig -a'?

Dave

mrrangerman 10-29-2007 10:52 AM

sudo ifconfig -a

ilikejam 10-29-2007 10:58 AM

Try:
Code:

/sbin/ifconfig -a
Dave

iron_toupee 10-29-2007 01:13 PM

yes i am sure that the IP is not listed along with the other interface information.

i am working within a virtual machine in vmware server and i notice that i have to switch from bridged mode back to custom bridged mode when trying to boot to a static IP. after i reboot enough times it comes up with the correct ip and is reachable. in DHCP mode i cant tell what it is doing. all i know is that when it comes up in DHCP mode there is no IP listed with the rest of the ip settings. this must mean that DHCP is not setting my ip address.

i was just wondering if there was a netcat command or some other tool that i could use to determin the ip that i've been assigned.

if you all are correct, i DHCP is not even assigning me one.

i will try and post my exact ifconfig -a results asap.

thanks to all.

seelenbild28 10-29-2007 06:42 PM

hmm, could be a problem due to the virtual environment. is linux your host or your guest system?

acid_kewpie 10-30-2007 03:09 AM

virtual machines can't affect this, that would taint virtual machines at the base level... the host operating system and the network stack inside it, should have no idea whatsoever that it's actually not on a physical machine. it seems pretty clear that there is no ip assigned, maybe suggesting some sort of vmware bridging issue if the host pc is getting dhcp just fine.

itz2000 10-30-2007 05:02 AM

Quote:

Originally Posted by iron_toupee (Post 2941208)
yes i am sure that the IP is not listed along with the other interface information.

i am working within a virtual machine in vmware server and i notice that i have to switch from bridged mode back to custom bridged mode when trying to boot to a static IP. after i reboot enough times it comes up with the correct ip and is reachable. in DHCP mode i cant tell what it is doing. all i know is that when it comes up in DHCP mode there is no IP listed with the rest of the ip settings. this must mean that DHCP is not setting my ip address.

i was just wondering if there was a netcat command or some other tool that i could use to determin the ip that i've been assigned.

if you all are correct, i DHCP is not even assigning me one.

i will try and post my exact ifconfig -a results asap.

thanks to all.

do :
Code:

su
(password)
dhcpcd ethX #(replace X by the interface which contacts your dhcp server 0..n)
ifconfig ethX #(same X offcourse)
exit

and you'll see the new address.
after you succed getting ip, a little script that parse it is easy, for me (a hardcoded noobie script though) is :
Code:

ifconfig eth1 | head -2 | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1
would give me : 192.168.0.201


easy, right?


All times are GMT -5. The time now is 04:25 AM.