Find the answer to your Linux question:
Results 1 to 4 of 4
hi all. i have been having lots of trouble getting a static ip working on my system... from what I undderstand from the research ive done, the secret is in ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2005
    Location
    Colorado
    Posts
    84

    help with static ip


    hi all. i have been having lots of trouble getting a static ip working on my system... from what I undderstand from the research ive done, the secret is in my ifcfg-eth0 file. SO here it is.

    Code:
    # Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller
    DEVICE=eth0
    HWADDR=A4:BA:DB:FB:44:51
    TYPE=Ethernet
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=yes
    IPV6INIT=no
    NAME="System eth0"
    UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
    ONBOOT=yes
    PEERDNS=yes
    PEERROUTES=yes
    
    # below this line are static ip settings
    
    BOOTPROTO=dhcp
    #IPADDR=192.168.0.22
    #NETMASK=255.255.255.0
    #GATEWAY=192.168.0.1
    this file works just fine to get a dhcp address. however, i switch bootproto to "static" and uncomment the last 3 lines, and suddenly I can't access any websites. I can ping the router and other computers on the network, but cant view any sites. I just need a static ip to work on this computer

    by the way, all the settings on here were default from installation, including bootproto even though i moved it down below that comment line, and I commented the 3 lines i added.

  2. #2
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    Location
    the hills
    Posts
    1,134
    OK you must be doing something right if you can ping
    the router and other local computers. Maybe since you
    change it from DHCP to static it is no longer getting
    a name server automatically.

    Your name server is configured in /etc/resolv.conf
    Edit the file manually with a name server provided by your
    ISP. Check the configuration of your router for this, or try
    the router's address, since most routers run a name server.

  3. #3
    Just Joined!
    Join Date
    Jan 2011
    Location
    london
    Posts
    8
    Hi,

    Do you have the setup command on your system?

    if so open it and configure your static IP, save and then restart the network

    then compare the new ifcfg-eth0 file to the previous one and you should see the problem

    Thanks

  4. #4
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,672
    Not sure you need everything that is in that confg file. Looks like it was generated with NetworkManager. I would make sure it isn't running when you switch to static addresses. You can check it as follows:

    Code:
    service NetworkManager status
    If it is running then you can stop it with:

    Code:
    service NetworkManager stop
    And you can permanently turn it off with:

    Code:
    chkconfig --level 2345 NetworkManager off
    some will say you can use NetworkManager to control the interface but what more are you really going to want to do then up and down the interface?

    Here is a cleaned up version of your file
    Code:
    DEVICE=eth0
    BOOTPROTO=static
    BROADCAST=192.168.0.255
    HWADDR=A4:BA:DB:FB:44:51
    IPADDR=192.168.0.22
    NETMASK=255.255.255.0
    NETWORK=192.168.0.0
    ONBOOT=yes
    I suggest always making a copy of any file(s) you are going to edit before you edit them. I would suggest you backup the eth0 config file to your home directory before you make any changes to it so that is something goes south you can just copy it back and your system should return the state it was in before you made any changes to the interface. Before restarting the interface make a backup of your /etc/resolv.conf file just in case it changes so you have a copy of the DNS server that you use. resolv.conf gets updated automatically every time dhcp is used.

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

Posting Permissions

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