LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Finding IP address... (https://www.linuxquestions.org/questions/linux-networking-3/finding-ip-address-87816/)

daemon_14 08-31-2003 10:50 PM

Finding IP address...
 
Hello all:

I was wondering if there is a way that i can determine my RH9 box's IP address when i am using a DHCP connection. i know that in the world of windows, you can enter the command "ipconfig" (for the NT base) or "winipcfg" (for the 98 base). is there a command similar to this in the linux world?
also, with this, do i need to enter it in the hosts portion of the network config (along with the loopback)? also, if i must, is there a way that i can have it set to look at the DHCP settings of the interface?

thanks,
daemon

65_289 08-31-2003 10:54 PM

To find your IP address, run "ifconfig" and look for the name of the interface. Assuming you just have 1 network card, it should be "eth0"

dcoder 08-31-2003 10:57 PM

Hi

You can open a Konsole and type su for root and once root type ifconfig. This should give you something like:

eth0 Link encap:Ethernet HWaddr 00:10:4B:6B:1F:A6
inet addr:10.0.0.118 Bcast:10.0.0.255 Mask:255.255.255.0

Plus a lot more....

Hmmm... not sure I understand your second question, maybe someone else will.

slapNUT 08-31-2003 11:02 PM

Put this in your .bashrc file then you just type ip to find out what it is.

Code:

function ip() # get my IP
{
    MY_IP=$(/sbin/ifconfig eth0 | awk '/inet/ { print $2 } ' | sed -e s/addr://)
echo "ETH0 IP = $MY_IP"
}

<edit> You can change that to ppp0 if you are using a dial-up connection.

bblank 08-31-2003 11:57 PM

To answer your second question, no modification of the hosts file is necessary.


All times are GMT -5. The time now is 11:49 AM.