Changing from dhcp to static
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 11 of 11
  1. #1
    Join Date
    Jul 2017
    Location
    toronto
    Posts
    45

    [SOLVED] Changing from dhcp to static

    I've looked around the net, and there are so many different ways to do this. All of such, at least for me, don't give precise directions, and seem to assume greater knowledge than I've acquired.

    Here is one that I am trying to follow.

    Here is what I have with DHCP (some info changed to keep identity private):
    Code:
    $ ifconfig -a
    eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 24.31.61.131  netmask 255.255.255.0  broadcast 24.31.61.255
            inet6 2001:1970:4fa1:3e00:1a60:24ff:fe08:d78d  prefixlen 64  scopeid 0x0<global>
            inet6 fe80::1a60:24ff:fe08:d78d  prefixlen 64  scopeid 0x20<link>
            ether 18:60:24:08:d7:8d  txqueuelen 1000  (Ethernet)
            RX packets 2690  bytes 1781399 (1.6 MiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 2594  bytes 335504 (327.6 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
            device interrupt 16  memory 0xe0080000-e00a0000

    /etc/sysconfig/network-scripts/ifcfg-eno1: (set to run dhcp to make this post):
    Code:
    # Static setup (fail)
    
    # Hardware address (found by 'ether' using 'ifconfig' command)
    #HWADDR=18:10:24:f1:2a:31
    # Gateway attained with command 'route -n'
    #GATEWAY=192.168.0.1
    #BOOTPROTO=none
    # DNS attained by 'cat /etc/resolv.conf'
    #DNS1=24.220.1.33
    #DNS2=24.220.10.133
    #DNS3=2001:1970:d06f:c0::94
    #IPADDR=24.36.66.138
    #NETMASK=255.255.255.0
    
    #TYPE=Ethernet
    #DEFROUTE=yes
    #IPV4_FAILURE_FATAL=no
    
    #IPV6INIT=no
    #NAME=eno1
    
    # UUID attained by 'uuidgen eno1'
    #UUID=65a1b8da-3cf5-4e4e-bfa6-c0cd873c80ae
    #ONBOOT=yes
    #DEVICE=eno1
    
    # Reset network command (for reference only!)
    # systemctl restart network
    
    # Verify static IP address with:
    # ifconfig -a
    
    
    
    # DHCP setup (working)
    
    TYPE=Ethernet
    PROXY_METHOD=none
    BROWSER_ONLY=no
    BOOTPROTO=dhcp
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=no
    IPV6INIT=yes
    IPV6_AUTOCONF=yes
    IPV6_DEFROUTE=yes
    IPV6_FAILURE_FATAL=no
    IPV6_ADDR_GEN_MODE=stable-privacy
    NAME=eno1
    UUID=be2005ff-5b16-4ca7-8ae6-ea15317c41cc
    ONBOOT=yes
    AUTOCONNECT_PRIORITY=-999
    DEVICE=eno1

    Any ideas? I'm kinda going nuts here.

    I'm happy to post any addition data needed.
    Last edited by bedtime; 12th May 2018 at 12:25 PM.

  2. #2
    Join Date
    Jan 2010
    Posts
    7,349

    Re: Changing from dhcp to static

    Did you disable NetworkManager? I'm not sure what it uses, and am not positive it uses those scripts. I always disable it so I'm not sure how it works.

  3. #3
    Join Date
    Jul 2017
    Location
    toronto
    Posts
    45

    Re: Changing from dhcp to static

    Quote Originally Posted by smr54
    Did you disable NetworkManager? I'm not sure what it uses, and am not positive it uses those scripts. I always disable it so I'm not sure how it works.
    I just tried disabling it. Same result. Perhaps it needs to be disabled but the config I'm using is still not correct?


    /etc/sysconfig/network-scripts/ifcfg-eno1:
    Code:
    # Hardware address (found by 'ether' using 'ifconfig' command)
    HWADDR=18:10:24:f1:2a:31
    
    # Gateway attained with command 'route -n'
    GATEWAY=192.168.0.1
    BOOTPROTO=none
    
    # DNS attained by 'cat /etc/resolv.conf'
    DNS1=24.220.1.33
    DNS2=24.220.10.133
    
    # Not sure if I add this or not
    #DNS3=2001:1970:d06f:c0::94
    
    IPADDR=24.36.66.138
    NETMASK=255.255.255.0
    
    TYPE=Ethernet
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=no
    
    IPV6INIT=no
    NAME=eno1
    # UUID attained by 'uuidgen eno1'
    UUID=65a1b8da-3cf5-4e4e-bfa6-c0cd873c80ae
    ONBOOT=yes
    DEVICE=eno1

    And I'm not sure if I need to add anything from the original dhcp config. And if so, what to add.:

    /etc/sysconfig/network-scripts/ifcfg-eno1:
    Code:
    TYPE=Ethernet
    PROXY_METHOD=none
    BROWSER_ONLY=no
    BOOTPROTO=dhcp
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=no
    IPV6INIT=yes
    IPV6_AUTOCONF=yes
    IPV6_DEFROUTE=yes
    IPV6_FAILURE_FATAL=no
    IPV6_ADDR_GEN_MODE=stable-privacy
    NAME=eno1
    UUID=ce5c1510-aedc-4250-96fe-560762d69849
    ONBOOT=yes
    AUTOCONNECT_PRIORITY=-999
    DEVICE=eno1

    Here is the result of 'ifconfig' when I run the static config:
    Code:
    eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 24.45.61.128  netmask 255.255.255.0  broadcast 24.45.61.255
            inet6 fe80::9846:faa8:861a:2a21  prefixlen 64  scopeid 0x20<link>
            inet6 2001:1970:4fa1:3e00:1a60:24ff:fe9e:e10e  prefixlen 128  scopeid 0x0<global>
            inet6 2001:1970:4fa1:3e00:8e8b:c1bd:cbcc:88cc  prefixlen 64  scopeid 0x0<global>
            ether 18:60:24:db:e0:3e  txqueuelen 1000  (Ethernet)
            RX packets 450  bytes 203427 (198.6 KiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 589  bytes 64770 (63.2 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
            device interrupt 16  memory 0xe0080000-e00a0000




    *** EDIT ***

    I just tried this tutorial as it seemed more simple with less steps to mess up, and same result:

    Code:
    $ ping -c 3 kernel.org
    connect: Network is unreachable
    Last edited by bedtime; 11th May 2018 at 11:54 PM.

  4. #4
    Join Date
    Dec 2007
    Location
    Australia
    Posts
    1,859

    Re: Changing from dhcp to static

    If you disable NetworkManager, you will need to enable network to run the network. You can disable NetworkManager using the command:
    Code:
    systemctl disable NetworkManager
    You can stop it as well using the stop option, and you can then enable network by using the command:
    Code:
     chkconfig --levels 2345 network on
    In the configuration of the /etc/sysconfig/network-scripts/ifcfg-eno1, as I think you know, you need the config: BOOTPROTO=none, or BOOTPROTO=static. Both have worked for me in the past, but I recently I just use "none" flawlessly. The other config you might consider setting there is: NM_CONTROLLED=no, since you would be running network. Once that's all set, I usually reboot for a clean new network start, though it's technically not necessary if all the configs are set well.

    The alternative to this approach is to familiarise yourself more with NetworkManager because I understand that it now copes much more successfully with static IP addresses than it did in the past, but my own static networks don't use it so I can't help with that.

  5. #5
    Join Date
    Jul 2017
    Location
    toronto
    Posts
    45

    Re: Changing from dhcp to static

    Quote Originally Posted by nsnbm
    If you disable NetworkManager, you will need to enable network to run the network. You can disable NetworkManager using the command:
    Code:
    systemctl disable NetworkManager
    You can stop it as well using the stop option, and you can then enable network by using the command:
    Code:
     chkconfig --levels 2345 network on
    In the configuration of the /etc/sysconfig/network-scripts/ifcfg-eno1, as I think you know, you need the config: BOOTPROTO=none, or BOOTPROTO=static. Both have worked for me in the past, but I recently I just use "none" flawlessly. The other config you might consider setting there is: NM_CONTROLLED=no, since you would be running network. Once that's all set, I usually reboot for a clean new network start, though it's technically not necessary if all the configs are set well.

    The alternative to this approach is to familiarise yourself more with NetworkManager because I understand that it now copes much more successfully with static IP addresses than it did in the past, but my own static networks don't use it so I can't help with that.
    Same result. Though I noticed that if I went to do the command 'nmcli connection show' after all this, it would not even show my eno1 connection. So, it's missing or not activated somehow? Even 'chkconfig --levels 2345 network on' or 'systemctl start network' didn't bring it up.

    Anyways, I used the aforementioned link to automatically create a static ip and copied command for command, and here is the resulting config:

    /etc/sysconfig/network-scripts/ifcfg-eno1:
    Code:
    TYPE=Ethernet
    PROXY_METHOD=none
    BROWSER_ONLY=no
    BOOTPROTO=none
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=no
    IPV6INIT=yes
    IPV6_AUTOCONF=yes
    IPV6_DEFROUTE=yes
    IPV6_FAILURE_FATAL=no
    IPV6_ADDR_GEN_MODE=stable-privacy
    NAME=eno1
    UUID=be2005ff-5b16-4ca7-8ae6-ea15317c41cc
    ONBOOT=yes
    AUTOCONNECT_PRIORITY=-999
    DEVICE=eno1
    IPADDR=192.168.1.219
    PREFIX=32
    DNS1=8.8.8.8
    DNS2=8.8.4.4
    I added 'NM_CONTROLLED=no' in there as well after. Turned off networkmanager and disabled. Enabled network. Rebooted. Did 'chkconfig --levels 2345 network on' and same result:

    Code:
    $ ping -c 3 kernel.org                                                                                                               
    ping: kernel.org: Name or service not known
    $ ifconfig -a                                                                                                                        
    eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 192.168.1.219  netmask 255.255.255.255  broadcast 192.168.1.219
            inet6 2001:1970:4fa1:3e00:1a60:24ff:fef1:2a31  prefixlen 64  scopeid 0x0<global>
            inet6 fe80::1a60:24ff:fef1:2a31  prefixlen 64  scopeid 0x20<link>
            ether 18:60:24:f1:2a:31  txqueuelen 1000  (Ethernet)
            RX packets 119  bytes 13234 (12.9 KiB)
            RX errors 0  dropped 1  overruns 0  frame 0
            TX packets 98  bytes 14120 (13.7 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
            device interrupt 16  memory 0xe0080000-e00a0000

    Note that the ping result was instant; didn't even wait to try to connect; so, it seems likely that something is not turned on.

    Hmmm.

  6. #6
    Join Date
    Dec 2007
    Location
    Australia
    Posts
    1,859

    Re: Changing from dhcp to static

    You may be way ahead of me on this issue, so forgive me if I'm barking up the wrong tree. I'm not entirely sure what you are doing, which may be my fault of course, but if you are trying to get onto the internet through a modem router with a static IP address that you choose, it's not likely to work. To get a static IP address to access the net you normally need that to be supplied by your ISP to you. The 192.168.x.x addresses are reserved for computers not on the net and don't connect to the net. Here is a relevant output from this computer I'm on:
    Code:
    [tom@owl ~]$ ifconfig 
    enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 10.0.0.3  netmask 255.255.255.0  broadcast 10.0.0.255
            inet6 2001:8003:52d2:ca00:feaa:14ff:feac:9af3  prefixlen 64  scopeid 0x0<global>
            inet6 fe80::feaa:14ff:feac:9af3  prefixlen 64  scopeid 0x20<link>
            ether fc:aa:14:ac:9a:f3  txqueuelen 1000  (Ethernet)
            RX packets 53167  bytes 63088822 (60.1 MiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 40093  bytes 4919065 (4.6 MiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    <snip>
    That IP adddress of 10.0.0.3 is supplied by the router when the configuration file in /etc/sysconfig/network-scripts/ifcfg-enp3s0 has dhcp configured with BOOTPROTO=dhcp. I can't use any other IP address. The ISP runs a range of IP addresses and dhcp picks one for my computer when it gets online. On the private network that I run, I can configure a static address for each computer which will connect all of those which are not online, as long as they are on the same network as each other. If you did have a static address that the ISP ran for you, then you could place that in ifcfg-eno1with the config variables: IPADDR=x.x.x.x and NETMASK=x.x.x.x.

    So, it's important to note that the suggestions in post #4 will apply for static addresses on a network off the net, and. also on the net if you have an allocated static address. If you don't have an allocated static address, then you will likely need the config: BOOTPROTO=dhcp so that the modem router can do it's work and supply one. The network system will work flawlessly in this latter case if the configs are set correctly using the commands suggested above in post #4. NetworkManager will also work, but it's not okay to run both network and NetworkManager simultaneously because config files can be overwritten. I might add that the linux network stack is one of the most robust codes and it will work if the configs and machinery are all good.

  7. #7
    Join Date
    Jul 2017
    Location
    toronto
    Posts
    45

    Re: Changing from dhcp to static

    Quote Originally Posted by nsnbm
    You may be way ahead of me on this issue, so forgive me if I'm barking up the wrong tree. I'm not entirely sure what you are doing, which may be my fault of course, but if you are trying to get onto the internet through a modem router with a static IP address that you choose, it's not likely to work.
    You are not barking up the wrong tree at all; I'm lost when it comes to network config and knowledge. I simply have seen in a few articles that state that static net is faster than dhcp, so I figured I'd try to make it work. I have no extra router with wifi, just the device that allows me to connect with my ISP, and that is directly plugged in via eth0 cord.

    To get a static IP address to access the net you normally need that to be supplied by your ISP to you. The 192.168.x.x addresses are reserved for computers not on the net and don't connect to the net.

    ...

    That IP adddress of 10.0.0.3 is supplied by the router when the configuration file in /etc/sysconfig/network-scripts/ifcfg-enp3s0 has dhcp configured with BOOTPROTO=dhcp. I can't use any other IP address. The ISP runs a range of IP addresses and dhcp picks one for my computer when it gets online. On the private network that I run, I can configure a static address for each computer which will connect all of those which are not online, as long as they are on the same network as each other. If you did have a static address that the ISP ran for you, then you could place that in ifcfg-eno1with the config variables: IPADDR=x.x.x.x and NETMASK=x.x.x.x.
    ...
    So, it's important to note that the suggestions in post #4 will apply for static addresses on a network off the net, and. also on the net if you have an allocated static address. If you don't have an allocated static address, then you will likely need the config: BOOTPROTO=dhcp so that the modem router can do it's work and supply one. The network system will work flawlessly in this latter case if the configs are set correctly using the commands suggested above in post #4. NetworkManager will also work, but it's not okay to run both network and NetworkManager simultaneously because config files can be overwritten. I might add that the linux network stack is one of the most robust codes and it will work if the configs and machinery are all good.
    Thank you so much for taking the time to write this up. It was extremely helpful. I had to read it a couple of times to 'digest' it, but I think I gather. Basically, I would need to contact my ISP to get that static address working? In that case, I think I'll just stick with DHCP. Sorry to bother, but this is a great learning experience, and now I at least know what are/aren't viable options for me, and there won't be that urging feeling of trying something that is not entirely necessary.

    In any event, I'm happy with dpcp. Also, I disabled NetworkManager.service and enabled network.service as I use awesome wm. Saved a few mb in the process.

    And I have to say I'm happy with this outcome, and once again, thank you so much for taking the time to explain this to me. I can now call this thread [SOLVED]!

  8. #8
    Join Date
    Aug 2016
    Location
    Dallas
    Posts
    70

    Re: Changing from dhcp to static

    I think you're doing too much. Let's get a few things figured out. What version of fedora are you running, and does it have a GUI, or is it a minimal install. Secondly are to trying to assign a static IP for your home network? The ISP would likely not give the option to modify that in the router settings.

  9. #9
    Join Date
    Dec 2012
    Location
    santa barbara, CA
    Posts
    926

    Re: Changing from dhcp to static

    add NETMASK=255.255.255.0 in your ifcfg script after the IPADDR.
    "monsters John ... monsters from the ID..."
    "ma vule teva maar gul nol naya"

  10. #10
    Join Date
    Jul 2017
    Location
    toronto
    Posts
    45

    Re: Changing from dhcp to static

    I think you're doing too much.
    I agree. This is a little over my head.

    Let's get a few things figured out. What version of fedora are you running, and does it have a GUI, or is it a minimal install.
    Fedora 28 with awesome wm.

    Secondly are to trying to assign a static IP for your home network? The ISP would likely not give the option to modify that in the router settings.
    I believe I'm trying to assign a static IP to my home network. I don't have a server. I only wanted to do this because I've heard static is faster than dhcp.

    add NETMASK=255.255.255.0 in your ifcfg script after the IPADDR.
    I will try this a little later and get back to you with results. Thanks!

  11. #11
    Join Date
    Jul 2005
    Posts
    914

    Re: Changing from dhcp to static

    Fwiw, i typically use networkmanager to assign static lan ip's to a computer.

    I have static public ip's, purchased from my isp, but you can't give yourself a public fixed ip.
    ======
    Doug G
    ======

Similar Threads

  1. installed fed 9 using static but its getting via dhcp
    By extendedping in forum Installation, Upgrades and Live Media
    Replies: 10
    Last Post: 16th May 2008, 07:25 PM
  2. F8 Pulling DHCP instead of using static IP
    By zackf in forum Servers & Networking
    Replies: 6
    Last Post: 1st May 2008, 02:06 PM
  3. Static ip in FC7 - not dhcp
    By bananasfk in forum Servers & Networking
    Replies: 3
    Last Post: 18th June 2007, 08:27 PM
  4. Specifying a static IP with DHCP
    By sfboarders in forum Servers & Networking
    Replies: 5
    Last Post: 24th May 2005, 08:26 PM
  5. FC2 Overriding static if in favor of dhcp system set for static
    By pkraus109 in forum Servers & Networking
    Replies: 2
    Last Post: 21st September 2004, 05:13 PM

Posting Permissions

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