Find the answer to your Linux question:
Results 1 to 10 of 10
hi, can anyone help me how to configuring static ip through command line, i am new to suse linux, i know a bit in redhat linux , the netconfig , ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2005
    Posts
    17

    configuring static ip through command line


    hi,
    can anyone help me how to configuring static ip through command line, i am new to suse linux, i know a bit in redhat linux ,

    the netconfig , ifconfig command are not working here.
    so can any one tell me what is the command for configuring ip address and , the command for seeing the ipaddress issued.

  2. #2
    Linux Newbie
    Join Date
    Dec 2004
    Location
    Barrie, Ontario
    Posts
    219
    ifconfig is the command you want:
    Code:
    ifconfig [device] [my.static.ip.addr] netmask [my.net.work.mask] up
    for example:
    Code:
    ifconfig eth0 10.1.7.13 netmask 255.255.255.0 up
    Then if you want to see the current network configuration:
    Code:
    ifconfig
    Blog - KB5UMQ - Linux User #272983
    3 Rules:
    1) "It doesn't work..." is simply not useful information.
    2) Don't cross post!
    3) If you are asking for help, start by telling us your distro/os and version.

  3. #3
    Just Joined!
    Join Date
    Mar 2005
    Posts
    17
    hi Kode,
    thanks for replying to my query, what is the command for permanently entering the ip address through command line,
    the ifconfig after restaring goes away.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Newbie
    Join Date
    Dec 2004
    Location
    Barrie, Ontario
    Posts
    219
    Just put the ifconfig line in a startup script so it's run on boot. That's all every other distro does.
    Blog - KB5UMQ - Linux User #272983
    3 Rules:
    1) "It doesn't work..." is simply not useful information.
    2) Don't cross post!
    3) If you are asking for help, start by telling us your distro/os and version.

  6. #5
    Just Joined!
    Join Date
    Jun 2006
    Posts
    15
    how about if I want to specify a specific Gateway..?..

  7. #6
    Linux Engineer Zelmo's Avatar
    Join Date
    Jan 2006
    Location
    Riverton, UT, USA
    Posts
    1,001
    Quote Originally Posted by kode
    Just put the ifconfig line in a startup script so it's run on boot. That's all every other distro does.
    Distros I've worked with read the network setting from a configuration file, namely /etc/network/interfaces (<- on Debian and related distros; might be elsewhere in /etc for others). See the man page for interfaces. A quick summary is that in this file, you'll see something like this:
    Code:
    iface eth0 inet dhcp
    You just need to change dhcp to static, then on the next 3 lines specify the address, netmask, and gateway. I think the gateway isn't strictly needed, but putting your router's address there doesn't hurt.
    Stand up and be counted as a Linux user!

  8. #7
    Just Joined!
    Join Date
    Oct 2006
    Location
    Vernon BC Canada
    Posts
    35
    Quote Originally Posted by Zelmo
    Distros I've worked with read the network setting from a configuration file, namely /etc/network/interfaces (<- on Debian and related distros; might be elsewhere in /etc for others). See the man page for interfaces. A quick summary is that in this file, you'll see something like this:
    Code:
    iface eth0 inet dhcp
    You just need to change dhcp to static, then on the next 3 lines specify the address, netmask, and gateway. I think the gateway isn't strictly needed, but putting your router's address there doesn't hurt.

    How do I open interfaces?? When I ls in /etc/network I see it there, but when i try and get into it, it says its not a directory... Is there a program that I need to use to open it?

  9. #8
    Linux Guru Juan Pablo's Avatar
    Join Date
    Mar 2006
    Location
    /home/south_america/ecuador/quito
    Posts
    2,064
    how about if I want to specify a specific Gateway..?..
    route add default gw <ip number>
    Put your hand in an oven for a minute and it will be like an hour, sit beside a beautiful woman for an hour and it will be like a minute, that is relativity. --Albert Einstein
    Linux User #425940

    Don't PM me with questions, instead post in the forums

  10. #9
    Linux Engineer Zelmo's Avatar
    Join Date
    Jan 2006
    Location
    Riverton, UT, USA
    Posts
    1,001
    @maximum720:
    As root, use a text editor like nano to open the file:
    Code:
    nano /etc/network/interfaces
    Stand up and be counted as a Linux user!

  11. #10
    Just Joined!
    Join Date
    Aug 2009
    Posts
    1
    he below information is for how to specify and adjust your network settings through the command prompt. Changing your network settings will require root access.

    1. Get to the command prompt.
    2. Move to the /etc/sysconfig/network directory.
    3. Edit the interfaces file and adjust your network settings in this file.
    And for windows you can chk the ip address ip-details.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •