1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do i find my IP address in Linux

Discussion in 'Linux & Open Source' started by Diss, 2 May 2006.

  1. Diss

    Wise Guy

    Joined: 28 Oct 2002

    Posts: 1,510

    The reason for asking is i am trying to set up my router with my dual boot Ubuntu/WinXP system.

    Does Linux use the same IP as windows? Probably not? Which is presumably why the specified ports with the winXP IP haven't opened in my Linux Azureus?

    Any suggestions?

    Thanks

    Diss
     
  2. Una

    Wise Guy

    Joined: 26 Nov 2004

    Posts: 2,471

    Location: Reading / Lake District

    man ifconfig
     
  3. Otacon

    Capodecina

    Joined: 10 Jan 2004

    Posts: 21,921

    Location: All over

    If your Windows install uses a static IP, then you would need to set the same in the Linux install yes. Better option would be to setup a DHCP reservation on the router.

    But yes, Una is right, ifconfig will tell you :)
     
  4. Diss

    Wise Guy

    Joined: 28 Oct 2002

    Posts: 1,510

    thanks
    will give that a go

    Diss
     
  5. Diss

    Wise Guy

    Joined: 28 Oct 2002

    Posts: 1,510

    got my router sorted owever linux has a different IP each time it boots - is there anyway to set it to the same as my WinXP IP?

    thanks

    Diss
     
  6. FirebarUK

    Soldato

    Joined: 9 Dec 2004

    Posts: 5,668

    Location: Dorset

    As said, have you tried a DHCP reservation? You should be able to tell your router to only give it a certain IP.

    Otherwise, depending on your Distro an IP can be statically set quite easily. What distribution are you using? check out /etc/sysconfig/network/ (or similar - depending on distro) for some pointers. In there are the network scripts (setting IP's, gateways etc).

    If your running redhat for example, you could edit your network script for device eth0 in; /etc/sysconfig/network-scripts/ifcfg-eth0 to read something like;

    DEVICE=eth0
    BOOTPROTO=static
    IPADDR=192.168.0.22
    NETMASK=255.255.255.0
    NETWORK=192.168.0.0
    HWADDR=Mac_address_here
    TYPE=Ethernet
    ONBOOT=yes

    ^ that might be right ?

    I'm quite lazy so I usually do it through the GUI.
     
    Last edited: 2 May 2006
  7. Diss

    Wise Guy

    Joined: 28 Oct 2002

    Posts: 1,510

    hi again

    its Ubuntu

    I couldn't find a similar config file - however there is a gnome GUI where i can select my eth0 properties and that is just set to DHCP (which i assume assigns a different IP each time) - the following fields are blank:
    IP
    Subnet
    Gateway

    so presumably i can just fill these in with the desired values

    Diss
     
  8. FirebarUK

    Soldato

    Joined: 9 Dec 2004

    Posts: 5,668

    Location: Dorset

    Yeah precisely that, manually specify the details and your away.
     
  9. punky_munky

    Mobster

    Joined: 17 Oct 2002

    Posts: 2,965

    in case you're wondering what to put in there it should be (usually):

    IP: 192.168.1.xxx
    Subnet: 255.255.255.0
    Gateway: your routers IPs, often 192.168.1.1
     
  10. Diss

    Wise Guy

    Joined: 28 Oct 2002

    Posts: 1,510

    thanks punky

    i thought that was it but haven't tried it yet nad its nice to know for sure before i mess around with it

    cheers

    Diss