Results 1 to 9 of 9

Thread: normal ip address configuration... Help?

  1. #1
    crayes5735 NNTP User

    Smile normal ip address configuration... Help?

    I'm new... Just starting... please teach and guide me ^^

    here are my question :
    I need to configure the first network card with ip address 172.20.101.50/192 and defaults routing ip address 172.20.101.9 ( i able to do so with Yast and Yast2... )

    Can anyone guide me with me all the step/procedure to configure the network card here? ( Yast and Yast2 are disable. ) by using just command line?

    I'm new and trying to learn here so thanks in advance ^^

  2. #2
    Join Date
    Dec 2008
    Location
    Hamburg
    Posts
    458

    Default Re: normal ip address configuration... Help?

    Hi,

    I think we are not talking about WLAN.

    get root rigths on a console and type

    Code:
    vi /etc/sysconfig/network/icfg-eth0
    After entering the vi-editor type

    Code:
    i
    to enter insert mode in vi. Change/Add the following lines:

    Code:
    BOOTPROTO='static'
    BROADCAST='172.20.101.63'
    ETHTOOL_OPTIONS=''
    IPADDR='172.20.101.50/192'
    MTU='1500' # or whatever it should be in your network
    NAME='your network card or whatever'
    NETWORK=''
    REMOTE_IPADDR=''
    STARTMODE='auto'
    USERCONTROL='no'
    After doing the changes type ESC to enter command mode and type

    Code:
    wq
    Restart the network.

    hth

    Erik

  3. #3
    Join Date
    Jul 2008
    Location
    Seattle, WA
    Posts
    17,317

    Default Re: normal ip address configuration... Help?

    On Tue, 27 Oct 2009 19:36:02 +0000, crayes5735 wrote:

    > here are my question :
    > I need to configure the first network card with ip address
    > 172.20.101.50/192 and defaults routing ip address 172.20.101.9 ( i able
    > to do so with Yast and Yast2... )
    >
    > Can anyone guide me with me all the step/procedure to configure the
    > network card here? ( Yast and Yast2 are disable. ) by using just command
    > line?
    >
    > I'm new and trying to learn here so thanks in advance ^^


    Have a look at the various network configuration tools' man pages -
    things like ip, ifconfig.

    "man -k network" will give you a list of networking commands to work
    from. ("man man" will explain to you the options for the "man" command
    and will explain what the -k switch does)

    Jim

    --
    Jim Henderson
    openSUSE Forums Moderator

  4. #4
    Join Date
    Oct 2008
    Location
    Manchester
    Posts
    128

    Thumbs up Re: normal ip address configuration... Help?

    Hi,

    You will also need to add the default route.

    the file is:

    /etc/sysconfig/network/routes

    using an editor open the file (create if it isn't there)

    enter the following:

    default 172.20.101.9

    save and exit the file.

    restart the network stack (rcnetwork restart) and the gateway will now exist.

    type route at a terminal prompt to show the routing table.

    man route for other options

    hth
    J
    Linux# makes_a_network_feel_good.sh

    Linux and BSD solutions

  5. #5
    cjones586 NNTP User

    Default Re: normal ip address configuration... Help?

    I too am new to Linux/OpenSUSE, and have the same problem . I've tried the suggestions from Erik and tuxituk, but still I have a dynamic IP, not the static address I've set (according to ip addr show, and by pinging from another machine).

    Annoyingly I can't do anything using YaST, which tells me I have to use NetworkManager - which won't open! So seems I'm stuck trying to use the command line....

    Some questions;

    for tuxituk; I can't find rcnetwork in my installation, so I have to restart the box to see if the changes I've made have any effect. Is there some other way to restart the network?

    For Erik; you say to edit the file '/etc/sysconfig/network/icfg-eth0'. Was that a typo? (I have a file 'ifcfg-eth0') Also, the BROADCAST variable you set - should that actually be the same as the IP address you want to set? The address you've used in your example seems a bit... erm.... random!

    In case it matters, I'm on a local '192.168.1...' network with a Cisco Pix box providing a DHCP network, and I've never had any problems setting fixed IPs on other (Windoze, Os X) boxes. Also, in the greyed-out panel of YaST->Network Settings->Overview I can see that it picks up the new settings I've made using Erik's help. With the original settings the network card has 'DHCP' in the 'IP Address' column. Now I've created the new config, a second entry for the card appears with the static IP address I want.

    Would be very grateful to anyone who can help with this. Can't help thinking this should be trivial to do, and was very surprised that there wasn't a nice GUI to help me do this in two-ticks


    Chris.

  6. #6
    cjones586 NNTP User

    Default Re: normal ip address configuration... Help?

    Quick update to why there were two entries in YaST->Network Settings->Overview for my network card. I navely thought that simply changing the name of the original file (from 'ifcfg-eth0' to 'ifcfg-eth0.bu') would mean it wasn't read.... Now I've moved it to my home directory, and there's only one entry in YaST.

    Still got the dynamic IP address though.....

  7. #7
    Join Date
    Oct 2008
    Location
    Manchester
    Posts
    128

    Default Re: normal ip address configuration... Help?

    Hi,

    the following line should be at the top of your ifcfg-eth0 file:

    BOOTPROTO='static'


    Case is important.

    Can you paste your ifcfg-eth0 file please ?

    rcnetwork is a symbolic link to /etc/init.d/network.

    Symbolic links act as a pointer to another file or directory.

    If you cannot run rcnetwork it is because you do not have access to it in your system path.

    Of course as it is a serious thing to restart a network so it is restricted to root by default. I should have said this!

    using su, you can with to root and enter the command.

    so from a terminal
    enter:

    su

    enter the root password (unless you have configured sudoers, I am presuming not)

    now enter :

    rcnetwork restart

    and the network stack will go down and come back up.

    The rcnetwork symbolic link lives in /sbin for your info.


    hth
    J
    Linux# makes_a_network_feel_good.sh

    Linux and BSD solutions

  8. #8
    Join Date
    Dec 2008
    Location
    Hamburg
    Posts
    458

    Default Re: normal ip address configuration... Help?

    Hi,

    Quote Originally Posted by cjones586 View Post
    Annoyingly I can't do anything using YaST, which tells me I have to use NetworkManager - which won't open! So seems I'm stuck trying to use the command line....
    To set up a static IP as the only IP the machine has (like a desktop machine or server) the best thing is to switch of the network manager. Go to Yast -> network devices -> network settings -> global options and switch to classic method (ifup). After doing so you can configure in the tab overview your network device. That configuration is quite similiar to the MS-Windows one. (Maybe the terms are a bit different. I'm retranslating from the german version.)

    Quote Originally Posted by cjones586 View Post
    For Erik; you say to edit the file '/etc/sysconfig/network/icfg-eth0'. Was that a typo? (I have a file 'ifcfg-eth0')
    Sorry, that was a typo. The correct name is in deed ifcfg-eth0.

    Quote Originally Posted by cjones586 View Post

    Also, the BROADCAST variable you set - should that actually be the same as the IP address you want to set? The address you've used in your example seems a bit... erm.... random!
    No, it isn't random. What is your broadcast address? Normally in a network like 192.168.1.0 we have a 24-bit network mask (255.255.255.0). So the network has the IP range

    192.168.1.0 - 192.168.1.255

    The first address in an IP network we call the net address. The last address is the broadcast address. In the original posting the net mask was 26 bits long (255.255.255.192). Which means that the network looks like this as the given IP was 172.20.101.50:

    172.20.101.0 - 172.20.101.63

    As you can see we have less IP addresses in the range. Still the first one is the network address and the last one is the braodcast address. For more informations just feed google with "subnet mask".

    Quote Originally Posted by cjones586 View Post
    Would be very grateful to anyone who can help with this. Can't help thinking this should be trivial to do, and was very surprised that there wasn't a nice GUI to help me do this in two-ticks
    It isn't that complicated even with the network manager which is a fine thing for notebooks. The only thing that makes it "complicated" is to know how to configure. For the network manager just do a right click on it's symbol in the task bar. It could be a globe, a network plugin or a skale depending on the network connection you have. Select new connection, select the network device you want to configure and the rest is similiar to every other network configuration.

    hth

    Erik

  9. #9
    cjones586 NNTP User

    Thumbs up Re: normal ip address configuration... Help?

    Erik - thanks for pointing me towards the sensible way to do this..... using a GUI!

    This very simple task seems to be overlooked in the basic documentation - and I'm sure I'm not the only person who wouldn't have known to click the little "Classic method (ifup)" radio button! Maybe worth an addition to the "How To" pages?

    Out of interest, these subtle changes were made to the ifcfg-eth0 file by YaST;

    IPADDR='192.168.1.138'
    NETMASK='255.255.255.0'

    was changed to

    IPADDR='192.168.1.138/24'
    NETMASK='255.255.255.0'

    which (as far as I understand) shouldn't have made any difference. And to the routes file;

    default 192.168.1.254

    was changed to

    default 192.168.1.254 - -

    This might have been important for the router to be properly set, but wouldn't explain why the IP address was not being set.

    However, YaST also changed the 'config' file..... but before I got inquisitive, wondering what exactly I'd done wrong in the first place, I rm'd the original file in a tidy up - so I guess I'll never know! But it seems to me that changes to the config file must be required for the static IP to be set - does that sound right?

Posting Permissions

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