Set Static IP in Rocky Linux [6 Different Methods] | GoLinuxCloud (2024)

Table of Contents

Different methods to set Static IP Address - Rocky Linux 8

After a successful installation of Rocky Linux on your environment, there is need to configure network. You can either configure a static or a dynamic IP address. Network connections in Rocky Linux are managed by NetworkManager daemon.

In this guide, we shall discuss how to configure IP addresses on Rocky Linux using the different methods available.

Advertisem*nt

There are many ways to configure IP addresses on Rocky Linux. In this guide, we shall cover the following:

  1. Configuring IP address through manually editing the network interface file.
  2. Configure IP address using ifconfig utility
  3. Using ip utility
  4. Using ifcfg utility
  5. Configuring IP using the NMTUI tool
  6. Configuring IP address using NMCLI tool

Method-1: Manually Edit Network Interface Config File

The first method that we shall discuss is where you edit a configuration file for a specific network interface to set the IP address and other options such as the DNS server.

ALSO READ: Steps to perform Remote Packet Capture with Wireshark

To do this, you first need to identify the available network interfaces. Run the command below to identify the available interfaces.

$ ip addr

You should get an output such as the one below:
Set Static IP in Rocky Linux [6 Different Methods] | GoLinuxCloud (1)

In the above output, I have four interfaces:

  1. Loopback interface (lo)
  2. enp0s3
  3. enp0s8
  4. enp0s9

This information is important as you need to know the interface name, and most importantly the MAC address of the interface that you intend to configure.

Advertisem*nt

It is also important to get the status of the NetworkManager service:

[root@rockylinux-lab ~]# systemctl status NetworkManager● NetworkManager.service - Network Manager Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2021-08-16 22:35:39 EAT; 1min 1s ago Docs: man:NetworkManager(8) Main PID: 777 (NetworkManager) Tasks: 3 (limit: 6001) Memory: 8.5M CGroup: /system.slice/NetworkManager.service └─777 /usr/sbin/NetworkManager --no-daemonAug 16 22:35:42 rockylinux-lab NetworkManager[777]: <info> [1629142542.7282] dhcp6 (enp0s9): activation: beginning transaction (timeout in 45 seconds)Aug 16 22:35:42 rockylinux-lab NetworkManager[777]: <info> [1629142542.8097] dhcp6 (enp0s9): state changed unknown -> boundAug 16 22:35:42 rockylinux-lab NetworkManager[777]: <info> [1629142542.8225] device (enp0s9): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')Aug 16 22:35:42 rockylinux-lab NetworkManager[777]: <info> [1629142542.8380] device (enp0s9): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')Aug 16 22:35:42 rockylinux-lab NetworkManager[777]: <info> [1629142542.8404] device (enp0s9): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')Aug 16 22:35:42 rockylinux-lab NetworkManager[777]: <info> [1629142542.8485] device (enp0s9): Activation: successful, device activated.Aug 16 22:35:42 rockylinux-lab NetworkManager[777]: <info> [1629142542.8514] manager: startup completeAug 16 22:35:43 rockylinux-lab NetworkManager[777]: <info> [1629142543.7429] dhcp4 (enp0s9): state changed expire -> bound, address=192.168.100.123Aug 16 22:35:46 rockylinux-lab NetworkManager[777]: <info> [1629142546.0729] dhcp6 (enp0s3): activation: beginning transaction (timeout in 45 seconds)Aug 16 22:35:46 rockylinux-lab NetworkManager[777]: <info> [1629142546.1053] dhcp6 (enp0s3): state changed unknown -> bound

The network interface configuration files exist at /etc/sysconfig/network-scripts/. The interface configuration files have the prefix ifcfg-<interfacce>

You can list the contents of the directory to identify the interface configuration files under /etc/sysconfig/network-scripts/ as shown:

[root@rockylinux-lab network-scripts]# ls -ltotal 8-rw-r--r--. 1 root root 387 Jun 11 16:06 ifcfg-enp0s3-rw-r--r--. 1 root root 371 Aug 9 16:02 ifcfg-enp0s8-rw-r--r--. 1 root root 371 Aug 9 16:02 ifcfg-enp0s9

Assuming we want to update or add or modify the IP address of the interface enp0s3, we shall edit the file ifcfg-enp0s3.

[root@rockylinux-lab network-scripts]# cat ifcfg-enp0s3TYPE=EthernetPROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=staticHWADDR=08:00:27:dd:31:efDEFROUTE=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noIPV6_ADDR_GEN_MODE=stable-privacyNAME=enp0s3UUID=c75724a4-ae29-4ba4-a098-f6d490357d38DEVICE=enp0s3ONBOOT=yesIPADDR=192.168.100.149PREFIX=24GATEWAY=192.168.100.1DNS1=192.168.100.1DNS2=8.8.8.8DOMAIN=viclab.lan

HINT:

You can generate the UUID of an interface using uuidgen <INTERFACE>, for example to generate UUID of enp0s3 device we will use uuidgen enp0s3

In the above configuration file, the following are the most important fields to take note of:

  1. TYPE - The interface type, such as Ethernet
  2. BOOTPROTO - This is the IP configuration method(Static/DHCP). Use "static" for a static IP or "dhcp" for a DHCP configuration.
  3. ONBOOT - allows the interface to come up when the machine reboots
  4. HWADDR - The MAC address of the interface
  5. DEFROUTE - specify if the interface will be used for the default route.
  6. NAME - The name of the interface, such as enp0s3
  7. DEVICE - The physical NIC name (obtained from "ip addr" command)
  8. IPADDR - The IP address that you intend to assign the interface
  9. PREFIX - The Subnet mask prefix, such as 24, 27, etc.
  10. GATEWAY - the gateway for the IP address assigned
  11. DNS - The DNS IP for the DNS server

Manually update these fields in the respective interface configuration file and save the changes.To activate the configuration, run the command below:

#systemctlrestartnetwork

Method-2: Configure Static IP Address using ifconfig

You can also configure a static IP address on Rocky Linux using the ifconfig tool.

The syntax to configure IP Address using ifconfig tool would be:

ifconfig <interface> <IP Address> netmask <netmask_value>

For example to assign static IP address to enp0s8 interface, execute the following command:

[root@rockylinux-lab ~]# ifconfig enp0s8 172.29.10.10 netmask 255.255.255.0

Next in case this interface is the default interface, you would also need to provide the default gateway. To assign a default gateway to your interface, execute the following command:

[root@rockylinux-lab ~]# sudo route add default gw 172.29.10.1 enp0s8

In the above command, we have set the IP for the interface enp0s8 and also created a default route to pass through the same interface.

NOTE:

Advertisem*nt

The network configuration changes done by ifconfig tool are not persistent and will be overwritten if the network is restarted or the server is rebooted.

Method-3: Configure Static IP using ip command

We can also configure IP using the ip command provided by the iproute2 package. To get the general information of your network configuration on Rocky Linux, use the command below:

[root@rockylinux-lab ~]# ip addr show

You can assign a static IP to an interface using following syntax:

ip addr add <IP Address> dev <interface>

For example to assign static IP to ens0p8 interface, we use following command:

[root@rockylinux-lab ~]# ip addr add 172.29.10.10/24 dev ens0p8

Check the interface details after applying the above command:

[root@rockylinux-lab ~]# ip addr show dev enp0s8

You can then bring down and then bring up the interface to activate the changes:

[root@rockylinux-lab ~]# ip link set enp0s8 down[root@rockylinux-lab ~]# ip link set enp0s8 up

To add the gateway:

Advertisem*nt

[root@rockylinux-lab ~]# ip route add default via 172.29.10.1 dev enp0s8

NOTE:

The network configuration changes done by ip command are not persistent and will be overwritten if the network is restarted or the server is rebooted.

ALSO READ: Install LXD on Rocky Linux 9 [Step-by-Step]

Method-4: Configure Static IP using ifcfg Utility

Configure a static IP on Rocky Linux 8 using the ifcfg utility as shown below:

[root@rockylinux-lab ~]# ifcfg enp0s8 add 172.29.10.10/24

The above command adds the IP 172.29.10.10/24 to the interface enp0s8.

You can remove the IP address on the interface by the command below:

[root@rockylinux-lab ~]# ifcfg enp0s8 del 172.29.10.10/24

To add the gateway:

[root@rockylinux-lab ~]# ip route add default via 172.29.10.1 dev enp0s8

Use the following command to check the default routes:

Advertisem*nt

[root@rockylinux-lab ~]# ip route

Method-5: Set Static IP Address using NMTUI

NMTUI is the acronym of Network Manager Terminal User Interface. This means that you can manage the network using an interface presented through the terminal. To use this tool, you need to have some packages installed.

[root@rockylinux-lab ~]# yum install net-tools -yLast metadata expiration check: 0:00:36 ago on Mon 16 Aug 2021 11:40:50 PM EAT.Dependencies resolved.======================================================================================================== Package Architecture Version Repository Size========================================================================================================Installing: net-tools x86_64 2.0-0.52.20160912git.el8 baseos 321 kTransaction Summary========================================================================================================Install 1 PackageTotal download size: 321 kInstalled size: 942 kDownloading Packages:net-tools-2.0-0.52.20160912git.el8.x86_64.rpm 913 kB/s | 321 kB 00:00 --------------------------------------------------------------------------------------------------------Total 347 kB/s | 321 kB 00:00 Running transaction checkTransaction check succeeded.Running transaction testTransaction test succeeded.Running transaction Preparing : 1/1 Installing : net-tools-2.0-0.52.20160912git.el8.x86_64 1/1 Running scriptlet: net-tools-2.0-0.52.20160912git.el8.x86_64 1/1 /sbin/ldconfig: /etc/ld.so.conf.d/kernel-ml-5.13.8-1.el8.elrepo.x86_64.conf:6: hwcap directive ignored Verifying : net-tools-2.0-0.52.20160912git.el8.x86_64 1/1 Installed: net-tools-2.0-0.52.20160912git.el8.x86_64 Complete!

To edit a network connection, run the command below as root user or with sudo privilege:

nmtui

You will see a screen likethis below:

ALSO READ: Install Tor Browser on Rocky Linux [Step-by-Step]

Set Static IP in Rocky Linux [6 Different Methods] | GoLinuxCloud (2)

Select the "Edit a connection" option to edit a network interface. You will then need to choose the interface that you wish to edit in the subsequent screen.

Set Static IP in Rocky Linux [6 Different Methods] | GoLinuxCloud (3)

Under IPv4 Configuration, hit the Enter key to bring the drop down menu and select Manual. Here, you are required to configure the IP configuration of the interface as desired.

Set Static IP in Rocky Linux [6 Different Methods] | GoLinuxCloud (4)

Advertisem*nt

Set the IPv4 configuration to either Automatic or Manual if you want DHCP or Static IP configuration respectively.

Put the IP address at the "Addresses" section, remember to append the subnet mask of the IP. Such as 192.168.100.149/24 where /24 is the subnet mask prefix.

Add the Gateway for the IP and the DNS servers.

To have the interface always connected (after reboot), check the "Automatically connect" option. It is also advisable to check the "Available to all users" option unless you have a reason not to.

Finish the configuration by pressing "OK" at the bottom. Head back to the first screen to activate the connection.

HINT:

You may choose to Disable IPv6 Configuration by selecting Ignore. But this is optional based on your requirement.

Set Static IP in Rocky Linux [6 Different Methods] | GoLinuxCloud (5)

Choose the "Activate a connection" option to activate the specific interface that we have configured in the previous step.

Choose the interface then select the "Activate" button on the right.

Set Static IP in Rocky Linux [6 Different Methods] | GoLinuxCloud (6)

You can now exit and verify that the interface has come up.

[root@rockylinux-lab ~]# ifconfig enp0s3enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.100.149 netmask 255.255.255.0 broadcast 192.168.100.255 inet6 fe80::c11d:a25a:e065:1357 prefixlen 64 scopeid 0x20<link> ether 08:00:27:dd:31:ef txqueuelen 1000 (Ethernet) RX packets 23547 bytes 29765516 (28.3 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1369 bytes 219204 (214.0 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

You can also use nmtui to set the system hostname.

To achieve this, run the nmtui command once more and select the set system hostname option.

Set Static IP in Rocky Linux [6 Different Methods] | GoLinuxCloud (7)

Set the hostname in the space provided then press "OK"

Set Static IP in Rocky Linux [6 Different Methods] | GoLinuxCloud (8)

You will receivea prompt that the hostname configuration has been successful.

Set Static IP in Rocky Linux [6 Different Methods] | GoLinuxCloud (9)

Verify the hostname by running the command below:

[root@rockylinux-lab ~]# hostnamectl Static hostname: rockylinux-lab Icon name: computer-vm Chassis: vm Machine ID: 9111f432e0bf7140bb8c3641026cf405 Boot ID: 9c293f77af9542ddaa9506c77fb69bd1 Virtualization: oracle Operating System: Rocky Linux 8.4 (Green Obsidian) CPE OS Name: cpe:/o:rocky:rocky:8.4:GA Kernel: Linux 5.13.8-1.el8.elrepo.x86_64 Architecture: x86-64

Method-6: Set Static IP Address using NMCLI on Rocky Linux

NMCLI is an acronym for Network Manager Command Line Interface. Just like NMTUI, NMCLI is a command-line NetworkManager configuration tool.

This tool can also be used to configure the network interfaces just like the two methods we have discussed above.

ALSO READ: Install WordPress on Rocky Linux 9 [Step-by-Step]

To configure the interfaces, we first of all need to check and see the available configurations.

[root@rockylinux-lab ~]# nmclienp0s9: connected to enp0s9 "Intel 82540EM" ethernet (e1000), 08:00:27:8F:41:38, hw, mtu 1500 ip4 default inet4 192.168.100.123/24 route4 0.0.0.0/0 route4 192.168.100.0/24 inet6 fe80::343d:6ce4:74e3:7e3/64 route6 fe80::/64...DNS configuration: servers: 192.168.100.1 interface: enp0s9 servers: 192.168.100.1 8.8.8.8 domains: viclab.lan interface: enp0s3

You can also use the nmcli device show command to see a more detailed picture of your network configuration.

[root@rockylinux-lab ~]# nmcli device showGENERAL.DEVICE: enp0s9GENERAL.TYPE: ethernetGENERAL.HWADDR: 08:00:27:8F:41:38GENERAL.MTU: 1500GENERAL.STATE: 100 (connected)GENERAL.CONNECTION: enp0s9GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/5WIRED-PROPERTIES.CARRIER: onIP4.ADDRESS[1]: 192.168.100.123/24IP4.GATEWAY: 192.168.100.1IP4.ROUTE[1]: dst = 0.0.0.0/0, nh = 192.168.100.1, mt = 102IP4.ROUTE[2]: dst = 192.168.100.0/24, nh = 0.0.0.0, mt = 102IP4.DNS[1]: 192.168.100.1IP6.ADDRESS[1]: fe80::343d:6ce4:74e3:7e3/64IP6.GATEWAY: --IP6.ROUTE[1]: dst = fe80::/64, nh = ::, mt = 102...

To configure manual network configuration for an interface using NMCLI, follow the interface below:

[root@rockylinux-lab ~]# nmcli connection modify enp0s8 IPv4.address 172.29.10.10/24

The above command sets the IP 172.29.10.10/24 to the interface enp0s8.

You can also add the Gateway and DNS settings as below:

[root@rockylinux-lab ~]# nmcli connection modify enp0s8 IPv4.gateway 172.29.20.1[root@rockylinux-lab ~]# nmcli connection modify enp0s8 IPv4.dns 8.8.8.8

Finally, set the IP for the interface to manual:

[root@rockylinux-lab ~]# nmcli connection modify enp0s8 IPv4.method manual

You can also use the nmcli shell to edit interface configuration for a specific interface.

[root@rockylinux-lab ~]# nmcli connection edit enp0s8

You will be presented with an interface such as this below:

[root@rockylinux-lab ~]# sudo nmcli connection edit enp0s8===| nmcli interactive connection editor |===Editing existing '802-3-ethernet' connection: 'enp0s8'Type 'help' or '?' for available commands.Type 'print' to show all the connection properties.Type 'describe [<setting>.<prop>]' for detailed property description.You may edit the following settings: connection, 802-3-ethernet (ethernet), 802-1x, dcb, sriov, ethtool, match, ipv4, ipv6, hostname, tc, proxynmcli> 

You can run commands such as describe interface and also add the IP configuration from this shell.

nmcli> set IPv4.addresses 172.29.10.10/24nmcli> set IPv4.gateway 172.29.10.1nmcli> set IPv4.dns 8.8.8.8nmcli> set IPv4.method manualnmcli> 

Save the configuration for the settings to take effect.

nmcli> saveConnection 'enp0s8' (a5a17c19-45d7-31ef-bd8e-8aa698d8a1f9) successfully updated.nmcli> quit

Verify the IP configuration

[root@rockylinux-lab ~]# nmcli...enp0s8: connected to enp0s8 "Intel 82540EM" ethernet (e1000), 08:00:27:9B:ED:44, hw, mtu 1500 inet4 172.29.10.8/24 inet4 172.29.10.10/24 route4 172.29.10.0/24 route4 172.29.10.0/24 route4 0.0.0.0/0 inet6 fe80::31dd:21b8:5737:333d/64 route6 fe80::/64...
ALSO READ: Install Apache from Source Code Rocky Linux [Step-by-Step]

Conclusion

In this tutorial we covered different methods to configure static IP Address in Rocky Linux using different tools and commands. The network configuration done using ip, ifcfg and ifconfig tool are non-persistent which means the changes are temporary and are valid only for the current session. If someone restarts the network service then your changes will be overwritten. Or if someone reboots the server then also the changes will be overwritten with the default configuration.

So if you are looking to set static IP address persistently across reboot then you should choose nmcli, nmtui or manually updating the network configuration file.

Further Reading

Rocky Linux Network Configuration

Set Static IP in Rocky Linux [6 Different Methods] | GoLinuxCloud (2024)

FAQs

How do I set a static IP in Linux? ›

Here is a step-by-step guide to setting up a static IP address on a Linux system.
...
Add or modify the configuration below :
  1. BOOTPROTO=static.
  2. IPADDR=192.168. 0.1.
  3. NETMASK=255.255. 255.0.
  4. GATEWAY=192.168. 0.1.
  5. DNS1=8.8. 8.8.
  6. DNS2=8.8. 4.4.
29 Dec 2020

How do you find IP address in Rocky Linux? ›

Find the Public IP address on Rocky Linux
  1. curl ifconfig.me.
  2. curl icanhazip.com.
  3. curl ipinfo.io/ip.
  4. curl api.ipify.org.
  5. curl checkip.dyndns.org.
  6. dig +short myip.opendns.com @resolver1.opendns.com.
  7. host myip.opendns.com resolver1.opendns.com.
  8. curl ident.me.

How do I change my IP address on Linux 6? ›

To change the ip-address along with the hostname, follow the steps shown below.
...
I. Change HostName From Command Line
  1. Use hostname command to Change Hostname. In this example, we'll change the hostname from dev-server to prod-server. ...
  2. Modify the /etc/hosts file. ...
  3. Modify the /etc/sysconfig/network file. ...
  4. Restart the Network.
14 Oct 2013

How do I change my IP address on Rocky Linux? ›

Set Static IP in Rocky Linux [6 Different Methods]
  1. Different methods to set Static IP Address – Rocky Linux 8.
  2. Method-1: Manually Edit Network Interface Config File.
  3. Method-2: Configure Static IP Address using ifconfig.
  4. Method-3: Configure Static IP using ip command.
  5. Method-4: Configure Static IP using ifcfg Utility.

What is static IP with example? ›

A static IP address is simply an address that doesn't change. Once your device is assigned a static IP address, that number typically stays the same until the device is decommissioned or your network architecture changes. Static IP addresses generally are used by servers or other important equipment.

How do I enable network in Rocky Linux? ›

method to manual, setting the ipv4. gateway and then setting the ipv4.
...
IP Address Changing with nmcli
  1. Remove the IPv4 Gateway.
  2. Remove the IPv4 Address that we statically assigned.
  3. Change the IPv4 Method to automatic.
  4. Down and Up the interface.
30 Sept 2022

How do I manually set an IP address in Linux? ›

To change your IP address on Linux, use the “ifconfig” command followed by the name of your network interface and the new IP address to be changed on your computer. To assign the subnet mask, you can either add a “netmask” clause followed by the subnet mask or use the CIDR notation directly.

What is command for IP address in Linux? ›

You can determine the IP address or addresses of your Linux system by using the hostname , ifconfig , or ip commands. To display the IP addresses using the hostname command, use the -I option. In this example the IP address is 192.168. 122.236.

How do I manually change my IP address? ›

To enable DHCP or change other TCP/IP settings
  1. Select Start, then type settings. Select Settings > Network & internet.
  2. Do one of the following: ...
  3. Next to IP assignment, select Edit.
  4. Under Edit network IP settings or Edit IP settings, select Automatic (DHCP) or Manual. ...
  5. When you're done, select Save.

How do I change the IP address of a domain name in Linux? ›

Change DNS settings on Linux
  1. Open the resolv.conf file with an editor, such as nano , to make the necessary changes. ...
  2. Add lines for the name servers that you want to use. ...
  3. Save the file.
  4. To ensure that your new settings are working, ping the domain name by using the following command:
22 Jul 2019

How do I get IP 6? ›

Type “ipconfig/all” on the blinking cursor then press [Enter]. NOTE: You will find the IPv6 Address network details under the Ethernet adapter Local Area Connection section.

How do I set a static IP for a device? ›

Change your DHCP settings
  1. Open the Google Home app .
  2. Tap Wi-Fi Settings. Advanced Networking.
  3. Tap DHCP IP reservations. Add IP reservations .
  4. Tap the device for which you'd like to assign a static IP.
  5. Enter a static IP address, then tap Save .

Can I set static IP address? ›

You can assign these static IP addresses on the device itself—using, say, Windows' network settings on each computer—or you can do it at the router level. Doing it at the router level is called assigning a DHCP reservation, though many people (and even some routers) still refer to it as a "static IP address."

Why there are 5 classes in IP address? ›

Primarily, class A, B, and C are used by the majority of devices on the Internet. Class D and class E are for special uses. The list below shows the five available IP classes, along with the number of networks each can support and the maximum number of hosts (devices) that can be on each of those networks.

How do I change my IP address to an exact location? ›

Six ways to change your IP address and location
  1. Get a reliable VPN subscription to change your IP address. ...
  2. Download the VPN app to your device and install it.
  3. Open the application and enter your credentials to log in..
  4. Click the “Quick connect” button to connect to the best remote server in seconds.
28 Mar 2022

How is an IP address format? ›

An IP address is typically written in decimal digits, formatted as four 8-bit fields separated by periods. Each 8-bit field represents a byte of the IP address. This form of representing the bytes of an IP address is often referred to as the dotted-decimal format.

Can I change my IP address to a different location? ›

Literally just open your VPN app and connect to any city other than your current one -- in less than 30 seconds, you've changed your IP so it appears to be from wherever you chose. Browser-based VPNs and proxies are much more lightweight than standalone VPN apps.

What are the 4 types of IP address? ›

An internet protocol (IP) address allows computers to send and receive information. There are four types of IP addresses: public, private, static, and dynamic.

How many types of static IP are there? ›

Two types of IP addresses are 1)IPV4 and 2) IPV6.

What is static IP mode? ›

When a device is assigned a static IP address, the address does not change. Most devices use dynamic IP addresses, which are assigned by the network when they connect and change over time.

How do I reset my Rocky network? ›

Rocky Linux
  1. Use the following command to restart the server networking service. # nmcli networking off # nmcli networking on or # systemctl restart NetworkManager.
  2. Either of the below commands can be executed to check the status of the networking service. # nmcli -o or # systemctl status NetworkManager.
26 May 2022

How do I manually configure a network? ›

Right-click the Wi-Fi signal and select Open Network and Sharing Center. Select Set up a new connection or network. Select Manually connect to a wireless network and click Next.

What is network configuration command in Linux? ›

ifconfig

Linux ifconfig stands for interface configurator. It is one of the most basic commands used in network inspection. ifconfig is used to initialize an interface, configure it with an IP address, and enable or disable it. It is also used to display the route and the network interface.

How list all IP address in Linux? ›

The following commands will get you the private IP address of your interfaces:
  1. ifconfig -a.
  2. ip addr (ip a)
  3. hostname -I | awk '{print $1}'
  4. ip route get 1.2.3.4 | awk '{print $7}'
  5. (Fedora) Wifi-Settings→ click the setting icon next to the Wifi name that you are connected to → Ipv4 and Ipv6 both can be seen.

What is my IP command line? ›

First, click on your Start Menu and type cmd in the search box and press enter. A black and white window will open where you will type ipconfig /all and press enter. There is a space between the command ipconfig and the switch of /all. Your ip address will be the IPv4 address.

What is host name in Linux? ›

A hostname is the name of any computer that is connected to a network that is uniquely identified over a network. It can be accessed without using a particular IP address. By default, the hostname of a system is set during the installation of OS.

How do I set a static IP address in command prompt? ›

Windows 10
  1. Right-click the Start menu and select Command Prompt (Admin).
  2. Enter your admin username and password, if prompted.
  3. A command prompt window will open. At the flashing cursor, type ipconfig /release. ...
  4. Type ipconfig /renew to get a new IP address.
  5. Type exit to exit the command prompt.
19 Apr 2021

What is the best IPv4 address? ›

Some of the most trustworthy, high-performance DNS public resolvers and their IPv4 DNS addresses include:
  • Cisco OpenDNS: 208.67. 222.222 and 208.67. 220.220;
  • Cloudflare 1.1. 1.1: 1.1. 1.1 and 1.0. 0.1;
  • Google Public DNS: 8.8. 8.8 and 8.8. 4.4; and.
  • Quad9: 9.9. 9.9 and 149.112. 112.112.
23 Sept 2019

What is default gateway IP? ›

What is a default gateway address? Your default gateway address will usually be your router's IP address. That's right: your Wi-fi router has its own unique IP tag. This identifying code allows information to reach your network, and it's worth knowing how to find it for yourself.

How set DNS name in Linux? ›

9 Steps Of DNS Configuration
  1. Install bind packages with their dependencies. ...
  2. Assign a static IP address in Linux OS. ...
  3. Add a host entry in the host file. ...
  4. Add server IP to the resolv. ...
  5. Configure /etc/named. ...
  6. Open /etc/amed. ...
  7. Configure forward and reverse zones.
11 Oct 2021

How do I set domain name in Linux? ›

Procedure
  1. As user root on the servers, check to see if the domain name is set by running the following command: # domainname. If nothing is returned, the domain is not set.
  2. To set the domain, run the following command: # domainname <domain> <domain> is the selected domain name for the system, for example, ibm.com.

How do I change DNS name in Linux? ›

Change your DNS servers on Linux
  1. Open the terminal by pressing Ctrl + T.
  2. Enter the following command to become the root user: su.
  3. Once you've entered your root password, run these commands: rm -r /etc/resolv.conf. ...
  4. When the text editor opens, type in the following lines: nameserver 103.86.96.100. ...
  5. Close and save the file.

Is IPv6 static or dynamic? ›

Similar to IPv4, IPv6 too supports both static and dynamic routing. Configuration commands for its static routing are similar to IPv4.

Can you ping ip6? ›

The Ping6 test is a point-to-point test that accepts an IPv6 address or IPv6 host name to see if an IPv6 switch is communicating properly with another device on the same or another IPv6 network. A ping test checks the path between the switch and another device by sending IP packets (ICMP Echo Requests).

How do I find my IPv6 address in Linux? ›

Generic unix instructions for determining your IPv6 address and default route: Run ifconfig -a and look for inet6 to see your possible IPv6 addresses. Run netstat -nr and look for inet6 or Internet6 or similar to find the IPv6 portion; then look for default or :: or ::/0 .

Can I set my own static IP? ›

You can assign these static IP addresses on the device itself—using, say, Windows' network settings on each computer—or you can do it at the router level. Doing it at the router level is called assigning a DHCP reservation, though many people (and even some routers) still refer to it as a "static IP address."

How do I find my static IP address in Linux? ›

There is no explicit way to check whether your IP is static or dynamic in Linux. There are some indirect methods to spot that your IP is dynamic or static. The most pragmatic approach is to monitor your IP every time you reboot your system. If it changes, then your IP is dynamic, otherwise static.

How do I assign a static IP address to my device? ›

Change your DHCP settings
  1. Open the Google Home app .
  2. Tap Wi-Fi Settings. Advanced Networking.
  3. Tap DHCP IP reservations. Add IP reservations .
  4. Tap the device for which you'd like to assign a static IP.
  5. Enter a static IP address, then tap Save .

How do I set a static IP manually? ›

How to Set a Static IP Address
  1. Access the Control Panel. In the Windows search bar, type in “ncpa. ...
  2. Select the Network Adapter. ...
  3. Select Properties. ...
  4. Select Internet Protocol Version 4 (TCP/IPv4) ...
  5. Manually enter IP address and subnet mask. ...
  6. Save Settings. ...
  7. Revert Back to DHCP.

What is IP Config command in Linux? ›

ifconfig(interface configuration) command is used to configure the kernel-resident network interfaces. It is used at the boot time to set up the interfaces as necessary. After that, it is usually used when needed during debugging or when you need system tuning.

Is static IP same as private? ›

Static means the IP address never changes as long as you stay with the same provider or same server. Dynamic means the IP address can change from time-to-time. Public means the IP address can be visited from any computer in the world. Private means the IP address can only be used by those on the same network.

Can you have 2 static IP addresses? ›

When you enable multiple static IPs on your account, your router must request a dynamic WAN address via DHCP. Google Fiber will then route a subnet to your network, which provides multiple IP addresses. One static IP must be used as a gateway to the Internet.

How can I get my static IP address? ›

Right click on your wireless connection adapter (it will likely be the only one with the green internet icon) and select "Properties" from the drop-down menu. 4. This will open a new window. In the "Networking" tab, select "Internet Protocol Version 4 (TCP/IPv4)" and click the "Properties" button.

How do I open a static IP address? ›

Assign static IP for Ethernet adapter
  1. Open Settings.
  2. Click on Network & Internet.
  3. Click on Ethernet.
  4. Click on the current network connection.
  5. Under the “IP settings” section, click the Edit button.
  6. Using the drop-down menu, select the Manual option.
  7. Turn on the IPv4 toggle switch.
  8. Set the static IP address.
16 Nov 2022

How can I check my static IP address? ›

Determine if your external IP address is static or dynamic
  1. Restart your router.
  2. Check your external IP address again and compare it. If it has changed, you have a dynamic external IP address. If it has not changed, you may have a static IP address.
19 Jan 2021

What are the methods to assign IP address to the devices? ›

Static IP vs Dynamic IP

There are two methods of assigning IP address to your devices and computers. Either a static or dynamic IP address is assigned to a device when it connects to the internet. This goes the same way when we host your dedicated server.

What is a 169.254 IP address? ›

If you see a 169.254. x.x address, it means that the DHCP server is not reachable. The PC will not work because there is not a router to or from that PC. Troubleshoot this by finding out why the PC cannot see the DHCP server.

Top Articles
Latest Posts
Article information

Author: Francesca Jacobs Ret

Last Updated:

Views: 6021

Rating: 4.8 / 5 (48 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Francesca Jacobs Ret

Birthday: 1996-12-09

Address: Apt. 141 1406 Mitch Summit, New Teganshire, UT 82655-0699

Phone: +2296092334654

Job: Technology Architect

Hobby: Snowboarding, Scouting, Foreign language learning, Dowsing, Baton twirling, Sculpting, Cabaret

Introduction: My name is Francesca Jacobs Ret, I am a innocent, super, beautiful, charming, lucky, gentle, clever person who loves writing and wants to share my knowledge and understanding with you.