Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

Enter: How to Assign an IP Address on a Linux Computer

Explore Enter: How to Assign an IP Address on a Linux Computer, including the main concepts, relevant details, and practical considerations.

Table of Contents

This updated guide examines Enter: How to Assign an IP Address on a Linux Computer and organizes the essential facts, background, and practical takeaways in clear American English.

Method 1of 2:

On Debian-Based Linux

  1. Enter: How to Assign an IP Address on a Linux Computer — contextual image 1 Verify your Linux version. Popular Debian-based Linux distributions include Ubuntu, Mint, and Raspbian versions.
  2. Enter: How to Assign an IP Address on a Linux Computer — contextual image 2 Open Terminal. This is the command line app that's the basis of all Linux distributions. Depending on your Linux version, you may have several ways of opening Terminal:
    • PressCtrl+Alt+TorCtrl+Alt+F1(if you're on a Mac, substitute the⌘Commandkey forCtrl.
    • Click the text box at the top or bottom of the screen if possible.
    • Open the Menu window and find the "Terminal" application, then click on it.
  3. Enter: How to Assign an IP Address on a Linux Computer — contextual image 3 Switch to root. If you aren't already logged into the "root" user directory, type insuand press↵Enter, then type in your root user password when prompted and press↵Enter.
    • A "root" account is the Linux equivalent of an Administrator account on a Windows or Mac computer.
  4. Enter: How to Assign an IP Address on a Linux Computer — contextual image 4 Bring up a list of your current Internet items. Type inifconfigand press↵Enterto do so. You should see a list of item names appear on the left side of the window with their details listed on the right.
    • The top item should be your current router or Ethernet connection. This item's name is "eth0" (Ethernet) or "wifi0" (Wi-Fi) in Linux.
  5. Enter: How to Assign an IP Address on a Linux Computer — contextual image 5 Find the item to which you want to assign an IP address. Note the name of the item that you want to change. You'll find the name on the left side of the window.
    • In most cases, this is the "eth0" or "wifi0" item.
  6. Enter: How to Assign an IP Address on a Linux Computer — contextual image 6 Change the item's IP address. Type insudo ifconfig name ipaddress netmask 255.255.255.0 up—making sure to replace name with your item's name and ipaddress with your preferred IP address—and press↵Enter.
    • To assign an IP of "192.168.2.100" to your ethernet connection ("eth0"), for example, you'd entersudo ifconfig eth0 192.168.0.100 netmask 255.255.255.0here.
  7. Enter: How to Assign an IP Address on a Linux Computer — contextual image 7 Assign a default gateway. Type inroute add default gw 192.168.1.1and press↵Enter.[1]
  8. Enter: How to Assign an IP Address on a Linux Computer — contextual image 8 Add a DNS server. Type inecho "nameserver 8.8.8.8" > /etc/resolv.confand press↵Enter.
    • If you have a different DNS server address that you would rather use, enter that in the place of8.8.8.8.
  9. Enter: How to Assign an IP Address on a Linux Computer — contextual image 9 Check your item's new IP address. Enter theifconfigcommand again, find your item, and look at the address to the right of the item's name. You should see the IP address that you just assigned.

Method 2of 2:

On RPM-Based Linux

  1. Enter: How to Assign an IP Address on a Linux Computer — contextual image 10 Verify your Linux version. Popular RPM-based Linux distributions include CentOS, Red Hat, and Fedora versions.
  2. Enter: How to Assign an IP Address on a Linux Computer — contextual image 11 Open Terminal. This is the command line app that's the basis of all Linux distributions. Depending on your Linux version, you may have several ways of opening Terminal:
    • PressCtrl+Alt+TorCtrl+Alt+F1(if you're on a Mac, substitute the⌘Commandkey forCtrl.
    • Click the text box at the top or bottom of the screen if possible.
    • Open the Menu window and find the "Terminal" application, then click on it.
  3. Enter: How to Assign an IP Address on a Linux Computer — contextual image 12 Switch to root. If you aren't already logged into the "root" user directory, type insuand press↵Enter, then type in your root user password when prompted and press↵Enter.
    • A "root" account is the Linux equivalent of an Administrator account on a Windows or Mac computer.
  4. Enter: How to Assign an IP Address on a Linux Computer — contextual image 13 Bring up a list of your current Internet items. Type inip ato view your network connections.
  5. Find the network connection that you want to change. This will normally be the Ethernet or Wi-Fi connection, which has an IP address currently listed on the right side of the window.
  6. Enter: How to Assign an IP Address on a Linux Computer — contextual image 14 Switch to the network scripts directory. Type incd /etc/sysconfig/network-scriptsand press↵Enter.
  7. Enter: How to Assign an IP Address on a Linux Computer — contextual image 15 Display the network options. Type inlsand press↵Enter. You should see your current connection's name in the upper-left side of the network option results.
  8. Enter: How to Assign an IP Address on a Linux Computer — contextual image 16 Open the network options for your connection. Type invi ifcfg- network name and press↵Enter. Doing so will open the network's properties in your Vi editor.
    • For a network named "eno12345678", for example, you'd entervi ifcfg-eno12345678here.
  9. Enter: How to Assign an IP Address on a Linux Computer — contextual image 17 Edit the network's information. Change the following values:
    • BOOTPROTO - Changedhcptonone
    • Any IPV6 entry - Delete any IPV6 entries entirely by moving the cursor to theIon the left and pressingDel.
    • ONBOOT - Changenotoyes
  10. Enter: How to Assign an IP Address on a Linux Computer — contextual image 18 Enter a new IP category. Press↵Enterto jump down one line from the ONBOOT category, type inIPADDR=and enter the IP address that you want to use, and then press↵Enter.
    • For example: to use "192.168.2.23" as your IP address, you'd type inIPADDR=192.168.2.23and press↵Enter.
  11. Enter netmask, gateway, and DNS information. To do so:[2]
    • Type inPREFIX=24and press↵Enter. You can also enterNETMASK=255.255.255.0here.
    • Type inGATEWAY=192.168.2.1and press↵Enter. Substitute your preferred gateway address if different.
  12. Enter: How to Assign an IP Address on a Linux Computer — contextual image 19 Save and exit the file. You can use the File menu to do this, or you can type in:wqand press↵Enter.

FAQ

What is Enter: How to Assign an IP Address on a Linux Computer about?

It provides a structured overview of enter, explains the main context, and highlights practical takeaways for readers.

Why does this topic matter?

Understanding the main concepts helps readers evaluate the issue, avoid common mistakes, and make better-informed decisions.

How should readers use this information?

Use the guidance as a practical starting point, confirm details that may have changed, and follow current product, safety, or security recommendations.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.