Windows ipconfig Equivalent In Linux

Windows operating systems provide the ipconfig command in order to display and manage IP addresses and configuration. Some system administrators and users coming from the Windows operating systems may ask that “What is Windows ipconfig command equivalent in Linux distributions?”. The short answer is ifconfig or ip command which is provided by different Linux distributions like Ubuntu, Debian, Mint, CentOS, RHEL, Fedora, etc. In this tutorial, we will provide how to use the ifconfig and ip commands like Windows counterpart ipconfig command.

List IP and Network Configuration

The most popular usecase for the ipconfig command is listing the IP and network configuration of the current system. ipconfig command will list basic information where ipconfig /all will list more detailed and verbose information.

> ipconfig

or

> ipconfig /all

For Linux distributions ifconfig or ip address command can be used to list detailed IP address and configuration information. Recent Linux distributions do not provides the ifconfig by default but can be installed with the following command for Ubuntu, Debian, Mint and Kali.

$ sudo apt install net-tools
$ ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.142.133  netmask 255.255.255.0  broadcast 192.168.142.255
        inet6 fe80::281:dc3d:69d1:6cbc  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:e0:58:54  txqueuelen 1000  (Ethernet)
        RX packets 884353  bytes 1215380632 (1.2 GB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 220346  bytes 16957040 (16.9 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 26013  bytes 2566857 (2.5 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 26013  bytes 2566857 (2.5 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Also we can use the ip address , ip route commands for specific IP and default gateway information.

$ ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:e0:58:54 brd ff:ff:ff:ff:ff:ff
    inet 192.168.142.133/24 brd 192.168.142.255 scope global dynamic noprefixroute ens33
       valid_lft 1453sec preferred_lft 1453sec
    inet6 fe80::281:dc3d:69d1:6cbc/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

Renew IP Address From DHCP Server

Automatically assigned IP address and configuration can be renewed with the ipconfig /renew command in Windows operating systems. For Linux distributions dhclient command can be used but also the interface named like eth0 should be specified. The interface name can be listed with the ip address command which is explained in previous step.

$ sudo dhclient -r eth0

Flush and Reset DNS Cache

Even Linux systems do not store DNS records in a specific DNS cache some helper services like dnsmasq, pdnsd, nscd and dns-clean can store DNS information. They can be flush or reset like below.

READ  Linux top Command Tutorial with Examples

dnsmasq

$ sudo /etc/init.d/dnsmasq restart

pdnsd

$ sudo pdnsd-ctl empty-cache

nscd

$ sudo /etc/init.d/nscd restart

dns-clean

$ sudo /etc/init.d/dns-clean restart

Leave a Comment