How VPS - How to use/setup VPS
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Linux

ifconfig vs ip: What’s Difference and Comparing Network Configuration

How VPS by How VPS
November 2, 2018
in Linux, Operating System
0
0
SHARES
21
VIEWS
Share on FacebookShare on Twitter

Contents

  1. ip – A Replacement for ifconfig
  2. ip vs ifconfig Commands
    1. 1. Displaying all Network Interfaces in Linux
      1. ifconfig Command
      2. ip Command
    2. 2. Adding or Deleting an IP Address in Linux
      1. ifconfig – Add/Del IP Address
      2. ip – Add/Del IP Address
    3. 4. Add MAC Hardware Address to Network Interface
      1. ifconfig – Add MAC Address
      2. ip – Add MAC Address
    4. 4. Setting Other Configurations of Network Interface
      1. ifconfig – Other Network Configurations
      2. ip – Other Network Configurations
        1. a. Set MTU value to 2000.
        2. b. Enable or Disable multicast flag.
        3. c. Setting the transmit queue length.
        4. d. Enabling or disabling promiscuous mode.
        5. e. Enable or disable all multicast mode.
    5. 5. Enabling or Disabling Network Interface
      1. ifconfig – Disable/Enable Network Interface
      2. ip – Disable/Enable Network Interface
    6. 6. Enable or disable the use of ARP protocol
      1. ifconfig – Enable/Disable ARP Protocol
      2. ip – Enable/Disable ARP Protocol
  3. Conclusion

Linux based distributions have featured set of commands which provide way to configure networking in easy and powerful way through command-line. These set of commands are available from net-tools package which has been there for a long time on almost all distributions, and includes commands like: ifconfig, route, nameif, iwconfig, iptunnel, netstat, arp.

ifconfig vs ip: What’s Difference and Comparing Network Configuration

Ifconfig Vs IP Command

These commands are just about sufficient in configuring the network in a way any novice or an expert Linux user would want, but due to advancement in Linux kernel over past years and unmaintainable of this packaged set of commands, they are getting deprecated and a more powerful alternative which has ability to replace all of these commands is emerging.

This alternative has also been there for quite some time now and is much more powerful than any of these commands. Rest of sections would highlight this alternative and compare it with one of the command from net-tools package i.e. ifconfig.

ip – A Replacement for ifconfig

ifconfig has been there for a long time and is still used to configure, display and control network interfaces by many, but a new alternative now exists on Linux distributions which is much more powerful than it. This alternative is ip command from iproute2util package.

Although this command might seem a bit complex at first site but it is much broader in functionality than ifconfig. It is functionally organized on two layers of Networking Stack i.e. Layer 2 (Link Layer), Layer 3 (IP Layer) and does the work of all the above mentioned commands from net-tools package.

While ifconfig mostly displays or modifies the interfaces of a system, this command is capable of doing following tasks:

  1. Displaying or Modifying Interface properties.
  2. Adding, Removing ARP Cache entries along creating new Static ARP entry for a host.
  3. Displaying MAC addresses associated with all the interfaces.
  4. Displaying and modifying kernel routing tables.

One of the main highlight which separates it from its ancient counterpart ifconfig is that latter uses ioctl for network configuration, which is a less appreciated way of interaction with kernel while former takes advantage of netlink socket mechanism for the same which is a much more flexible successor of ioctl for inter-communication between kernel and user space using rtnetlink (which adds networking environment manipulation capability).

We can now begin to highlight the features of ifconfig and how they are effectively replaced by ip command.

ip vs ifconfig Commands

Following section highlights some of ifconfig commands and their replacement using ip commands:

1. Displaying all Network Interfaces in Linux

Here, one distinguishing feature between ip and ifconfig is that whereas ifconfig only shows enabled interfaces, ip shows all the interfaces whether enabled or disabled.

ifconfig Command
$ ifconfig
ifconfig vs ip: What’s Difference and Comparing Network Configuration

ifconfig: Check IP Address

ip Command
$ ip a
ifconfig vs ip: What’s Difference and Comparing Network Configuration

ip: Check IP Address

2. Adding or Deleting an IP Address in Linux

The below command assigns the IP address 192.168.80.174 to the interface eth0.

ifconfig – Add/Del IP Address
# ifconfig eth0 add 192.168.80.174

Syntax for adding/removing an interface using ifconfig command:

# ifconfig eth0 add 192.168.80.174
# ifconfig eth0 del 192.168.80.174
ip – Add/Del IP Address
# ip a add 192.168.80.174 dev eth0

Syntax for adding/removing an interface using ip command:

# ip a add 192.168.80.174 dev eth0
# ip a del 192.168.80.174 dev eth0

4. Add MAC Hardware Address to Network Interface

The below command sets the hardware address for the interface eth0 to the value specified in the command. This can be verified by checking the HWaddr value in the output of ifconfig command.

ifconfig – Add MAC Address

Here, the syntax for adding MAC address using ifconfig command:

# ifconfig eth0 hw ether 00:0c:29:33:4e:aa
ip – Add MAC Address

Here, the syntax for adding MAC address using ip command:

# ip link set dev eth0 address 00:0c:29:33:4e:aa

4. Setting Other Configurations of Network Interface

Apart from setting IP address or Hardware address, other configurations that can be applied to an interface include:

  1. MTU (Maximum Transfer Unit)
  2. Multicast flag
  3. Transmit Queue length
  4. Promiscuous mode
  5. Enable or disable all multicast mode
ifconfig – Other Network Configurations
ip – Other Network Configurations

a. Set MTU value to 2000.

 

# ifconfig eth0 mtu 2000
# ip link set dev eth0 mtu 2000

b. Enable or Disable multicast flag.

 

# ifconfig eth0 multicast
# ip link set dev eth0 multicast on

c. Setting the transmit queue length.

 

# ifconfig eth0 txqueuelen 1200
# ip link set dev eth0 txqueuelen 1200

d. Enabling or disabling promiscuous mode.

 

# ifconfig eth0 promisc
# ip link set dev eth0 promisc on

e. Enable or disable all multicast mode.

 

# ifconfig eth0 allmulti
# ip link set dev eth0 allmulti on

5. Enabling or Disabling Network Interface

The below commands enable or disable specific network interface.

ifconfig – Disable/Enable Network Interface

The below command disables the interface eth0 and it is verified by output of ifconfig which by default shows only those interfaces which are up.

# ifconfig eth0 down

To re-enable the interface, just replace down by up.

# ifconfig eth0 up
ip – Disable/Enable Network Interface

The below ip command is alternative for ifconfig to disable a specific interface. This can be verified by the output of 'ip a' command which shows all the interfaces by default, either up or down, but highlights their status along with the description.

# ip link set eth0 down

To re-enable the interface, just replace down with up.

# ip link set eth0 up

6. Enable or disable the use of ARP protocol

The below commands enable or disable ARP protocol on specific network interface.

ifconfig – Enable/Disable ARP Protocol

The command enables ARP protocol to be used with interface eth0. To disable this option, just replace arp with -arp.

# ifconfig eth0 arp
ip – Enable/Disable ARP Protocol

This command is the ip alternative to enable ARP for the interface eth0. To disable, just replace on with off.

# ip link set dev eth0 arp on

Conclusion

Thus, we have highlighted features of ifconfig command and how they can be done using ip command. Currently, Linux distributions provides a user with both the commands so that he can use according to his convenience. So, which command is convenient according to you which you would prefer to use? Do mention this in your comments.

If you want to learn more about these two commands, then you should go through our previous articles that shows some practical examples of ifconfig and ip command in more detailed fashion.

Don’t Miss: 15 “ifconfig” Examples to Configure Network Interface in Linux

Don’t Miss: 10 “ip” Command Examples to Configure Network Interface in Linux

Source: tecmint.com

Tags: Linux Commandslinux guidelinux vps setup guide
How VPS

How VPS

Related Posts

Failed to download metadata for repo 'appstream' on Centos 8
CentOS

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Install Apache Tomcat 8 on CentOS 7
Linux

How to Install Apache Tomcat 8 on CentOS 7?

February 11, 2020
Install Arch Linux With Btrfs Snapshotting
Uncategorized

Install Arch Linux With Btrfs Snapshotting

February 13, 2020
Next Post

How to Upgrade to Ubuntu 12.04 (Precise)

Let Sudo Insult You When You Enter Incorrect Password

How to Compress and Decompress a .bz2 File in Linux

Leave a Reply Cancel reply

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

Follow Us

  • 121 Followers
  • 87.2k Followers

Recommended

EasyCGI Review

4 years ago

3 Ways to List All Installed Packages in RHEL, CentOS and Fedora

4 years ago

Installing Fork CMS on Debian 9

3 years ago
How to setup Directadmin on Google Compute Engine VM/ Amazon cloud?

How to setup Directadmin on Google Compute Engine VM/ Amazon cloud?

4 years ago

Instagram

    Please install/update and activate JNews Instagram plugin.

Categories

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel

Topics

Apache Web Server Bluehost Review 2019 Bluehost Review 2020 Bluehost Review 2021 Centmin Mod CentminMod centos install htop fsck htop install HTTP DoS attack Install Snort on an Ubuntu install Zabbix on CentOS install Zabbix on CentOS 7 Linux Commands linux guide linux install htop linux vps setup guide MariaDB MariaDB Error Mysql mysqld error optimize MariaDB optimize Mysql snort Ubuntu
No Result
View All Result

Highlights

Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

Webmin Reviews

Virtualmin Reviews

CentOS Web Panel Reviews

Ajenti Reviews

ISPConfig Reviews

Trending

Failed to download metadata for repo 'appstream' on Centos 8
CentOS

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

by How VPS
February 25, 2022
0

I tried to update some extensions by use yum on centOs which I specified in Dockerfile. After...

How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020
Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

February 17, 2020
Webmin Reviews

Webmin Reviews

February 17, 2020
How VPS – How to use/setup VPS

We bring you the best Premium WordPress Themes that perfect for news, magazine, personal blog, etc. Visit our landing page to see all features & demos.
LEARN MORE »

Recent News

  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8 February 25, 2022
  • How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”? November 17, 2020
  • How to optimize Mysql or MariaDB November 3, 2020

Categories

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel

[mc4wp_form]

© 2018 JNews - City News Magazine WordPress theme. All rights belong to their respective owners.
JNews is a top selling 2018 WordPress News, Blog, Newspaper & Magazine Theme.

No Result
View All Result
  • Home

© 2023 JNews - Premium WordPress news & magazine theme by Jegtheme.