How To Configure Static IP Address In Linux And Unix

7 Responses

  1. Dan St.André says:

    Thank you for this clearly written description of static IP configuration. I would be interested in a follow-up article that discusses static IP for a walk-about laptop. Specifically, I need STATIC_IP_A when I’m part of NETWORK_1, STATIC_IP_B when I’m part of NETWORK_2,…, STATIC_IP_Z when I’m part of NETWORK_N, and dynamic IP address the rest of the time.

    • SK says:

      I am afraid we couldn’t do that in Linux with single network interface card. However, It is possible to do it with manageable network switch. We could create different vlans and assign different set of IP addresses for each vlan.

  2. Dan St.André says:

    Is there some way to:
    1. detect which network is available
    2. run one or more scripts that are per-network specific
    3. the scripts would used DHCP or static-IP as needed
    4. might need to connect-inspect-bounce-configure

    While I would like to detect wired & wireless and launch appropriate scripts, wireless is by far the most common and most useful.

    I am trying, with poor success, to find the network connection hooks that I could use to launch my own scripts.


    ASIDE — I use Linux Mint 17.3 from the Ubuntu family of distributions.

  3. SK says:

    As I understood..
    Create a script..First detect which network available on system. And show available network status like up or down and also show Static ip or DHCP IP.
    Something like-
    Available—Status—DH/ ST——–IP
    eth0. Up. dhcp. *******
    wlan0. Down. —- ——-
    Second option detect network configuration – Enter Available network name- when we enter name , then again show option set ip address dhcp or static-
    -> Input dhcp (auto set dhcp ip)
    -> Input static (Then auto set static ip) or
    Enter -> Ipaddress-
    -> netmask-
    -> gateway-
    -> dns1
    -> dns2

    I think when we are connected both network (wlan & lan) ..the first priority of wireless network if wireless network down then automatic up lan port…

  4. Don Porter says:

    Static IP setting for Linux Mint Sylvia worked perfectly…

    … AFTER I substituted enp3s0 for enp0s3. Who knows why mine was different?

    THANKS for accurate instructions which actually WORK! Rare in my world of Googling.

  5. Ahmed says:

    What ip adress re we supposed to enter in when configuring the static ip ?

  6. sk says:

    Any IP address of your choice.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.